From be71587729a5fd8f92900a27506e3823915d3561 Mon Sep 17 00:00:00 2001 From: Gert Van Hoey Date: Tue, 3 Oct 2017 09:02:08 +0200 Subject: [PATCH 01/27] Exclude catch.hpp and contract.cpp from coverage at any location --- CodeCoverage.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CodeCoverage.cmake b/CodeCoverage.cmake index 5f2735c..623eea9 100644 --- a/CodeCoverage.cmake +++ b/CodeCoverage.cmake @@ -54,7 +54,8 @@ if(CODE_COVERAGE) COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info \*tests\* -o coverage.info COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info \*qrc_\* -o coverage.info COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info ui_\*.h -o coverage.info - COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info catch.hpp -o coverage.info + COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info \*catch.hpp\* -o coverage.info + COMMAND ${LCOV_EXECUTABLE} --quiet --remove coverage.info \*contract.cpp\* -o coverage.info COMMAND ${LCOV_EXECUTABLE} --list coverage.info COMMAND ${LCOV_EXECUTABLE} --summary coverage.info WORKING_DIRECTORY ${CMAKE_BINARY_DIR} From f0dec9081b5580c17ab8be7141a0d5d4fb8b6cfd Mon Sep 17 00:00:00 2001 From: Gert Van Hoey Date: Tue, 3 Oct 2017 09:02:57 +0200 Subject: [PATCH 02/27] Fix finding of Gcov in case compiler ID is 'AppleClang' instead of 'Clang' --- FindGcov.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FindGcov.cmake b/FindGcov.cmake index cdc52a1..888482b 100644 --- a/FindGcov.cmake +++ b/FindGcov.cmake @@ -13,7 +13,7 @@ if(GCOV_EXECUTABLE AND NOT EXISTS "${GCOV_EXECUTABLE}") set(GCOV_EXECUTABLE "notfound" CACHE PATH FORCE "") endif() -IF(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +IF(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") MESSAGE(WARNING "Compiler is not GNU gcc or Clang!") set(GCOV_EXECUTABLE "notfound" CACHE PATH FORCE "") ELSEIF( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) @@ -21,7 +21,7 @@ ELSEIF( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) set(GCOV_EXECUTABLE "notfound" CACHE PATH FORCE "") ELSE() find_program(GCOV_EXECUTABLE NAMES gcov) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") include(FindPackageHandleStandardArgs) find_package_handle_standard_args( Gcov DEFAULT_MSG From d06f4ee0c26c89bcb1c8c6262f7c448cc4011464 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 19 Oct 2017 17:35:18 +0200 Subject: [PATCH 03/27] Only define doxygen when already defined. --- Doxygen.cmake | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Doxygen.cmake b/Doxygen.cmake index 2be0c21..4f0fabe 100644 --- a/Doxygen.cmake +++ b/Doxygen.cmake @@ -1,20 +1,22 @@ -# check if Doxygen is installed -find_package(Doxygen) -if (DOXYGEN_FOUND) - # set input and output files - set(DOXYGEN_IN ${CMAKE_CURRENT_LIST_DIR}/Doxyfile.in) - set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) +if (NOT TARGET doxygen) + # check if Doxygen is installed + find_package(Doxygen) + if (DOXYGEN_FOUND) + # set input and output files + set(DOXYGEN_IN ${CMAKE_CURRENT_LIST_DIR}/Doxyfile.in) + set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - # request to configure the file - configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) - message("Doxygen build started") + # request to configure the file + configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) + message("Doxygen build started") - # note the option ALL which allows to build the docs together with the application - add_custom_target(doxygen - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM ) -else (DOXYGEN_FOUND) - message("Doxygen need to be installed to generate the doxygen documentation") -endif (DOXYGEN_FOUND) + # note the option ALL which allows to build the docs together with the application + add_custom_target(doxygen + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM ) + else (DOXYGEN_FOUND) + message("Doxygen need to be installed to generate the doxygen documentation") + endif (DOXYGEN_FOUND) +endif() From 3a11a2e6452627d8a6aa263eb4b0cade9a0db034 Mon Sep 17 00:00:00 2001 From: "BARCO\\SDD" Date: Tue, 21 Nov 2017 09:12:19 +0100 Subject: [PATCH 04/27] Fix VS2015 compiler warning when using QString library Visual studio 2015 (rightfully) gives warning C4714 complaining that certain Qt functions are marked __forceinline but are not inlined This is a bug in Qt (https://bugreports.qt.io/browse/QTBUG-55042) This is fixed in 5.10.0, but we are using 5.9, so until we switch to Qt 5.10 disable this warning to make this compile using VS2015 --- CompilerFlags.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CompilerFlags.cmake b/CompilerFlags.cmake index dbe95a4..cd07f59 100644 --- a/CompilerFlags.cmake +++ b/CompilerFlags.cmake @@ -192,6 +192,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # "/wd4512" # suppress warning: assignment operator could not be generated # A fix is planned in Qt 5.4.2 (https://bugreports.qt.io/browse/QTBUG-7233) # Check later with Qt >= 5.4.2 if warning suppression can be removed + "/wd4714" # suppress warning: marked __forceinline but are not inlined + # Fixed in Qt 5.10.0 (https://bugreports.qt.io/browse/QTBUG-55042) + # Check later with Qt >= 5.10.0 if warning suppression can be removed "/nologo" "/EHsc-" # disable exceptions "/GR-" # disable RTTI From 52d50baf28549c7df8ed938610d004dfa61ec41f Mon Sep 17 00:00:00 2001 From: frederik vannoote Date: Tue, 5 Dec 2017 08:58:44 +0100 Subject: [PATCH 05/27] Always compile manual tests. Only run them if flag ENABLE_MANUAL_TESTS is ON. --- AddQtTest.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AddQtTest.cmake b/AddQtTest.cmake index 557480c..b83ae8f 100644 --- a/AddQtTest.cmake +++ b/AddQtTest.cmake @@ -19,9 +19,13 @@ endmacro() option(MANUAL_TESTS_ENABLED "Enable manual tests" OFF) macro(add_manual_qt_test TEST_NAME SRCS) + find_package(Qt5Test REQUIRED) + add_executable(${TEST_NAME} ${SRCS}) + target_link_libraries(${TEST_NAME} PUBLIC Qt5::Test) + if(DEFINED MANUAL_TESTS_ENABLED) if(${MANUAL_TESTS_ENABLED}) - add_qt_test(${TEST_NAME} "${SRCS}") + add_test(NAME ${TEST_NAME} COMMAND $) endif(${MANUAL_TESTS_ENABLED}) endif(DEFINED MANUAL_TESTS_ENABLED) endmacro() From d23e77aef416187cc16b1613b043a78c37878436 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 14 Dec 2017 14:09:54 +0100 Subject: [PATCH 06/27] Do not export targets which are intended to be used within the cmake tree. This avoids warnings on CMP0024. --- GeneratePackage.cmake | 12 +++--------- config.cmake.in | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/GeneratePackage.cmake b/GeneratePackage.cmake index 1d70c06..373e0b3 100644 --- a/GeneratePackage.cmake +++ b/GeneratePackage.cmake @@ -10,9 +10,9 @@ set_target_properties(${TARGET_NAME} PROPERTIES PRIVATE_HEADER "${${TARGET_NAME}_PRIVATE_HEADERS}" ) -################################################################ -# Create and export config packages for usage within this tree # -################################################################ +##################################################### +# Create config packages for usage within this tree # +##################################################### # We configure our template. The template is described later. configure_package_config_file( @@ -22,12 +22,6 @@ configure_package_config_file( ) unset(TARGET_INCLUDE_INSTALL_DIRS) -# This file is included in our template: -export(TARGETS ${TARGET_NAME} - FILE "${CMAKE_BINARY_DIR}/local-exports/${CMAKE_CONFIG_FILE_BASE_NAME}Targets.cmake" - NAMESPACE ${PROJECT_NAMESPACE}:: -) - ############################################## # Create, export and install config packages # ############################################## diff --git a/config.cmake.in b/config.cmake.in index e27facd..06ed860 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -22,7 +22,6 @@ foreach(PACKAGE @DEPENDENT_PACKAGES@) check_required_components(${PACKAGE}) endforeach() -cmake_policy(SET CMP0024 OLD) include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_CONFIG_FILE_BASE_NAME@Targets.cmake") # @PROJECT_NAME@ requires C++11 From afec31dbf5248af4a22ec8bad141e91c0ab6d6cf Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 14 Dec 2017 14:53:59 +0100 Subject: [PATCH 07/27] Revert "Do not export targets which are intended to be used within the cmake tree." This reverts commit d23e77aef416187cc16b1613b043a78c37878436. --- GeneratePackage.cmake | 12 +++++++++--- config.cmake.in | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/GeneratePackage.cmake b/GeneratePackage.cmake index 373e0b3..1d70c06 100644 --- a/GeneratePackage.cmake +++ b/GeneratePackage.cmake @@ -10,9 +10,9 @@ set_target_properties(${TARGET_NAME} PROPERTIES PRIVATE_HEADER "${${TARGET_NAME}_PRIVATE_HEADERS}" ) -##################################################### -# Create config packages for usage within this tree # -##################################################### +################################################################ +# Create and export config packages for usage within this tree # +################################################################ # We configure our template. The template is described later. configure_package_config_file( @@ -22,6 +22,12 @@ configure_package_config_file( ) unset(TARGET_INCLUDE_INSTALL_DIRS) +# This file is included in our template: +export(TARGETS ${TARGET_NAME} + FILE "${CMAKE_BINARY_DIR}/local-exports/${CMAKE_CONFIG_FILE_BASE_NAME}Targets.cmake" + NAMESPACE ${PROJECT_NAMESPACE}:: +) + ############################################## # Create, export and install config packages # ############################################## diff --git a/config.cmake.in b/config.cmake.in index 06ed860..e27facd 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -22,6 +22,7 @@ foreach(PACKAGE @DEPENDENT_PACKAGES@) check_required_components(${PACKAGE}) endforeach() +cmake_policy(SET CMP0024 OLD) include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_CONFIG_FILE_BASE_NAME@Targets.cmake") # @PROJECT_NAME@ requires C++11 From 5495b5abc23c2ec5b18f6c58d4c3e1414aa68367 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 31 Jan 2018 11:26:58 +0100 Subject: [PATCH 08/27] Add sources to example path. --- Doxyfile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doxyfile.in b/Doxyfile.in index 2d9c6a1..c452bc8 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -67,3 +67,5 @@ SORT_MEMBER_DOCS = YES SORT_MEMBERS_CTORS_1ST = YES USE_MATHJAX = YES + +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@ From d935b916356aa4e338efb50e63ce4f2a90a30c1e Mon Sep 17 00:00:00 2001 From: frederik vannoote Date: Fri, 2 Feb 2018 14:31:19 +0100 Subject: [PATCH 09/27] Workaround for https://bugreports.qt.io/browse/QTBUG-54089 --- CompilerFlags.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/CompilerFlags.cmake b/CompilerFlags.cmake index cd07f59..758fe24 100644 --- a/CompilerFlags.cmake +++ b/CompilerFlags.cmake @@ -195,6 +195,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") "/wd4714" # suppress warning: marked __forceinline but are not inlined # Fixed in Qt 5.10.0 (https://bugreports.qt.io/browse/QTBUG-55042) # Check later with Qt >= 5.10.0 if warning suppression can be removed + "/wd4718" # Workaround for https://bugreports.qt.io/browse/QTBUG-54089 "/nologo" "/EHsc-" # disable exceptions "/GR-" # disable RTTI From a68a4c166ec4724a707a039daba63e42eb50575f Mon Sep 17 00:00:00 2001 From: frederik vannoote Date: Wed, 16 May 2018 14:57:41 +0200 Subject: [PATCH 10/27] Only rely on GIT has in release mode. --- AddResourceInfo.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AddResourceInfo.cmake b/AddResourceInfo.cmake index ac4a4ed..4c6643e 100644 --- a/AddResourceInfo.cmake +++ b/AddResourceInfo.cmake @@ -20,8 +20,12 @@ macro(add_resource_info PROJECT ISLIBRARY FILE_VER_MAJOR FILE_VER_MINOR FILE_VER #If we are creating an RC file for a library, make sure it is a DLL and not a static one. If it's an application, no need to do this check. set(IS_APPLICABLE_RESOURCE (NOT ${ISLIBRARY} OR (${BUILD_SHARED_LIBS} AND ${ISLIBRARY}))) if(WIN32 AND NOT UNIX AND ${IS_APPLICABLE_RESOURCE}) - # Finish creating the relevant data for the RC file. - get_git_head_revision(GIT_REFSPEC GIT_COMMIT_HASH) + + if(NOT CMAKE_BUILD_TYPE MATCHES Debug) + # Finish creating the relevant data for the RC file. + get_git_head_revision(GIT_REFSPEC GIT_COMMIT_HASH) + endif() + string(TIMESTAMP CURRENT_YEAR "%Y") if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(ARCHITECTURE_DESC "32-bit") From 04e070ab6d517a5a4e82a24c9ea8c80b14814943 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 5 Jul 2018 11:17:31 +0200 Subject: [PATCH 11/27] Generate Target.cmake files with relative paths to make them portable. --- GeneratePackage.cmake | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/GeneratePackage.cmake b/GeneratePackage.cmake index 1d70c06..a84ed3c 100644 --- a/GeneratePackage.cmake +++ b/GeneratePackage.cmake @@ -57,9 +57,10 @@ install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}Targets ) # Export the import targets -export(EXPORT ${TARGET_NAME}Targets - FILE "${CMAKE_BINARY_DIR}/${CMAKE_CONFIG_FILE_BASE_NAME}Targets.cmake" +install(EXPORT ${TARGET_NAME}Targets + FILE "${CMAKE_CONFIG_FILE_BASE_NAME}Targets.cmake" NAMESPACE ${PROJECT_NAMESPACE}:: + DESTINATION ${CMAKE_INSTALL_DIR} ) # Now install the 3 config files @@ -68,15 +69,6 @@ install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_CONFIG_FILE_BASE_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_DIR} ) -install(EXPORT ${TARGET_NAME}Targets - FILE - ${CMAKE_CONFIG_FILE_BASE_NAME}Targets.cmake - NAMESPACE - ${PROJECT_NAMESPACE}:: - DESTINATION - ${CMAKE_INSTALL_DIR} -) - # Create and install a global module include file # This makes it possible to include all header files of the module by using # #include <${PROJECT_NAME}> From 69633439035ef0df00bdf2f917e7a57dee6794ba Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 5 Jul 2018 12:56:08 +0200 Subject: [PATCH 12/27] Use relative paths when creating targets. --- GeneratePackage.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GeneratePackage.cmake b/GeneratePackage.cmake index 1d70c06..2c9adff 100644 --- a/GeneratePackage.cmake +++ b/GeneratePackage.cmake @@ -49,11 +49,11 @@ write_basic_package_version_file( # Create import targets install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}Targets - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR} - PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}/private + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR} + PRIVATE_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/private ) # Export the import targets From 1dc2e7ca518d82f583e89d2cd1a89feffccd11a4 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 14:51:42 +0200 Subject: [PATCH 13/27] Added first version of travis config --- .travis.yml | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6435d01 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,94 @@ +language: cpp +sudo: false +dist: trusty + +os: + - linux + - osx + +compiler: + - gcc + - clang + +env: + global: + - + + matrix: + - CMAKE_BUILD_TYPE=Debug + - CMAKE_BUILD_TYPE=Release + +matrix: + exclude: + - os: linux + compiler: clang + - os: osx + compiler: gcc + +addons: + apt: + packages: + - ninja-build + - qtbase5-dev + +before_install: + - | + # Install cmake + if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then + CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz" + cd /tmp + mkdir cmake + travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake + export PATH=/tmp/cmake/bin:${PATH} + else + if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi + fi + - | + # Install cmake and ninja + if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then + export QTDIR=/usr/lib/x86_64-linux-gnu/qt5 + export PATH="$QTDIR/bin:$PATH" + else + brew update > /dev/null + brew tap homebrew/versions + brew install ninja + brew install qt + export QTDIR="/usr/local/opt/qt5" + export PATH="$QTDIR/bin:$PATH" + fi + +install: +# Clone examples: they are the code to test against. + - git clone git@github.com:frederikvannoote/cmake-common-examples.git ${HOME}/examples + - export CMAKE_COMMON=${TRAVIS_BUILD_DIR} + - mkdir /tmp/installed + +script: + - mkdir /tmp/simplelib-build + - cd /tmp/simplelib-build + - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/simplelib + - cmake --build . --target all + - cmake --build . --target install + - cmake --build . --target sdk +# Relocate library + - cp -r /tmp/installed /tmp/relocated + + - mkdir /tmp/simpleapp-build + - cd /tmp/simpleapp-build + - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/simpleapp + - cmake --build . --target all + - cmake --build . --target install + + - mkdir /tmp/QSimpleApp-build + - cd /tmp/QSimpleApp-build + - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/QSimpleApp/ + - cmake --build . --target all + - cmake --build . --target install + + - mkdir /tmp/complexlib-build + - cd /tmp/complexlib-build + - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/complexlib + - cmake --build . --target all + - cmake --build . --target install + - cmake --build . --target sdk + From dd2251f2194cb83469c0adfc5fb9ec0e556d913a Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 15:07:48 +0200 Subject: [PATCH 14/27] Clone examples through HTTPS --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6435d01..a9406f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ before_install: install: # Clone examples: they are the code to test against. - - git clone git@github.com:frederikvannoote/cmake-common-examples.git ${HOME}/examples + - git clone https://github.com/frederikvannoote/cmake-common-examples.git ${HOME}/examples - export CMAKE_COMMON=${TRAVIS_BUILD_DIR} - mkdir /tmp/installed From 69c8e5809c29612cfd74a2e65b1f8c5a3b84beeb Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 15:35:14 +0200 Subject: [PATCH 15/27] Make travis file more readable. --- .travis.yml | 59 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index a9406f7..6feb084 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,32 +63,41 @@ install: - export CMAKE_COMMON=${TRAVIS_BUILD_DIR} - mkdir /tmp/installed -script: - - mkdir /tmp/simplelib-build - - cd /tmp/simplelib-build - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/simplelib - - cmake --build . --target all - - cmake --build . --target install - - cmake --build . --target sdk -# Relocate library - - cp -r /tmp/installed /tmp/relocated +script: + - | + # Build and install simplelib + mkdir /tmp/simplelib-build + cd /tmp/simplelib-build + cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/simplelib + cmake --build . --target all + cmake --build . --target install + cmake --build . --target sdk + - | + # Relocate library + cp -r /tmp/installed /tmp/relocated - - mkdir /tmp/simpleapp-build - - cd /tmp/simpleapp-build - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/simpleapp - - cmake --build . --target all - - cmake --build . --target install + - | + # Build and install Simpleapp + mkdir /tmp/simpleapp-build + cd /tmp/simpleapp-build + cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/simpleapp + cmake --build . --target all + cmake --build . --target install - - mkdir /tmp/QSimpleApp-build - - cd /tmp/QSimpleApp-build - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/QSimpleApp/ - - cmake --build . --target all - - cmake --build . --target install + - | + # Build and install QSimpleApp + mkdir /tmp/QSimpleApp-build + cd /tmp/QSimpleApp-build + cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -DCC1simplelib_DIR=/tmp/relocated/lib/cmake/CC1simplelib -G Ninja ${HOME}/examples/QSimpleApp/ + cmake --build . --target all + cmake --build . --target install - - mkdir /tmp/complexlib-build - - cd /tmp/complexlib-build - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/complexlib - - cmake --build . --target all - - cmake --build . --target install - - cmake --build . --target sdk + - | + # Build and install complex lib + mkdir /tmp/complexlib-build + cd /tmp/complexlib-build + cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${HOME}/examples/complexlib + cmake --build . --target all + cmake --build . --target install + cmake --build . --target sdk From 99745e2cf9332755589a1b64aec770255207e582 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 16:46:19 +0200 Subject: [PATCH 16/27] Initial version of appveyor config --- .appveyor.yml | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..00901a2 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,91 @@ +image: Visual Studio 2017 + +platform: + - x64 + +configuration: + - Debug + - Release + +environment: + QT_VERSION: 5.9 + QT_COMPILED: msvc2017 + matrix: + - SHARED: ON + - SHARED: OFF + +install: + ############################################################################ + # Install Ninja + ############################################################################ + - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip" + - appveyor DownloadFile %NINJA_URL% -FileName ninja.zip + - 7z x ninja.zip -oC:\projects\deps\ninja > nul + - set PATH=C:\projects\deps\ninja;%PATH% + - ninja --version + + ############################################################################ + # set correct QTDIR in the PATH environment variable + ############################################################################ + - set VS_FULL=%VS_VERSION% Win64 + - set QTDIR=C:/Qt/%QT_VERSION%/%QT_COMPILED%_64 + - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 + - set PATH=%PATH%;%QTDIR%/bin + +before_build: + - cd /D %APPVEYOR_BUILD_FOLDER% + - mkdir build + - cd build + - cmake -G "CodeBlocks - Ninja" -DCMAKE_BUILD_TYPE=%configuration% -DPRIVATE_TESTS_ENABLED=ON -DBUILD_SHARED_LIBS=%SHARED% .. + +build_script: + - cmake --build . --target all --config %configuration% + +test_script: + - cmake --build . --target test --config %configuration% + +build_script: +# Clone examples: they are the code to test against. + - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOME%/examples + - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% + - mkdir %TEMP%/installed + +test_script: + # Build and install simplelib + - mkdir %TEMP%/simplelib-build + - cd %TEMP%/simplelib-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOME%/examples/simplelib + - cmake --build . --config %configuration% --target all + - cmake --build . --config %configuration% --target install + - cmake --build . --config %configuration% --target sdk + + # Relocate library + - cp -r %TEMP%/installed /tmp/relocated + + # Build and install Simpleapp + - mkdir %TEMP%/simpleapp-build + - cd %TEMP%/simpleapp-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOME%/examples/simpleapp + - cmake --build . --config %configuration% --target all + - cmake --build . --config %configuration% --target install + + # Build and install QSimpleApp + - mkdir %TEMP%/QSimpleApp-build + - cd %TEMP%/QSimpleApp-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOME%/examples/QSimpleApp/ + - cmake --build . --config %configuration% --target all + - cmake --build . --config %configuration% --target install + + # Build and install complex lib + - mkdir %TEMP%/complexlib-build + - cd %TEMP%/complexlib-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOME%/examples/complexlib + - cmake --build . --config %configuration% --target all + - cmake --build . --config %configuration% --target install + - cmake --build . --config %configuration% --target sdk + +# uncomment following lines to be able to debug the appveyor image through RDP protocol when build finished +# https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + From 5180dbbb101fb49872e023c9624801e18e44583d Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 16:47:58 +0200 Subject: [PATCH 17/27] cleanup --- .appveyor.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 00901a2..49d81b5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -32,18 +32,6 @@ install: - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - set PATH=%PATH%;%QTDIR%/bin -before_build: - - cd /D %APPVEYOR_BUILD_FOLDER% - - mkdir build - - cd build - - cmake -G "CodeBlocks - Ninja" -DCMAKE_BUILD_TYPE=%configuration% -DPRIVATE_TESTS_ENABLED=ON -DBUILD_SHARED_LIBS=%SHARED% .. - -build_script: - - cmake --build . --target all --config %configuration% - -test_script: - - cmake --build . --target test --config %configuration% - build_script: # Clone examples: they are the code to test against. - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOME%/examples From 8d6d0cec619c9260ce4bbafe8836b187730cea47 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 16:50:16 +0200 Subject: [PATCH 18/27] enable RDP --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 49d81b5..716196c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -74,6 +74,6 @@ test_script: # uncomment following lines to be able to debug the appveyor image through RDP protocol when build finished # https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ -# on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +on_finish: + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From bc0eb7582ff90e5e9ae6da681313807fbf835286 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 16:57:54 +0200 Subject: [PATCH 19/27] Replace %HOME% with %HOMEPATH% --- .appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 716196c..c3f73c4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,7 +34,7 @@ install: build_script: # Clone examples: they are the code to test against. - - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOME%/examples + - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOMEPATH%/examples - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% - mkdir %TEMP%/installed @@ -42,7 +42,7 @@ test_script: # Build and install simplelib - mkdir %TEMP%/simplelib-build - cd %TEMP%/simplelib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOME%/examples/simplelib + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/simplelib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk @@ -53,21 +53,21 @@ test_script: # Build and install Simpleapp - mkdir %TEMP%/simpleapp-build - cd %TEMP%/simpleapp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOME%/examples/simpleapp + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/simpleapp - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install QSimpleApp - mkdir %TEMP%/QSimpleApp-build - cd %TEMP%/QSimpleApp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOME%/examples/QSimpleApp/ + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/QSimpleApp/ - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install complex lib - mkdir %TEMP%/complexlib-build - cd %TEMP%/complexlib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOME%/examples/complexlib + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/complexlib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk From cb64a4381edd1a093c910dccac2cca581709b1a0 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 17:10:53 +0200 Subject: [PATCH 20/27] use backslashes --- .appveyor.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index c3f73c4..10ce1f5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -36,37 +36,37 @@ build_script: # Clone examples: they are the code to test against. - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOMEPATH%/examples - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% - - mkdir %TEMP%/installed + - mkdir %TEMP%\installed test_script: # Build and install simplelib - - mkdir %TEMP%/simplelib-build - - cd %TEMP%/simplelib-build + - mkdir %TEMP%\simplelib-build + - cd %TEMP%\simplelib-build - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/simplelib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk # Relocate library - - cp -r %TEMP%/installed /tmp/relocated + - copy %TEMP%\installed %TEMP%\relocated # Build and install Simpleapp - - mkdir %TEMP%/simpleapp-build - - cd %TEMP%/simpleapp-build + - mkdir %TEMP%\simpleapp-build + - cd %TEMP%\simpleapp-build - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/simpleapp - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install QSimpleApp - - mkdir %TEMP%/QSimpleApp-build - - cd %TEMP%/QSimpleApp-build + - mkdir %TEMP%\QSimpleApp-build + - cd %TEMP%\QSimpleApp-build - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/QSimpleApp/ - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install complex lib - - mkdir %TEMP%/complexlib-build - - cd %TEMP%/complexlib-build + - mkdir %TEMP%\complexlib-build + - cd %TEMP%\complexlib-build - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/complexlib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install @@ -74,6 +74,6 @@ test_script: # uncomment following lines to be able to debug the appveyor image through RDP protocol when build finished # https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ -on_finish: - - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 1fef725e0ee504df53a7e51368d078e66ba26a93 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 17:14:41 +0200 Subject: [PATCH 21/27] USe xopy --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 10ce1f5..8cfa027 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -48,7 +48,7 @@ test_script: - cmake --build . --config %configuration% --target sdk # Relocate library - - copy %TEMP%\installed %TEMP%\relocated + - xcopy /E %TEMP%\installed %TEMP%\relocated # Build and install Simpleapp - mkdir %TEMP%\simpleapp-build From d717965f7529c0fc2826376341987089a38e6b13 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 17:26:27 +0200 Subject: [PATCH 22/27] omit xcopy prompt --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 8cfa027..4bca79d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -48,7 +48,7 @@ test_script: - cmake --build . --config %configuration% --target sdk # Relocate library - - xcopy /E %TEMP%\installed %TEMP%\relocated + - xcopy /E %TEMP%\installed %TEMP%\relocated\ # Build and install Simpleapp - mkdir %TEMP%\simpleapp-build From ba410f209b2d95e2ccd28f4e2002f45c02a8453e Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 17:31:02 +0200 Subject: [PATCH 23/27] Omit escape character --- .appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4bca79d..bef2556 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -48,19 +48,19 @@ test_script: - cmake --build . --config %configuration% --target sdk # Relocate library - - xcopy /E %TEMP%\installed %TEMP%\relocated\ + - xcopy /E %TEMP%\installed C:\relocated\ # Build and install Simpleapp - mkdir %TEMP%\simpleapp-build - cd %TEMP%\simpleapp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/simpleapp + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/simpleapp - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install QSimpleApp - mkdir %TEMP%\QSimpleApp-build - cd %TEMP%\QSimpleApp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=%TEMP%/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/QSimpleApp/ + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/QSimpleApp/ - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install From b415f0213a2781adcd8595bd2af8ba6b6e5074fd Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Wed, 18 Jul 2018 17:36:10 +0200 Subject: [PATCH 24/27] Omit escape character 2 --- .appveyor.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bef2556..06ca317 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,40 +34,40 @@ install: build_script: # Clone examples: they are the code to test against. - - git clone https://github.com/frederikvannoote/cmake-common-examples.git %HOMEPATH%/examples + - git clone https://github.com/frederikvannoote/cmake-common-examples.git %APPVEYOR_BUILD_FOLDER%/examples - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% - - mkdir %TEMP%\installed + - mkdir C:\installed test_script: # Build and install simplelib - mkdir %TEMP%\simplelib-build - cd %TEMP%\simplelib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/simplelib + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/simplelib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk # Relocate library - - xcopy /E %TEMP%\installed C:\relocated\ + - xcopy /E C:\installed C:\relocated\ # Build and install Simpleapp - mkdir %TEMP%\simpleapp-build - cd %TEMP%\simpleapp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/simpleapp + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/simpleapp - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install QSimpleApp - mkdir %TEMP%\QSimpleApp-build - cd %TEMP%\QSimpleApp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %HOMEPATH%/examples/QSimpleApp/ + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/QSimpleApp/ - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install # Build and install complex lib - mkdir %TEMP%\complexlib-build - cd %TEMP%\complexlib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=%TEMP%/installed -G Ninja %HOMEPATH%/examples/complexlib + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/complexlib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk From f07ace8df1b98d361cc8dd87dd6ea61226a6b039 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 19 Jul 2018 09:06:36 +0200 Subject: [PATCH 25/27] Use relative paths --- .appveyor.yml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 06ca317..4381b91 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,43 +34,47 @@ install: build_script: # Clone examples: they are the code to test against. - - git clone https://github.com/frederikvannoote/cmake-common-examples.git %APPVEYOR_BUILD_FOLDER%/examples + - git clone https://github.com/frederikvannoote/cmake-common-examples.git examples - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% - - mkdir C:\installed + - mkdir installed test_script: # Build and install simplelib - - mkdir %TEMP%\simplelib-build - - cd %TEMP%\simplelib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/simplelib + - mkdir simplelib-build + - cd simplelib-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=../installed -G Ninja ../examples/simplelib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk + - cd .. # Relocate library - - xcopy /E C:\installed C:\relocated\ + - xcopy /E installed relocated\ # Build and install Simpleapp - - mkdir %TEMP%\simpleapp-build - - cd %TEMP%\simpleapp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/simpleapp + - mkdir simpleapp-build + - cd simpleapp-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=../installed -DCC1simplelib_DIR=../relocated/lib/cmake/CC1simplelib -G Ninja ../examples/simpleapp - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install + - cd .. # Build and install QSimpleApp - - mkdir %TEMP%\QSimpleApp-build - - cd %TEMP%\QSimpleApp-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -DCC1simplelib_DIR=C:/relocated/lib/cmake/CC1simplelib -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/QSimpleApp/ + - mkdir QSimpleApp-build + - cd QSimpleApp-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=../installed -DCC1simplelib_DIR=../relocated/lib/cmake/CC1simplelib -G Ninja ../examples/QSimpleApp/ - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install + - cd .. # Build and install complex lib - - mkdir %TEMP%\complexlib-build - - cd %TEMP%\complexlib-build - - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/installed -G Ninja %APPVEYOR_BUILD_FOLDER%/examples/complexlib + - mkdir complexlib-build + - cd complexlib-build + - cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=../installed -G Ninja ../examples/complexlib - cmake --build . --config %configuration% --target all - cmake --build . --config %configuration% --target install - cmake --build . --config %configuration% --target sdk + - cd .. # uncomment following lines to be able to debug the appveyor image through RDP protocol when build finished # https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ From ee17598c9ad44723b695107d452827df8d211cab Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 19 Jul 2018 09:34:48 +0200 Subject: [PATCH 26/27] Use forward slashes --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4381b91..5a6467e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -35,7 +35,7 @@ install: build_script: # Clone examples: they are the code to test against. - git clone https://github.com/frederikvannoote/cmake-common-examples.git examples - - set CMAKE_COMMON=%APPVEYOR_BUILD_FOLDER% + - set CMAKE_COMMON=C:/projects/cmake-common - mkdir installed test_script: From 71ec42342f799f239c6ed54eab8d82799cfe69e4 Mon Sep 17 00:00:00 2001 From: Frederik Vannoote Date: Thu, 9 Aug 2018 08:11:52 +0200 Subject: [PATCH 27/27] Add doc on how to fetch buildsys during CMake run. --- readme.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/readme.md b/readme.md index 2a2b0a6..7340f41 100644 --- a/readme.md +++ b/readme.md @@ -12,6 +12,19 @@ You can fetch the files during your git clone using a submodule. git submodule add -b git@github.com:barco-healthcare/cmake-common.git path/to/cmake/common ``` +## Cloning during cmake run +Add this snippet to your CMakeLists.txt +``` +# Download build system +if(NOT EXISTS "${CMAKE_BINARY_DIR}/buildsys/v2.0") + message(STATUS "Downloading buildsystem...") + + find_package(Git REQUIRED) + execute_process(COMMAND ${GIT_EXECUTABLE} clone --branch v2.0 https://github.com/frederikvannoote/cmake-common.git ${CMAKE_BINARY_DIR}/buildsys/v2.0) +endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/buildsys/v2.0") +``` + # Usage You can include these files in your CMakeLists.txt