diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 4a21c6e5..4f60aa3e 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -8,22 +8,22 @@ set(LOCAL_INSTALL_DIR ${CMAKE_BINARY_DIR}/local) set_directory_properties(PROPERTIES EP_BASE ${CMAKE_BINARY_DIR}/projects) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0") - cmake_policy(SET CMP0135 NEW) + cmake_policy(SET CMP0135 NEW) endif() if(NOT EMSCRIPTEN) - if(OSX_BUILD_ARCH) - message(STATUS "building for OSX architecture: ${OSX_BUILD_ARCH}") + if(OSX_BUILD_ARCH) + message(STATUS "building for OSX architecture: ${OSX_BUILD_ARCH}") - if(NOT APPLE) - error("This only makes sense on OSX") - endif() + if(NOT APPLE) + error("This only makes sense on OSX") + endif() - set(CMAKE_OSX_ARCHITECTURES ${OSX_BUILD_ARCH}) + set(CMAKE_OSX_ARCHITECTURES ${OSX_BUILD_ARCH}) - # Escape semicolons in CMAKE_OSX_ARCHITECTURES before passing to ExternalProject_Add - string(REPLACE ";" "$" CMAKE_OSX_ARCHITECTURES_PACKED "${CMAKE_OSX_ARCHITECTURES}") - endif() + # Escape semicolons in CMAKE_OSX_ARCHITECTURES before passing to ExternalProject_Add + string(REPLACE ";" "$" CMAKE_OSX_ARCHITECTURES_PACKED "${CMAKE_OSX_ARCHITECTURES}") + endif() endif() set(CMAKE_FLAGS_POINTER_SIZE) @@ -33,55 +33,85 @@ set(CMAKE_GDAL_FLAGS) set(PATCH_NAME_ENDING) if(EMSCRIPTEN) - set(CMAKE_FLAGS_POINTER_SIZE -DCMAKE_SIZEOF_VOID_P=4 -DCMAKE_SIZEOF_VOIDP=4) - set(CMAKE_PROJ_FLAGS -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake -DSQLITE3_INCLUDE_DIR=${LOCAL_INSTALL_DIR}/include -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) - set(CMAKE_GDAL_FLAGS -DACCEPT_MISSING_LINUX_FS_HEADER=ON -DSIZEOF_INT=4 -DSIZEOF_UNSIGNED_LONG=4 -DSIZEOF_OFF_T=4 -DGEOS_DIR=${LOCAL_INSTALL_DIR}/lib/cmake/geos -DGeographicLib_DIR=${LOCAL_INSTALL_DIR}/lib/cmake/GeographicLib -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) - set(PATCH_NAME_ENDING _wasm) - set(OGR_ENABLE_DRIVER_OPENFILEGDB OFF) + set(CMAKE_FLAGS_POINTER_SIZE -DCMAKE_SIZEOF_VOID_P=4 -DCMAKE_SIZEOF_VOIDP=4) + set(CMAKE_PROJ_FLAGS -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake -DSQLITE3_INCLUDE_DIR=${LOCAL_INSTALL_DIR}/include -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) + set(CMAKE_GDAL_FLAGS -DACCEPT_MISSING_LINUX_FS_HEADER=ON -DSIZEOF_INT=4 -DSIZEOF_UNSIGNED_LONG=4 -DSIZEOF_OFF_T=4 -DGEOS_DIR=${LOCAL_INSTALL_DIR}/lib/cmake/geos -DGeographicLib_DIR=${LOCAL_INSTALL_DIR}/lib/cmake/GeographicLib -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) + set(PATCH_NAME_ENDING _wasm) + set(OGR_ENABLE_DRIVER_OPENFILEGDB OFF) endif() if(ANDROID) - set(CMAKE_PROJ_FLAGS -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake -DSQLITE3_INCLUDE_DIR=${LOCAL_INSTALL_DIR}/include -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) + set(CMAKE_PROJ_FLAGS -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake -DSQLITE3_INCLUDE_DIR=${LOCAL_INSTALL_DIR}/include -DSQLITE3_LIBRARY=${LOCAL_INSTALL_DIR}/lib/libsqlite3.a) endif() # ZLIB if(ANDROID) - # Explicitly set the zlib library path - if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - set(NDK_HOST_TAG "linux") - elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - set(NDK_HOST_TAG "darwin") - elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - set(NDK_HOST_TAG "windows") - else() - message(FATAL_ERROR "Unsupported host system: ${CMAKE_HOST_SYSTEM_NAME}") - endif() - - # Determine processor architecture - if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") - set(NDK_HOST_ARCH "x86_64") - else() - message(FATAL_ERROR "Unsupported host architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") - endif() - - set(ZLIB_LIBRARY ${ANDROID_NDK}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}-${NDK_HOST_ARCH}/sysroot/usr/lib/${CMAKE_ANDROID_ARCH_ABI}/libz.a) - set(ZLIB_INCLUDE_DIR ${ANDROID_NDK}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}-${NDK_HOST_ARCH}/sysroot/usr/include) - - # Find the library - find_library(ZLIB_LIBRARIES z PATHS ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android NO_DEFAULT_PATH) + # Explicitly set the zlib library path + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(NDK_HOST_TAG "linux") + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(NDK_HOST_TAG "darwin") + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(NDK_HOST_TAG "windows") + else() + message(FATAL_ERROR "Unsupported host system: ${CMAKE_HOST_SYSTEM_NAME}") + endif() + + # Determine processor architecture + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(NDK_HOST_ARCH "x86_64") + else() + message(FATAL_ERROR "Unsupported host architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") + endif() + + set(ZLIB_LIBRARY ${ANDROID_NDK}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}-${NDK_HOST_ARCH}/sysroot/usr/lib/${CMAKE_ANDROID_ARCH_ABI}/libz.a) + set(ZLIB_INCLUDE_DIR ${ANDROID_NDK}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}-${NDK_HOST_ARCH}/sysroot/usr/include) + + # Find the library + find_library(ZLIB_LIBRARIES z PATHS ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android NO_DEFAULT_PATH) else() - ExternalProject_Add( - ZLIB - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib1213.zip + ExternalProject_Add( + ZLIB + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib1213.zip + CONFIGURE_HANDLED_BY_BUILD TRUE + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_SHARED_LIBS=OFF + ${CMAKE_FLAGS_POINTER_SIZE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + ) +endif() + +# Use the system sqlite binary on Emscripten, iOS and Android +if(EMSCRIPTEN OR IOS OR ANDROID) + find_program(EXE_SQLITE3 sqlite3) +endif() + +if(NOT ANDROID) + set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} ZLIB) +endif() + +# SQLite3 +ExternalProject_Add( + SQLITE3 + $<$>:DEPENDS ZLIB> + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite3 CONFIGURE_HANDLED_BY_BUILD TRUE CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DBUILD_SHARED_LIBS=OFF ${CMAKE_FLAGS_POINTER_SIZE} # vcpkg options @@ -89,316 +119,287 @@ else() -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - ) -endif() - -# Use the system sqlite binary on Emscripten, iOS and Android -if(EMSCRIPTEN OR IOS OR ANDROID) - find_program(EXE_SQLITE3 sqlite3) -endif() - -if(NOT ANDROID) - set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} ZLIB) -endif() - -# SQLite3 -ExternalProject_Add( - SQLITE3 - $<$>:DEPENDS ZLIB> - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite3 - CONFIGURE_HANDLED_BY_BUILD TRUE - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' ) set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} SQLITE3) if(SPATIAL_USE_NETWORK) - # CURL - ExternalProject_Add( - CURL - DEPENDS ZLIB - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-7.87.0.zip + # CURL + ExternalProject_Add( + CURL + DEPENDS ZLIB + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-7.87.0.zip + CONFIGURE_HANDLED_BY_BUILD TRUE + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_DEBUG_POSTFIX=${} # Do not append "d" to the library name when building in debug mode + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + -DBUILD_SHARED_LIBS=OFF + -DHTTP_ONLY=ON + + # Disable some defaults for now + -DCURL_USE_LIBSSH2=OFF + -DCURL_USE_LIBPSL=OFF + -DCURL_USE_LIBSSH=OFF + -DOPENSSL_USE_STATIC_LIBS=ON # Propagate to FindOpenSSL.cmake + -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} + ) + set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} CURL) +endif() + +# PROJ +ExternalProject_Add( + PROJ + $<$>:DEPENDS ZLIB> + DEPENDS SQLITE3 + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/proj-9.1.1.zip CONFIGURE_HANDLED_BY_BUILD TRUE + PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/proj${PATCH_NAME_ENDING}.patch" CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_DEBUG_POSTFIX=${} # Do not append "d" to the library name when building in debug mode + + # CMake options -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ${CMAKE_PROJ_FLAGS} + ${CMAKE_FLAGS_POINTER_SIZE} # vcpkg options -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - -DBUILD_SHARED_LIBS=OFF - -DHTTP_ONLY=ON - - # Disable some defaults for now - -DCURL_USE_LIBSSH2=OFF - -DCURL_USE_LIBPSL=OFF - -DCURL_USE_LIBSSH=OFF - -DOPENSSL_USE_STATIC_LIBS=ON # Propagate to FindOpenSSL.cmake - -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} - ) - set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} CURL) -endif() -# PROJ -ExternalProject_Add( - PROJ - $<$>:DEPENDS ZLIB> - DEPENDS SQLITE3 - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/proj-9.1.1.zip - CONFIGURE_HANDLED_BY_BUILD TRUE - PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/proj${PATCH_NAME_ENDING}.patch" - CMAKE_ARGS - - # CMake options - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - ${CMAKE_PROJ_FLAGS} - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - - # PROJ options - -DBUILD_SHARED_LIBS=OFF - -DBUILD_APPS=OFF - -DBUILD_TESTING=OFF - -DENABLE_CURL=OFF - -DENABLE_TIFF=OFF + # PROJ options + -DBUILD_SHARED_LIBS=OFF + -DBUILD_APPS=OFF + -DBUILD_TESTING=OFF + -DENABLE_CURL=OFF + -DENABLE_TIFF=OFF ) set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} PROJ) # EXPAT ExternalProject_Add( - EXPAT - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/expat-2.5.0.tar.bz2 - CONFIGURE_HANDLED_BY_BUILD TRUE - PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/expat${PATCH_NAME_ENDING}.patch" - CMAKE_ARGS - - # CMake options - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - - # EXPAT options - -DEXPAT_SHARED_LIBS=OFF - -DEXPAT_BUILD_TESTS=OFF - -DEXPAT_BUILD_EXAMPLES=OFF - -DEXPAT_BUILD_FUZZERS=OFF - -DEXPAT_BUILD_DOCS=OFF + EXPAT + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/expat-2.5.0.tar.bz2 + CONFIGURE_HANDLED_BY_BUILD TRUE + PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/expat${PATCH_NAME_ENDING}.patch" + CMAKE_ARGS + + # CMake options + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + ${CMAKE_FLAGS_POINTER_SIZE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + + # EXPAT options + -DEXPAT_SHARED_LIBS=OFF + -DEXPAT_BUILD_TESTS=OFF + -DEXPAT_BUILD_EXAMPLES=OFF + -DEXPAT_BUILD_FUZZERS=OFF + -DEXPAT_BUILD_DOCS=OFF ) set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} EXPAT) # GEOS ExternalProject_Add( - GEOS - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/geos-3.13.0.tar.bz2 - CONFIGURE_HANDLED_BY_BUILD TRUE - CMAKE_ARGS - - # CMake options - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - - # GEOS options - -DBUILD_SHARED_LIBS=OFF - -DBUILD_TESTING=OFF - -DBUILD_DOCUMENTATION=OFF - -DBUILD_ASTYLE=OFF - -DBUILD_GEOSOP=OFF + GEOS + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/geos-3.13.0.tar.bz2 + CONFIGURE_HANDLED_BY_BUILD TRUE + CMAKE_ARGS + + # CMake options + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + ${CMAKE_FLAGS_POINTER_SIZE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + + # GEOS options + -DBUILD_SHARED_LIBS=OFF + -DBUILD_TESTING=OFF + -DBUILD_DOCUMENTATION=OFF + -DBUILD_ASTYLE=OFF + -DBUILD_GEOSOP=OFF ) set(GDAL_DEPENDENCIES ${GDAL_DEPENDENCIES} GEOS) # GeographicLib ExternalProject_Add( - GEOGRAPHICLIB - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/GeographicLib-2.2.zip - CONFIGURE_HANDLED_BY_BUILD TRUE - PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/geographiclib${PATCH_NAME_ENDING}.patch" - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - - # GeographicLib options - -DBUILD_SHARED_LIBS=OFF - -DGEOGRAPHICLIB_DATA=${LOCAL_INSTALL_DIR}/share/GeographicLib - -DBUILD_DOCUMENTATION=OFF + GEOGRAPHICLIB + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/GeographicLib-2.2.zip + CONFIGURE_HANDLED_BY_BUILD TRUE + PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/patches/geographiclib${PATCH_NAME_ENDING}.patch" + CMAKE_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + ${CMAKE_FLAGS_POINTER_SIZE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + + # GeographicLib options + -DBUILD_SHARED_LIBS=OFF + -DGEOGRAPHICLIB_DATA=${LOCAL_INSTALL_DIR}/share/GeographicLib + -DBUILD_DOCUMENTATION=OFF ) + # GDAL ExternalProject_Add( - GDAL - DEPENDS ${GDAL_DEPENDENCIES} - URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/gdal385.zip - CONFIGURE_HANDLED_BY_BUILD TRUE - PATCH_COMMAND patch -p1 -i "${CMAKE_CURRENT_LIST_DIR}/patches/remove_filehandler${PATCH_NAME_ENDING}.patch" && patch -p1 -i "${CMAKE_CURRENT_LIST_DIR}/patches/msyspatch${PATCH_NAME_ENDING}.patch" - CMAKE_ARGS - - # CMake options - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} - -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake - -DCMAKE_FIND_ROOT_PATH=${LOCAL_INSTALL_DIR} - ${CMAKE_FLAGS_POINTER_SIZE} - - # vcpkg options - -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' - -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' - -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' - -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' - - # GDAL Options - -DGDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE=ON # this is needed for GDAL to build with -fPIC - -DBUILD_TESTING=OFF - -DBUILD_APPS=OFF - - # Build static library - -DBUILD_SHARED_LIBS=OFF - ${CMAKE_GDAL_FLAGS} - - # Arrow - -DGDAL_USE_ARROW=OFF - -DARROW_USE_STATIC_LIBRARIES=OFF - - # Disable all external drivers unless explicitly enabled - -DGDAL_USE_EXTERNAL_LIBS=OFF - -DGDAL_USE_INTERNAL_LIBS=ON - - # Supported drivers - -DGDAL_USE_GEOS=ON - -DGDAL_USE_SQLITE3=ON - -DGDAL_USE_EXPAT=ON - -DGDAL_USE_CURL=${SPATIAL_USE_NETWORK} - -DGDAL_USE_OPENSSL=${SPATIAL_USE_NETWORK} - -DOPENSSL_USE_STATIC_LIBS=ON # Propagate to FindOpenSSL.cmake - -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} - - # This is not true, but a bug in gdal's cmake files - -DACCEPT_MISSING_SQLITE3_RTREE:BOOL=ON - -DACCEPT_MISSING_SQLITE3_MUTEX_ALLOC:BOOL=ON - - # Remove optional gdal drivers - -DGDAL_BUILD_OPTIONAL_DRIVERS=OFF - -DOGR_BUILD_OPTIONAL_DRIVERS=OFF - - # Needed to build on Android - $<$:-DBUILD_WITHOUT_64BIT_OFFSET=ON> - - # Special issues - -DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON - -DCMAKE_DISABLE_FIND_PACKAGE_HDF5=ON - -DGDAL_USE_HDF5=OFF - -DGDAL_USE_LIBKML=OFF - - # Build these explicitly - -DOGR_ENABLE_DRIVER_MEM=ON - -DOGR_ENABLE_DRIVER_GEOJSON=ON - -DOGR_ENABLE_DRIVER_GML=ON - -DOGR_ENABLE_DRIVER_TAB=ON - -DOGR_ENABLE_DRIVER_SHAPE=ON - -DOGR_ENABLE_DRIVER_KML=ON - -DOGR_ENABLE_DRIVER_VRT=ON - -DOGR_ENABLE_DRIVER_AVC=ON - -DOGR_ENABLE_DRIVER_NTF=ON - -DOGR_ENABLE_DRIVER_LVBAG=ON - -DOGR_ENABLE_DRIVER_S57=ON - -DOGR_ENABLE_DRIVER_CSV=ON - -DOGR_ENABLE_DRIVER_DGN=ON - -DOGR_ENABLE_DRIVER_GMT=ON - -DOGR_ENABLE_DRIVER_TIGER=ON - -DOGR_ENABLE_DRIVER_GEOCONCEPT=ON - -DOGR_ENABLE_DRIVER_GEORSS=ON - -DOGR_ENABLE_DRIVER_DXF=ON - -DOGR_ENABLE_DRIVER_PGDUMP=ON - -DOGR_ENABLE_DRIVER_GPSBABEL=ON - -DOGR_ENABLE_DRIVER_EDIGEO=ON - -DOGR_ENABLE_DRIVER_SXF=ON - -DOGR_ENABLE_DRIVER_OPENFILEGDB=${OGR_ENABLE_DRIVER_OPENFILEGDB} - -DOGR_ENABLE_DRIVER_WASP=ON - -DOGR_ENABLE_DRIVER_SELAFIN=ON - -DOGR_ENABLE_DRIVER_JML=ON - -DOGR_ENABLE_DRIVER_VDV=ON - -DOGR_ENABLE_DRIVER_FLATGEOBUF=ON - -DOGR_ENABLE_DRIVER_MAPML=ON - -DOGR_ENABLE_DRIVER_GPX=ON - -DOGR_ENABLE_DRIVER_SVG=ON - -DOGR_ENABLE_DRIVER_SQLITE=ON - -DOGR_ENABLE_DRIVER_GPKG=ON - -DOGR_ENABLE_DRIVER_OSM=ON - -DOGR_ENABLE_DRIVER_XLSX=ON - -DOGR_ENABLE_DRIVER_CAD=ON - -DOGR_ENABLE_DRIVER_ODS=ON - -DOGR_ENABLE_DRIVER_LVBAG=ON - -DOGR_ENABLE_DRIVER_VFK=ON - -DOGR_ENABLE_DRIVER_MVT=ON - -DOGR_ENABLE_DRIVER_PMTILES=ON - -DOGR_ENABLE_DRIVER_JSONFG=ON - -DOGR_ENABLE_DRIVER_GTFS=ON - - # Drivers requiring network/curl - -DOGR_ENABLE_DRIVER_AMIGOCLOUD=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_CARTO=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_WFS=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_NGW=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_ELASTIC=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_CSW=${SPATIAL_USE_NETWORK} - -DOGR_ENABLE_DRIVER_PLSCENES=${SPATIAL_USE_NETWORK} - - # Remove bindings - -DBUILD_PYTHON_BINDINGS=OFF + GDAL + DEPENDS ${GDAL_DEPENDENCIES} + URL ${CMAKE_CURRENT_SOURCE_DIR}/vendor/gdal385.zip + CONFIGURE_HANDLED_BY_BUILD TRUE + PATCH_COMMAND patch -p1 -i "${CMAKE_CURRENT_LIST_DIR}/patches/remove_filehandler${PATCH_NAME_ENDING}.patch" && patch -p1 -i "${CMAKE_CURRENT_LIST_DIR}/patches/msyspatch${PATCH_NAME_ENDING}.patch" + CMAKE_ARGS + + # CMake options + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX:PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_PACKED} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_PREFIX_PATH=${LOCAL_INSTALL_DIR} + -DCMAKE_MODULE_PATH=${LOCAL_INSTALL_DIR}/lib/cmake + -DCMAKE_FIND_ROOT_PATH=${LOCAL_INSTALL_DIR} + ${CMAKE_FLAGS_POINTER_SIZE} + + # vcpkg options + -DVCPKG_MANIFEST_DIR='${VCPKG_MANIFEST_DIR}' + -DVCPKG_INSTALLED_DIR='${VCPKG_INSTALLED_DIR}' + -DCMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}' + -DVCPKG_TARGET_TRIPLET='${VCPKG_TARGET_TRIPLET}' + + # GDAL Options + -DGDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE=ON # this is needed for GDAL to build with -fPIC + -DBUILD_TESTING=OFF + -DBUILD_APPS=OFF + + # Build static library + -DBUILD_SHARED_LIBS=OFF + ${CMAKE_GDAL_FLAGS} + + # Arrow + -DGDAL_USE_ARROW=OFF + -DARROW_USE_STATIC_LIBRARIES=OFF + + # Disable all external drivers unless explicitly enabled + -DGDAL_USE_EXTERNAL_LIBS=OFF + -DGDAL_USE_INTERNAL_LIBS=ON + + # Supported drivers + -DGDAL_USE_GEOS=ON + -DGDAL_USE_SQLITE3=ON + -DGDAL_USE_EXPAT=ON + -DGDAL_USE_CURL=${SPATIAL_USE_NETWORK} + -DGDAL_USE_OPENSSL=${SPATIAL_USE_NETWORK} + -DOPENSSL_USE_STATIC_LIBS=ON # Propagate to FindOpenSSL.cmake + -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} + + # This is not true, but a bug in gdal's cmake files + -DACCEPT_MISSING_SQLITE3_RTREE:BOOL=ON + -DACCEPT_MISSING_SQLITE3_MUTEX_ALLOC:BOOL=ON + + # Remove optional gdal drivers + -DGDAL_BUILD_OPTIONAL_DRIVERS=OFF + -DOGR_BUILD_OPTIONAL_DRIVERS=OFF + + # Needed to build on Android + $<$:-DBUILD_WITHOUT_64BIT_OFFSET=ON> + + # Special issues + -DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON + -DCMAKE_DISABLE_FIND_PACKAGE_HDF5=ON + -DGDAL_USE_HDF5=OFF + -DGDAL_USE_LIBKML=OFF + + # Build these explicitly + -DOGR_ENABLE_DRIVER_MEM=ON + -DOGR_ENABLE_DRIVER_GEOJSON=ON + -DOGR_ENABLE_DRIVER_GML=ON + -DOGR_ENABLE_DRIVER_TAB=ON + -DOGR_ENABLE_DRIVER_SHAPE=ON + -DOGR_ENABLE_DRIVER_KML=ON + -DOGR_ENABLE_DRIVER_VRT=ON + -DOGR_ENABLE_DRIVER_AVC=ON + -DOGR_ENABLE_DRIVER_NTF=ON + -DOGR_ENABLE_DRIVER_LVBAG=ON + -DOGR_ENABLE_DRIVER_S57=ON + -DOGR_ENABLE_DRIVER_CSV=ON + -DOGR_ENABLE_DRIVER_DGN=ON + -DOGR_ENABLE_DRIVER_GMT=ON + -DOGR_ENABLE_DRIVER_TIGER=ON + -DOGR_ENABLE_DRIVER_GEOCONCEPT=ON + -DOGR_ENABLE_DRIVER_GEORSS=ON + -DOGR_ENABLE_DRIVER_DXF=ON + -DOGR_ENABLE_DRIVER_PGDUMP=ON + -DOGR_ENABLE_DRIVER_GPSBABEL=ON + -DOGR_ENABLE_DRIVER_EDIGEO=ON + -DOGR_ENABLE_DRIVER_SXF=ON + -DOGR_ENABLE_DRIVER_OPENFILEGDB=${OGR_ENABLE_DRIVER_OPENFILEGDB} + -DOGR_ENABLE_DRIVER_WASP=ON + -DOGR_ENABLE_DRIVER_SELAFIN=ON + -DOGR_ENABLE_DRIVER_JML=ON + -DOGR_ENABLE_DRIVER_VDV=ON + -DOGR_ENABLE_DRIVER_FLATGEOBUF=ON + -DOGR_ENABLE_DRIVER_MAPML=ON + -DOGR_ENABLE_DRIVER_GPX=ON + -DOGR_ENABLE_DRIVER_SVG=ON + -DOGR_ENABLE_DRIVER_SQLITE=ON + -DOGR_ENABLE_DRIVER_GPKG=ON + -DOGR_ENABLE_DRIVER_OSM=ON + -DOGR_ENABLE_DRIVER_XLSX=ON + -DOGR_ENABLE_DRIVER_CAD=ON + -DOGR_ENABLE_DRIVER_ODS=ON + -DOGR_ENABLE_DRIVER_LVBAG=ON + -DOGR_ENABLE_DRIVER_VFK=ON + -DOGR_ENABLE_DRIVER_MVT=ON + -DOGR_ENABLE_DRIVER_PMTILES=ON + -DOGR_ENABLE_DRIVER_JSONFG=ON + -DOGR_ENABLE_DRIVER_GTFS=ON + + # Drivers requiring network/curl + -DOGR_ENABLE_DRIVER_AMIGOCLOUD=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_CARTO=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_WFS=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_NGW=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_ELASTIC=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_CSW=${SPATIAL_USE_NETWORK} + -DOGR_ENABLE_DRIVER_PLSCENES=${SPATIAL_USE_NETWORK} + + # Remove bindings + -DBUILD_PYTHON_BINDINGS=OFF ) # Ouch! Remember that the order of these libraries is important! (reverse order of dependencies)