From f509b3f1f372feedd6823763b6a11022b0af147d Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 7 Jan 2025 22:08:14 +0100 Subject: [PATCH] Rename EMBED_GRIDS_DIRECTORY to EMBED_RESOURCE_DIRECTORY, and also embed .pol files (master only) --- .github/workflows/fedora_rawhide/start.sh | 10 +++++----- docs/source/install.rst | 4 ++-- src/lib_proj.cmake | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/fedora_rawhide/start.sh b/.github/workflows/fedora_rawhide/start.sh index 2450d6972e..dfc0a220b3 100755 --- a/.github/workflows/fedora_rawhide/start.sh +++ b/.github/workflows/fedora_rawhide/start.sh @@ -24,12 +24,12 @@ CC=clang CXX=clang++ cmake .. \ make -j$(nproc) ctest -j$(nproc) -# Try EMBED_GRIDS_DIRECTORY option +# Try EMBED_RESOURCE_DIRECTORY option wget https://raw.githubusercontent.com/OSGeo/PROJ-data/refs/heads/master/us_nga/us_nga_egm96_15.tif mkdir grids mv us_nga_egm96_15.tif grids -echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_GRIDS_DIRECTORY=$PWD/grids" -CC=clang CXX=clang++ cmake .. -DEMBED_GRIDS_DIRECTORY=$PWD/grids +echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_RESOURCE_DIRECTORY=$PWD/grids" +CC=clang CXX=clang++ cmake .. -DEMBED_RESOURCE_DIRECTORY=$PWD/grids make -j$(nproc) rm -rf data echo 49 2 0 | bin/cs2cs "WGS84 + EGM96 height" EPSG:4979 @@ -37,8 +37,8 @@ echo 49 2 0 | bin/cs2cs "WGS84 + EGM96 height" EPSG:4979 | grep 44.643 >/dev/nu echo 0 0 0 | bin/cct +init=ITRF2000:ITRF96 echo 0 0 0 | bin/cct +init=ITRF2000:ITRF96 | grep 0.0067 >/dev/null || (echo "Expected 0.0067 0.0061 -0.0185 as a result" && /bin/false) -echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_GRIDS_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON" -CC=clang CXX=clang++ cmake .. -DEMBED_GRIDS_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON +echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_RESOURCE_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON" +CC=clang CXX=clang++ cmake .. -DEMBED_RESOURCE_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON make -j$(nproc) rm -rf data echo 49 2 0 | bin/cs2cs "WGS84 + EGM96 height" EPSG:4979 diff --git a/docs/source/install.rst b/docs/source/install.rst index 8c5a95a4b0..d6e4648a42 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -455,11 +455,11 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory. Default is OFF for shared library builds (BUILD_SHARED_LIBS=ON), and ON for static library builds (BUILD_SHARED_LIBS=OFF). -.. option:: EMBED_GRIDS_DIRECTORY= +.. option:: EMBED_RESOURCE_DIRECTORY= .. versionadded:: 9.6 - Embed files from ending with .tif or .json in the PROJ library itself. + Embed files from ending with .tif, .json or .pol in the PROJ library itself. The pointed directory can potentially be the full PROJ-data package (uncompressed). In that case, about 6 GB of free disk and 16 GB of RAM are required to build PROJ. diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index d82da7cfa6..7c1264737a 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -428,20 +428,20 @@ if (EMBED_RESOURCE_FILES) endif() endif() -set(EMBED_GRIDS_DIRECTORY "" CACHE PATH "Directory that contains .tif and .json files to embed into libproj") +set(EMBED_RESOURCE_DIRECTORY "" CACHE PATH "Directory that contains .tif, .json or .pol files to embed into libproj") set(FILES_TO_EMBED) -if (EMBED_GRIDS_DIRECTORY) +if (EMBED_RESOURCE_DIRECTORY) if (NOT EMBED_RESOURCE_FILES) - message(FATAL_ERROR "EMBED_RESOURCE_FILES should be set to ON when EMBED_GRIDS_DIRECTORY is set") + message(FATAL_ERROR "EMBED_RESOURCE_FILES should be set to ON when EMBED_RESOURCE_DIRECTORY is set") endif() - if (NOT IS_DIRECTORY ${EMBED_GRIDS_DIRECTORY}) - message(FATAL_ERROR "${EMBED_GRIDS_DIRECTORY} is not a valid directory") + if (NOT IS_DIRECTORY ${EMBED_RESOURCE_DIRECTORY}) + message(FATAL_ERROR "${EMBED_RESOURCE_DIRECTORY} is not a valid directory") endif() - file(GLOB FILES_TO_EMBED "${EMBED_GRIDS_DIRECTORY}/*.tif" "${EMBED_GRIDS_DIRECTORY}/*.json") + file(GLOB FILES_TO_EMBED "${EMBED_RESOURCE_DIRECTORY}/*.tif" "${EMBED_RESOURCE_DIRECTORY}/*.json" "${EMBED_RESOURCE_DIRECTORY}/*.pol") if (NOT FILES_TO_EMBED) - message(FATAL_ERROR "No .tif or .json files found in ${EMBED_GRIDS_DIRECTORY}") + message(FATAL_ERROR "No .tif, .json or .pol files found in ${EMBED_RESOURCE_DIRECTORY}") endif() endif()