[osg] static build (#5913)

This commit is contained in:
Shelley Lake 2019-04-02 21:55:16 +02:00 committed by Phil Christensen
parent a0415b38a9
commit 280200a95d
3 changed files with 27 additions and 7 deletions

View File

@ -1,5 +1,5 @@
Source: osg
Version: 3.6.2
Version: 3.6.2-1
Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit.
Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff

View File

@ -11,10 +11,6 @@
#
include(vcpkg_common_functions)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building will not support load data through plugins.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
@ -24,15 +20,24 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/collada.patch"
"${CMAKE_CURRENT_LIST_DIR}/static.patch"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(OSG_DYNAMIC OFF)
else()
set(OSG_DYNAMIC ON)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
# PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-DOSG_USE_UTF8_FILENAME=ON
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
-DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC}
-DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC}
-DBUILD_OSG_EXAMPLES=ON
-DBUILD_OSG_APPLICATIONS=ON
)
vcpkg_install_cmake()
@ -59,3 +64,11 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.2/)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/osg)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/osg/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/osg/copyright)
#Cleanup
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

7
ports/osg/static.patch Normal file
View File

@ -0,0 +1,7 @@
--- a/src/osgPlugins/curl/CMakeLists.txt
+++ b/src/osgPlugins/curl/CMakeLists.txt
@@ -35,3 +35,3 @@
ADD_DEFINITIONS(-DCURL_STATICLIB)
- SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32 winmm wldap32)
+ SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32 winmm wldap32 crypt32)
ENDIF()