Skip to content

Commit

Permalink
CI: disable ODBC for Mac for test_cmake.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 31, 2024
1 parent 7a915be commit 628a539
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ jobs:
./autotest/postinstall/test_gdal-config.sh $GITHUB_WORKSPACE/install-gdal
- name: Test post-install usage (with CMake)
run: |
./autotest/postinstall/test_cmake.sh $GITHUB_WORKSPACE/install-gdal
./autotest/postinstall/test_cmake.sh $GITHUB_WORKSPACE/install-gdal --dynamic --disable-odbc
- name: ccache statistics
run: ccache -s

Expand Down
10 changes: 8 additions & 2 deletions autotest/postinstall/test_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# is used to set PKG_CONFIG_PATH and LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
#
# Second, optional argument can be '--static', to skip the ldd check.
# Third, optional argument can be '--disable-odbc', to avoid linking with ODBC

echo "Running post-install tests with CMake"

Expand All @@ -15,6 +16,11 @@ if [ -z "$prefix" ]; then
exit 1
fi

CMAKE_EXTRA_ARGS=""
if test "$3" = "--disable-odbc"; then
CMAKE_EXTRA_ARGS="-DUSE_ODBC=OFF"
fi

export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
export VERBOSE=1

Expand Down Expand Up @@ -70,7 +76,7 @@ cd $(dirname $0)
echo Testing C app
mkdir -p test_c/build
cd test_c/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DGDAL_DIR=$prefix/lib/cmake/gdal
cmake .. -DCMAKE_BUILD_TYPE=Release -DGDAL_DIR=$prefix/lib/cmake/gdal ${CMAKE_EXTRA_ARGS}
cmake --build .

if test "$2" != "--static"; then
Expand All @@ -84,7 +90,7 @@ rm -Rf test_c/build
echo Testing C++ app
mkdir -p test_cpp/build
cd test_cpp/build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DGDAL_DIR=$prefix/lib/cmake/gdal
cmake .. -DCMAKE_BUILD_TYPE=Debug -DGDAL_DIR=$prefix/lib/cmake/gdal ${CMAKE_EXTRA_ARGS}
cmake --build .

if test "$2" != "--static"; then
Expand Down
13 changes: 8 additions & 5 deletions autotest/postinstall/test_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ add_executable(test_cpp test_cpp.cpp)
set_property(TARGET test_cpp PROPERTY CXX_STANDARD 11)
target_link_libraries(test_cpp PRIVATE GDAL::GDAL)

# This test needs `sql.h` from ODBC. ODBC will not become a general dependency of GDAL::GDAL.
find_package(ODBC)
if (ODBC_FOUND)
target_compile_definitions(test_cpp PRIVATE USE_ODBC)
target_link_libraries(test_cpp PRIVATE ODBC::ODBC)
option(USE_ODBC "Whether to detect ODBC" ON)
if( USE_ODBC )
# This test needs `sql.h` from ODBC. ODBC will not become a general dependency of GDAL::GDAL.
find_package(ODBC)
if (ODBC_FOUND)
target_compile_definitions(test_cpp PRIVATE USE_ODBC)
target_link_libraries(test_cpp PRIVATE ODBC::ODBC)
endif ()
endif ()

0 comments on commit 628a539

Please sign in to comment.