From 9b49b8ebe7961080eb8c259ed0615687aa713004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 29 Nov 2016 02:43:17 +0100 Subject: [PATCH] CMake project restructuring. --- .travis.yml | 16 ++++++++++------ CMakeLists.txt | 13 ++++++++----- {apps/plasp-app => app}/CMakeLists.txt | 2 +- {apps/plasp-app => app}/main.cpp | 0 apps/CMakeLists.txt | 1 - 5 files changed, 19 insertions(+), 13 deletions(-) rename {apps/plasp-app => app}/CMakeLists.txt (94%) rename {apps/plasp-app => app}/main.cpp (100%) delete mode 100644 apps/CMakeLists.txt diff --git a/.travis.yml b/.travis.yml index 85c2ce5..f4873f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,13 @@ matrix: - *default_packages - g++-6 script: - - git submodule init - - git submodule update - - mkdir build - - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER=$_CXX - - make -j3 && make -j3 run-tests + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then + CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.0-Linux-x86_64.tar.gz"; + mkdir cmake-bin && wget --quiet --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-bin; + export PATH=${PWD}/cmake-bin/bin:${PATH}; + fi + - git submodule update --recursive --init + - mkdir -p build/debug + - cd build/debug + - cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$_CXX -DPLASP_BUILD_TESTS=ON + - make -j3 plasp-app && make -j3 run-tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 368a525..33b7ff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,23 @@ cmake_minimum_required(VERSION 2.6) project(plasp CXX) -option(BUILD_TESTS "Build unit tests" OFF) +option(PLASP_BUILD_TESTS "Build unit tests" OFF) find_package(Boost 1.55.0 COMPONENTS program_options iostreams system filesystem REQUIRED) set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic") set(CMAKE_CXX_FLAGS_DEBUG "-g") -add_definitions(-std=c++14) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) add_subdirectory(src) -add_subdirectory(apps) -if(BUILD_TESTS) +add_subdirectory(app) +if(PLASP_BUILD_TESTS) add_subdirectory(tests) -endif(BUILD_TESTS) +endif(PLASP_BUILD_TESTS) diff --git a/apps/plasp-app/CMakeLists.txt b/app/CMakeLists.txt similarity index 94% rename from apps/plasp-app/CMakeLists.txt rename to app/CMakeLists.txt index fbc0b5f..7682090 100644 --- a/apps/plasp-app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,4 +1,4 @@ -set(target plasp_app) +set(target plasp-app) file(GLOB core_sources "*.cpp") file(GLOB core_headers "*.h") diff --git a/apps/plasp-app/main.cpp b/app/main.cpp similarity index 100% rename from apps/plasp-app/main.cpp rename to app/main.cpp diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt deleted file mode 100644 index f30b3d4..0000000 --- a/apps/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(plasp-app)