diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6278d1aba7..9ec28213c6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -29,18 +29,31 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - + + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: '3.16.3' + + - name: Print CMake version + run: cmake --version + - name: configure - run: cmake --preset ci-release-checks -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ . + run: > + cmake + -B build + -D CMAKE_BUILD_TYPE=Release + -D MRTRIX_STL_DEBUGGING=ON + -D MRTRIX_WARNING_AS_ERRORS=ON - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks + run: cmake --build build - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R unit --test-dir build - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R bin --test-dir build linux-gcc-build: @@ -63,18 +76,31 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - + + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: '3.16.3' + + - name: Print CMake version + run: cmake --version + - name: configure - run: cmake --preset ci-release-checks + run: > + cmake + -B build + -D CMAKE_BUILD_TYPE=Release + -D MRTRIX_STL_DEBUGGING=ON + -D MRTRIX_WARNING_AS_ERRORS=ON - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks + run: cmake --build build - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R unit --test-dir build - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R bin --test-dir build macos-build: @@ -99,19 +125,34 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: '3.16.3' + + - name: Print CMake version + run: cmake --version + - name: configure - run: | - export PATH=/usr/local/opt/qt5/bin:$PATH - cmake --preset ci-release-checks + run: > + export PATH=/usr/local/opt/qt5/bin:$PATH; + cmake + -B build + -D CMAKE_BUILD_TYPE=Release + -D MRTRIX_STL_DEBUGGING=ON + -D MRTRIX_WARNING_AS_ERRORS=ON - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks + run: cmake --build build - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R unit --test-dir build - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R bin --test-dir build windows-build: @@ -160,18 +201,24 @@ jobs: run: | export SCCACHE_UNIX_PATH=$(cygpath -u "$SCCACHE_PATH") echo "SCCACHE_UNIX_PATH=$SCCACHE_UNIX_PATH" >> $GITHUB_ENV - + - name: configure - run: cmake --preset ci-release-checks -DCMAKE_CXX_COMPILER_LAUNCHER=${{env.SCCACHE_UNIX_PATH}} . + run: > + cmake + -B build + -D CMAKE_BUILD_TYPE=Release + -D MRTRIX_STL_DEBUGGING=ON + -D MRTRIX_WARNING_AS_ERRORS=ON + -D CMAKE_CXX_COMPILER_LAUNCHER=${{env.SCCACHE_UNIX_PATH}} . - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks + run: cmake --build build - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R unit --test-dir build - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks + run: ctest -R bin --test-dir build secondary-checks: runs-on: ubuntu-latest @@ -199,4 +246,4 @@ jobs: run: ./update_copyright && git diff --exit-code - name: check building of documentation - run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/ \ No newline at end of file + run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 374b1eb214..5fc68ac78f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.21 FATAL_ERROR) +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(mrtrix3 VERSION 3.0.4) include(GNUInstallDirs) @@ -14,7 +14,6 @@ option(MRTRIX_STL_DEBUGGING "Enable STL debug mode" OFF) option(MRTRIX_BUILD_TESTS "Build tests executables" OFF) if(MRTRIX_BUILD_TESTS) - list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure") enable_testing() endif() @@ -28,6 +27,14 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +if(CMAKE_VERSION VERSION_LESS 3.21) + get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY) + if(NOT not_top) + set(PROJECT_IS_TOP_LEVEL true) + endif() +endif() + if(APPLE) set(base @loader_path) else()