From 48d5b5bf28761416f8ea0f73b349daf5d4a6143a Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Tue, 19 Mar 2019 11:01:39 +0100 Subject: [PATCH] added CI, fixed configuration --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++++ CMakeLists.txt | 28 +++++++++++----------------- README.org | 14 +++++++++++--- src/{main.cpp => main.cc} | 0 4 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 .gitlab-ci.yml rename src/{main.cpp => main.cc} (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8157f0d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +image: conanio/clang7 + +build: + stage: build + before_script: + - apt update && apt -y install cmake ninja + - pip install conan --upgrade + - conan profile new default --detect + - conan profile update settings.compiler=clang default + - conan profile update settings.compiler.version=7.0 default + - conan profile update settings.compiler.libcxx=libstdc++11 default + - conan profile update env.CC=/bin/clang default + - conan profile update env.CXX=/bin/clang++ default + script: + - mkdir build && cd build + - conan install .. --build missing + - export CC=clang + - export CXX=clang++ + - cmake .. -G Ninja + - cmake --build . + artifacts: + paths: + - mybinary + cache: + paths: + - "*.o" + - "~/.conan/" + +# test: +# stage: test +# script: +# - ./runmytests.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 14e5c03..b9720eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,14 @@ cmake_minimum_required(VERSION 3.14) -project("AwesomeCppTemplate" - VERSION 0.1.2 - DESCRIPTION "Configure C++17 project files layout fast and simply." - HOMEPAGE_URL "https://github.com/devkoriel/AwesomeCppTemplate" +project("GeneticImages" + VERSION 0.1 + DESCRIPTION "Recreate reference images with genetic algorithms" + HOMEPAGE_URL "https://labs.phundrak.fr/phundrak/genetic-images" LANGUAGES CXX) -# project( -# [VERSION [.[.[.]]]] -# [DESCRIPTION ] -# [HOMEPAGE_URL ] -# [LANGUAGES ...]) -set(SRC_FILES src/main.cpp) -# Example: set(SRC_FILES ) +file(GLOB SRC_FILES "src/*.cc") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") -# find_package(Foo REQUIRED) # FOO_INCLUDE_DIR, FOO_LIBRARIES -# find_package(Boo REQUIRED) # BOO_INCLUDE_DIR, BOO_LIBRARIES include(functions) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) @@ -24,12 +16,14 @@ conan_basic_setup() enable_cxx_compiler_flag_if_supported("-Wall") enable_cxx_compiler_flag_if_supported("-pedantic") +enable_cxx_compiler_flag_if_supported("-pthread") # include_directories() -add_executable(md5 ${SRC_FILES}) -target_compile_features(md5 PRIVATE cxx_std_17) -target_include_directories(md5 PRIVATE include/libfoo) -target_link_libraries(md5 ${CONAN_LIBS}) +set(TGT genetic-image) +add_executable(${TGT} ${SRC_FILES}) +target_compile_features(${TGT} PRIVATE cxx_std_17) +target_include_directories(${TGT} PRIVATE include/genimg) +target_link_libraries(${TGT} ${CONAN_LIBS}) # OS specific instructions. if(APPLE) diff --git a/README.org b/README.org index ca68292..2e38fa1 100644 --- a/README.org +++ b/README.org @@ -9,6 +9,16 @@ image as close as possible to the reference image. * Technical information +To build the project, you will also be required to install the development +libraries your distro offers for GTK+3. For Ubuntu, it is ~libgtk3-devel~, for Void Linux it is ~gtk3-devel~ and for Arch Linux it is already bundled with the ~gtk3~ package. + +You will also ned to have Ninja and Conan installed. To install Ninja, install +the appropriate package offered by your package manager (~ninja-build~ on +Debian, ~ninja~ on Arch Linux and Void Linux), and to install conan, use ~pip~. +#+begin_src shell + pip install --user conan +#+end_src + This project is built with conan, ninja and cmake using clang-7 for C++17. To use it, first install clang-7 and lldb 7, then run this: #+begin_src shell @@ -27,9 +37,7 @@ Then, To build and run the program, go to the root of the project and run this: #+begin_src shell mkdir build && cd build conan install .. --build missing - export CC=clang - export CXX=clang++ - cmake .. -G Ninja + cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. -G Ninja cmake --build . #+end_src If you want to use another profile than your default one, you should run the diff --git a/src/main.cpp b/src/main.cc similarity index 100% rename from src/main.cpp rename to src/main.cc