Skip to content

Commit

Permalink
[gdal] Optional "tool" feature to build executables
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jul 30, 2021
1 parent fa1bbe0 commit dfe1d0d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
69 changes: 40 additions & 29 deletions ports/gdal/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@ vcpkg_extract_source_archive_ex(
PATCHES ${GDAL_PATCHES}
)

set(GDAL_EXES
gdal_contour
gdal_create
gdal_grid
gdal_rasterize
gdal_translate
gdal_viewshed
gdaladdo
gdalbuildvrt
gdaldem
gdalenhance
gdalinfo
gdallocationinfo
gdalmanage
gdalmdiminfo
gdalmdimtranslate
gdalsrsinfo
gdaltindex
gdaltransform
gdalwarp
gnmanalyse
gnmmanage
nearblack
ogr2ogr
ogrinfo
ogrlineref
ogrtindex
testepsg
)

if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(NATIVE_DATA_DIR "${CURRENT_PACKAGES_DIR}/share/gdal")
set(NATIVE_HTML_DIR "${CURRENT_PACKAGES_DIR}/share/gdal/html")
Expand Down Expand Up @@ -141,35 +171,6 @@ if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
endif()

if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(GDAL_EXES
gdal_contour
gdal_create
gdal_grid
gdal_rasterize
gdal_translate
gdal_viewshed
gdaladdo
gdalbuildvrt
gdaldem
gdalenhance
gdalinfo
gdallocationinfo
gdalmanage
gdalmdiminfo
gdalmdimtranslate
gdalsrsinfo
gdaltindex
gdaltransform
gdalwarp
gnmanalyse
gnmmanage
nearblack
ogr2ogr
ogrinfo
ogrlineref
ogrtindex
testepsg
)
vcpkg_copy_tools(TOOL_NAMES ${GDAL_EXES} AUTO_CLEAN)
else()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
Expand Down Expand Up @@ -362,3 +363,13 @@ configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

# Delete binaries unless the "tools" feature is specified
if(NOT "tools" IN_LIST FEATURES)
set(GDAL_EXES_RELEASE ${GDAL_EXES})
set(GDAL_EXES_DEBUG ${GDAL_EXES})
list(TRANSFORM GDAL_EXES_RELEASE PREPEND "${CURRENT_PACKAGES_DIR}/tools/gdal/bin/")
list(TRANSFORM GDAL_EXES_DEBUG PREPEND "${CURRENT_PACKAGES_DIR}/tools/gdal/debug/bin/")
endif()

file(REMOVE ${GDAL_EXES_RELEASE} ${GDAL_EXES_DEBUG})
5 changes: 4 additions & 1 deletion ports/gdal/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gdal",
"version-semver": "3.2.2",
"port-version": 3,
"port-version": 4,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"supports": "!arm",
Expand Down Expand Up @@ -47,6 +47,9 @@
"system-libraries": {
"$supports": "!windows",
"description": "Include drivers which need additional libraries"
},
"tools": {
"description": "Builds gdal and ogr executables"
}
}
}

0 comments on commit dfe1d0d

Please sign in to comment.