[vcpkg-fixup-cmake-targets][glm] Upgrade GLM. Move cmake fixup logic into helper script.

This commit is contained in:
Robert Schumacher 2017-06-20 15:20:23 -07:00
parent 82a0834b37
commit 338f8614e3
3 changed files with 21 additions and 30 deletions

View File

@ -1,3 +1,3 @@
Source: glm
Version: 0.9.8.1
Version: 0.9.8.4
Description: OpenGL Mathematics (GLM) https://glm.g-truc.net

View File

@ -1,16 +1,3 @@
#header-only library
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions)
vcpkg_from_github(
@ -23,26 +10,12 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/glm")
# changes target search path
file(READ ${CURRENT_PACKAGES_DIR}/share/glm/glmTargets.cmake GLM_TARGETS)
string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)" GLM_TARGETS ${GLM_TARGETS})
file(WRITE ${CURRENT_PACKAGES_DIR}/share/glm/glmTargets.cmake "${GLM_TARGETS}")
file(READ ${CURRENT_PACKAGES_DIR}/share/glm/glmConfig.cmake GLM_CONFIG)
string(REPLACE "get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../../\" ABSOLUTE)"
"get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../\" ABSOLUTE)" GLM_CONFIG ${GLM_CONFIG})
file(WRITE ${CURRENT_PACKAGES_DIR}/share/glm/glmConfig.cmake "${GLM_CONFIG}")
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

View File

@ -76,8 +76,6 @@ function(vcpkg_fixup_cmake_targets)
"${RELEASE_SHARE}/*[Cc]onfig-release.cmake"
)
foreach(RELEASE_TARGET ${RELEASE_TARGETS})
get_filename_component(RELEASE_TARGET_NAME ${RELEASE_TARGET} NAME)
file(READ ${RELEASE_TARGET} _contents)
string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
file(WRITE ${RELEASE_TARGET} "${_contents}")
@ -99,6 +97,26 @@ function(vcpkg_fixup_cmake_targets)
file(REMOVE ${DEBUG_TARGET})
endforeach()
file(GLOB MAIN_TARGETS "${RELEASE_SHARE}/*[Tt]argets.cmake")
foreach(MAIN_TARGET ${MAIN_TARGETS})
file(READ ${MAIN_TARGET} _contents)
string(REGEX REPLACE
"get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*"
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
_contents "${_contents}")
file(WRITE ${MAIN_TARGET} "${_contents}")
endforeach()
file(GLOB MAIN_CONFIGS "${RELEASE_SHARE}/*[Cc]onfig.cmake")
foreach(MAIN_CONFIG ${MAIN_CONFIGS})
file(READ ${MAIN_CONFIG} _contents)
string(REGEX REPLACE
"get_filename_component\\(PACKAGE_PREFIX_DIR \"\\\${CMAKE_CURRENT_LIST_DIR}/\\.\\./(\\.\\./)*\" ABSOLUTE\\)"
"get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../\" ABSOLUTE)"
_contents "${_contents}")
file(WRITE ${MAIN_CONFIG} "${_contents}")
endforeach()
# Remove /debug/share/<port>/ if it's empty.
file(GLOB_RECURSE REMAINING_FILES "${DEBUG_SHARE}/*")
if(NOT REMAINING_FILES)