Skip to content

Commit

Permalink
Use standard BUILD_TESTING CMake variable and deprecate WITH_TESTS
Browse files Browse the repository at this point in the history
* streamline CI configuration

* set find_package to CONFIG for PDAL

* use standard BUILD_TESTING cmake config variable and deprecate WITH_TESTS

* BUILD_TESTING now as is standard in CMake instead of WITH_TESTS, which is not

* remove extraneous include
  • Loading branch information
hobu authored Jun 3, 2024
1 parent e870d64 commit cba9355
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 207 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/linux.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/osx.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
name: OS ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
shared: [ON, OFF]

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Support longpaths
run: git config --system core.longpaths true
if: matrix.os == 'windows-latest'
- uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
environment-file: ci/environment.yml
environment-name: "build"
cache-environment: true
cache-downloads: true

- name: Setup
shell: bash -l {0}
run: |
mkdir build
- name: CMake
shell: bash -l {0}

run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export CC=cl.exe
export CXX=cl.exe
fi
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
-DBUILD_TESTING=ON \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-Dgtest_force_shared_crt=ON \
..
working-directory: ./build

- name: Compile
shell: bash -l {0}
run: |
ninja
working-directory: ./build

- name: Test
shell: bash -l {0}
run: |
ctest -VV --rerun-failed --output-on-failure
working-directory: ./build

47 changes: 0 additions & 47 deletions .github/workflows/win.yml

This file was deleted.

18 changes: 8 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ project(Untwine VERSION 1.3.2 LANGUAGES CXX)
include(FeatureSummary)
include(${PROJECT_SOURCE_DIR}/cmake/compiler_options.cmake)

option(WITH_TESTS
"Choose if Untwine unit tests should be built" TRUE)
add_feature_info("Unit tests" WITH_TESTS "Untwine unit tests")
option(BUILD_TESTING "Chose if Untwine unit tests should be built" OFF)
add_feature_info("Unit tests" BUILD_TESTING "Untwine unit tests")


find_package(PDAL REQUIRED)
if ((PDAL_VERSION_MAJOR EQUAL 1) AND (PDAL_VERSION_MINOR LESS 7))
message(FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 1.7 or higher.")
if(DEFINED WITH_TESTS)
message(DEPRECATION "WITH_TESTS has been replaced with the standard CMake BUILD_TESTING variable")
set(BUILD_TESTING ${WITH_TESTS})
endif()

find_package(PDAL REQUIRED CONFIG 2.6)

find_package(Threads)
set_package_properties(Threads PROPERTIES DESCRIPTION
"The thread library of the system" TYPE REQUIRED)
Expand Down Expand Up @@ -58,9 +58,7 @@ endif()

install(TARGETS untwine DESTINATION bin)

#-----------------

if (WITH_TESTS)
if (BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
Expand Down
8 changes: 0 additions & 8 deletions ci/linux/cmake.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ci/linux/compile.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ci/linux/setup.sh

This file was deleted.

3 changes: 0 additions & 3 deletions ci/linux/test.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci/osx/cmake.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ci/osx/compile.sh

This file was deleted.

2 changes: 0 additions & 2 deletions ci/osx/setup.sh

This file was deleted.

3 changes: 0 additions & 3 deletions ci/osx/test.sh

This file was deleted.

14 changes: 0 additions & 14 deletions ci/win/cmake.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ci/win/compile.sh

This file was deleted.

1 change: 0 additions & 1 deletion ci/win/setup.sh

This file was deleted.

3 changes: 0 additions & 3 deletions ci/win/test.sh

This file was deleted.

0 comments on commit cba9355

Please sign in to comment.