vcpkg/ports/gl3w/portfile.cmake
Frank 87a7640f85
[gl3w] Support to include GL extensions in header file (#38605)
Fix https://github.com/microsoft/vcpkg/issues/38588

Include the GL extension in the header file by adding the parameter
`--ext`.
Note: This method only adds GL extension and does not delete any
original method implementation.

Upstream: 
```
The generator script optionally takes the arguments:

--ext to include the GL Extensions in output header.
```
https://github.com/skaslev/gl3w?tab=readme-ov-file#options

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-05-09 13:05:16 -07:00

41 lines
1.3 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO skaslev/gl3w
REF 99ed321100d37032cb6bfa7dd8dea85f10c86132
SHA512 217f65644c73c33383b09893fa5ede066cc4b1cddab051feac11d7e939dba14ed637b297ea42a0426bc0a1a3bc665998a91c27ca10d28704ce9e2d3d90e73595
HEAD_REF master
PATCHES
0001-enable-shared-build.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
file(COPY "${CURRENT_INSTALLED_DIR}/include/GL/glcorearb.h" DESTINATION "${SOURCE_PATH}/include/GL")
file(COPY "${CURRENT_INSTALLED_DIR}/include/KHR/khrplatform.h" DESTINATION "${SOURCE_PATH}/include/KHR")
vcpkg_find_acquire_program(PYTHON3)
if("ext" IN_LIST FEATURES)
set(EXT "--ext")
endif()
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/gl3w_gen.py" "${EXT}"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME gl3w-gen
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/GL/gl3w.h" "#define GL3W_API" "#define GL3W_API __declspec(dllimport)")
endif()
file(INSTALL "${SOURCE_PATH}/UNLICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)