added CI, fixed configuration

This commit is contained in:
Phuntsok Drak-pa 2019-03-19 11:01:39 +01:00
parent 0239487ffb
commit 48d5b5bf28
4 changed files with 54 additions and 20 deletions

32
.gitlab-ci.yml Normal file
View File

@ -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

View File

@ -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(<PROJECT-NAME>
# [VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
# [DESCRIPTION <project-description-string>]
# [HOMEPAGE_URL <url-string>]
# [LANGUAGES <language-name>...])
set(SRC_FILES src/main.cpp)
# Example: set(SRC_FILES <SOURCE 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(<PUBLIC HEADER 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)

View File

@ -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