Skip to content

Commit

Permalink
Increase CMake minimum version from 3.9 to 3.16 (#3997)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews authored Jan 14, 2024
1 parent a50673d commit 95db9aa
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 147 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/linux_gcc_5_4.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/linux_gcc_5_4/start.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/mingw_w64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
restore-keys: ${{ runner.os }}-cache-mingw_w64-

- name: Build
run: docker run -e CI -e TRAVIS_OS_NAME=linux -e BUILD_NAME=mingw_w64 -e WORK_DIR="$PWD" -v $PWD:$PWD ubuntu:18.04 $PWD/.github/workflows/mingw_w64/start.sh
run: docker run -e CI -e TRAVIS_OS_NAME=linux -e BUILD_NAME=mingw_w64 -e WORK_DIR="$PWD" -v $PWD:$PWD ubuntu:22.04 $PWD/.github/workflows/mingw_w64/start.sh
5 changes: 3 additions & 2 deletions .github/workflows/mingw_w64/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ccache -M 500M
ccache -s

MINGW_ARCH=x86_64-w64-mingw32
MINGW_PREFIX=/usr/lib/gcc/$MINGW_ARCH/7.3-posix
MINGW_PREFIX=/usr/lib/gcc/$MINGW_ARCH/10-posix

export CC="$MINGW_ARCH-gcc"
export CXX="$MINGW_ARCH-g++"
Expand All @@ -64,7 +64,7 @@ WINE_SYSDIR=$WINE_PREFIX/drive_c/windows
wine64 cmd /c dir
ln -s $MINGW_PREFIX/libstdc++-6.dll $WINE_SYSDIR
ln -s $MINGW_PREFIX/libgcc_s_seh-1.dll $WINE_SYSDIR
ln -s $MINGW_PREFIX/libgcc_s_sjlj-1.dll $WINE_SYSDIR
# ln -s $MINGW_PREFIX/libgcc_s_sjlj-1.dll $WINE_SYSDIR
ln -s /usr/$MINGW_ARCH/lib/libwinpthread-1.dll $WINE_SYSDIR

# build zlib
Expand Down Expand Up @@ -93,6 +93,7 @@ CFLAGS="-DSQLITE_DQS=0" ./configure --host=$MINGW_ARCH --prefix=/usr/$MINGW_ARCH
ln -s /usr/$MINGW_ARCH/bin/libsqlite3-0.dll $WINE_SYSDIR

# build proj
rm -rf build
mkdir build
cd build
cmake -G "Unix Makefiles" \
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ matrix:
include:

- os: linux
dist: bionic
dist: jammy
compiler: gcc
arch: s390x
env:
- BUILD_NAME=linux_generic
- DETAILS="linux, s390x"

- os: linux
dist: bionic
dist: jammy
compiler: gcc
arch: arm64
env:
Expand Down
12 changes: 1 addition & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
################################################################################
# General settings
################################################################################
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16)

project(PROJ
DESCRIPTION "PROJ coordinate transformation software library"
Expand Down Expand Up @@ -219,16 +219,6 @@ if(ENABLE_CURL)
if(CURL_FOUND)
set(CURL_ENABLED TRUE)

# Target CURL::libcurl only defined since CMake 3.12
# TODO: remove this when CMake >= 3.12 required
if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl INTERFACE IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}"
)
endif()

# Curl SSL options are described in
# https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html
#set(CURLSSLOPT_NO_REVOKE 2)
Expand Down
2 changes: 0 additions & 2 deletions cmake/Ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
# Add "include(Ccache)" to CMakeLists.txt and enable
# using the option -D USE_CCACHE=ON

cmake_minimum_required(VERSION 3.9)


option(USE_CCACHE
"Use ccache (or clcache for MSVC) to compile C/C++ objects" OFF)
Expand Down
7 changes: 4 additions & 3 deletions cmake/ProjUtilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ function(configure_proj_pc)
if(HAVE_LIBDL)
list(APPEND EXTRA_LIBS -ldl)
endif()
# Join list with a space; list(JOIN) added CMake 3.12
string(REPLACE ";" " " EXTRA_LIBS "${EXTRA_LIBS}")
string(REPLACE ";" " " EXTRA_REQUIRES "${EXTRA_REQUIRES}")

# Join lists with a space
list(JOIN EXTRA_LIBS " " EXTRA_LIBS)
list(JOIN EXTRA_REQUIRES " " EXTRA_REQUIRES)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/proj.pc.in
Expand Down
10 changes: 6 additions & 4 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Build requirements

- C99 compiler
- C++11 compiler
- CMake >= 3.9
- CMake >= 3.16
- SQLite3 >= 3.11: headers and library for target architecture, and sqlite3 executable for build architecture.
- libtiff >= 4.0 (optional but recommended)
- curl >= 7.29.0 (optional but recommended)
Expand Down Expand Up @@ -263,7 +263,7 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory.

