Skip to content

Commit

Permalink
Merge pull request #32 from open-vcpkg/gdal-osx
Browse files Browse the repository at this point in the history
[gdal] Fix build on *-osx-dynamic
  • Loading branch information
m-kuhn authored Jun 28, 2024
2 parents 6299179 + 313200d commit 6414c28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
29 changes: 19 additions & 10 deletions ports/gdal/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ endif()

string(REPLACE "dynamic" "" qhull_target "Qhull::qhull${VCPKG_LIBRARY_LINKAGE}_r")

if(VCPKG_TARGET_IS_WINDOWS)
set(GDAL_PYTHON_INSTALL_PREFIX "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/../../")
else()
set(GDAL_PYTHON_INSTALL_PREFIX "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/../../../")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
Expand Down Expand Up @@ -99,6 +104,8 @@ vcpkg_cmake_configure(
"-DQHULL_LIBRARY=${qhull_target}"
"-DSWIG_DIR=${CURRENT_HOST_INSTALLED_DIR}/tools/swig"
"-DSWIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/swig/swig${VCPKG_HOST_EXECUTABLE_SUFFIX}"
"-DGDAL_PYTHON_INSTALL_PREFIX=${GDAL_PYTHON_INSTALL_PREFIX}"
-DONLY_GENERATE_FOR_NON_DEBUG=ON # Python bindings only for release
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
OPTIONS_DEBUG
-DBUILD_APPS=OFF
Expand Down Expand Up @@ -169,17 +176,19 @@ if(NOT bin_files)
endif()

if("python" IN_LIST FEATURES)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/Lib"
"${CURRENT_PACKAGES_DIR}/debug/Scripts"
)
file(COPY "${CURRENT_PACKAGES_DIR}/Lib/site-packages/" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")
# TODO: Generalize for non windows
file(COPY "${CURRENT_PACKAGES_DIR}/Scripts" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/../../Scripts")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/Lib/site-packages"
"${CURRENT_PACKAGES_DIR}/Scripts"
if(VCPKG_TARGET_IS_OSX)
file(GLOB_RECURSE macho_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/*")
list(FILTER macho_files INCLUDE REGEX "\.so$")
foreach(macho_file IN LISTS macho_files)
# Required for testing, as it needs to be able load shared libs from the package (not yet installed) path
# Will be overwritten by z_vcpkg_fixup_rpath_macho
execute_process(
COMMAND install_name_tool -add_rpath "${CURRENT_PACKAGES_DIR}/lib" "${macho_file}"
OUTPUT_QUIET
ERROR_VARIABLE set_rpath_error
)
endforeach()
endif()
vcpkg_python_test_import(MODULE "osgeo.gdal")
endif()

Expand Down
1 change: 1 addition & 0 deletions ports/gdal/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "gdal",
"version-semver": "3.8.4",
"port-version": 1,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"license": null,
Expand Down

0 comments on commit 6414c28

Please sign in to comment.