Merge pull request #342 from mmassing/statically_linked_glew

[glew] Implement static build
This commit is contained in:
Alexander Karatarakis 2016-12-19 17:21:15 -08:00 committed by GitHub
commit 3b7b380798

View File

@ -1,7 +1,3 @@
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building not supported yet. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew-2.0.0)
vcpkg_download_distfile(ARCHIVE_FILE
@ -19,45 +15,77 @@ ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
if(NOT EXISTS ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj)
message(STATUS "Upgrading projects")
file(READ ${SOURCE_PATH}/build/vc12/glew_shared.vcxproj PROJ)
string(REPLACE
"<PlatformToolset>v120</PlatformToolset>"
"<PlatformToolset>v140</PlatformToolset>"
PROJ ${PROJ})
string(REPLACE
"opengl32.lib%"
"opengl32.lib\;%"
PROJ ${PROJ})
file(WRITE ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj ${PROJ})
endif()
# TODO: Maybe switch to glews' cmake build system in the future
FOREACH(LINKAGE shared static)
if(NOT EXISTS ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}14.vcxproj)
message(STATUS "Upgrading " ${LINKAGE} " project")
file(READ ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}.vcxproj PROJ)
string(REPLACE
"<PlatformToolset>v120</PlatformToolset>"
"<PlatformToolset>v140</PlatformToolset>"
PROJ ${PROJ})
string(REPLACE
"opengl32.lib%"
"opengl32.lib\;%"
PROJ ${PROJ})
if (LINKAGE STREQUAL "static")
string(REPLACE
"MultiThreadedDebugDLL"
"MultiThreadedDebug"
PROJ ${PROJ}
)
endif()
file(WRITE ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}14.vcxproj ${PROJ})
endif()
ENDFOREACH(LINKAGE)
message(STATUS "Upgrading projects done")
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_static14.vcxproj
)
else()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj
)
endif()
message(STATUS "Installing")
file(INSTALL
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
file(INSTALL
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(INSTALL
${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
)
file(INSTALL
${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
file(INSTALL
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(INSTALL
${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
)
file(INSTALL
${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
else()
file(INSTALL
${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32sd.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
RENAME glew32d.lib
)
file(INSTALL
${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32s.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
RENAME glew32.lib
)
endif()
file(INSTALL
${SOURCE_PATH}/include/GL
DESTINATION ${CURRENT_PACKAGES_DIR}/include