Build PROJ library shared. Default is ON. See also the CMake
documentation for `BUILD_SHARED_LIBS
<https://cmake.org/cmake/help/v3.9/variable/BUILD_SHARED_LIBS.html>`_.
<https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html>`_.

.. versionchanged:: 7.0
Renamed from ``BUILD_LIBPROJ_SHARED``
Expand All @@ -283,7 +283,7 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory.
Choose the type of build, options are: None (default), Debug, Release,
RelWithDebInfo, or MinSizeRel. See also the CMake documentation for
`CMAKE_BUILD_TYPE
<https://cmake.org/cmake/help/v3.9/variable/CMAKE_BUILD_TYPE.html>`_.
<https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`_.

.. note::
A default build is not optimized without specifying
Expand Down Expand Up @@ -320,7 +320,9 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory.
.. versionadded:: 9.4

Default is OFF. This can be set to ON to build PROJ using the
https://cmake.org/cmake/help/latest/variable/CMAKE_UNITY_BUILD.html feature.
`CMAKE_UNITY_BUILD
<https://cmake.org/cmake/help/latest/variable/CMAKE_UNITY_BUILD.html>`_.
feature.
This helps speeding PROJ build times. This feature is still considered
experimental for now, and could hide subtle bugs (we are not aware of
any at writing time though). We don't recommend it for mission critical
Expand Down
47 changes: 18 additions & 29 deletions src/lib_proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,22 @@ set(SRC_LIBPROJ_CORE
${CMAKE_CURRENT_BINARY_DIR}/proj_config.h
)

if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
set_property(SOURCE list.cpp # because if sets DO_NOT_DEFINE_PROJ_HEAD
transformations/defmodel.cpp # Evaluator class conflict
transformations/tinshift.cpp # Evaluator class conflict
wkt1_parser.cpp
wkt2_parser.cpp
wkt1_generated_parser.c
wkt2_generated_parser.c
PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
if(WIN32)
set_property(SOURCE networkfilemanager.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif()
endif ()
# Skip Unity build for specific files
set(SKIP_UNITY_BUILD_FILES
list.cpp # because if sets DO_NOT_DEFINE_PROJ_HEAD
transformations/defmodel.cpp # Evaluator class conflict
transformations/tinshift.cpp # Evaluator class conflict
wkt1_parser.cpp
wkt2_parser.cpp
wkt1_generated_parser.c
wkt2_generated_parser.c
)
if(WIN32)
list(APPEND SKIP_UNITY_BUILD_FILES
networkfilemanager.cpp
)
endif()
set_property(SOURCE ${SKIP_UNITY_BUILD_FILES} PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)

set(HEADERS_LIBPROJ
proj.h
Expand Down Expand Up @@ -470,26 +473,12 @@ endif()

if(TIFF_ENABLED)
target_compile_definitions(proj PRIVATE -DTIFF_ENABLED)
if( CMAKE_VERSION VERSION_LESS 3.11 AND CMAKE_CROSSCOMPILING )
# Hack needed for ubuntu:18.04 mingw64 cross compiling to avoid
# -isystem to be emitted (similar to https://discourse.cmake.org/t/use-of-isystem/1574)
target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIRS})
target_link_libraries(proj PRIVATE ${TIFF_LIBRARIES})
else()
target_link_libraries(proj PRIVATE TIFF::TIFF)
endif()
target_link_libraries(proj PRIVATE TIFF::TIFF)
endif()

if(CURL_ENABLED)
target_compile_definitions(proj PRIVATE -DCURL_ENABLED)
if( CMAKE_VERSION VERSION_LESS 3.11 AND CMAKE_CROSSCOMPILING )
# Hack needed for ubuntu:18.04 mingw64 cross compiling to avoid
# -isystem to be emitted (similar to https://discourse.cmake.org/t/use-of-isystem/1574)
target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIRS})
target_link_libraries(proj PRIVATE ${CURL_LIBRARIES})
else()
target_link_libraries(proj PRIVATE CURL::libcurl)
endif()
target_link_libraries(proj PRIVATE CURL::libcurl)
target_link_libraries(proj
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:ws2_32>
Expand Down
13 changes: 2 additions & 11 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ set(PROJ_TEST_CPP_API_SOURCES
test_c_api.cpp
test_grids.cpp)
add_executable(proj_test_cpp_api ${PROJ_TEST_CPP_API_SOURCES})
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
set_property(SOURCE ${PROJ_TEST_CPP_API_SOURCES} PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif ()
set_property(SOURCE ${PROJ_TEST_CPP_API_SOURCES} PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)

target_link_libraries(proj_test_cpp_api
PRIVATE GTest::gtest
Expand Down Expand Up @@ -182,14 +180,7 @@ add_executable(test_network
test_network.cpp)
if(CURL_ENABLED)
target_compile_definitions(test_network PRIVATE -DCURL_ENABLED)
if( CMAKE_VERSION VERSION_LESS 3.11 AND CMAKE_CROSSCOMPILING )
# Hack needed for ubuntu:18.04 mingw64 cross compiling to avoid
# -isystem to be emitted (similar to https://discourse.cmake.org/t/use-of-isystem/1574)
target_include_directories(test_network PRIVATE ${CURL_INCLUDE_DIRS})
target_link_libraries(test_network PRIVATE ${CURL_LIBRARIES})
else()
target_link_libraries(test_network PRIVATE CURL::libcurl)
endif()
target_link_libraries(test_network PRIVATE CURL::libcurl)
endif()
target_link_libraries(test_network
PRIVATE GTest::gtest
Expand Down
2 changes: 1 addition & 1 deletion travis/linux_generic/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ set -e
sudo apt-get install -qq \
sqlite3 zip \
libsqlite3-dev \
libtiff-dev \
libtiff-dev libwebp-dev \
libcurl4-openssl-dev libnghttp2-dev libidn2-dev librtmp-dev libssh-dev \
libpsl-dev libssl-dev libkrb5-dev comerr-dev libldap2-dev libbrotli-dev

0 comments on commit 95db9aa

Please sign in to comment.