2020-08-13 01:22:40 +08:00
|
|
|
set(OSG_VER 3.6.5)
|
2019-05-03 13:57:43 +08:00
|
|
|
|
2018-06-20 17:02:39 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO openscenegraph/OpenSceneGraph
|
2020-02-14 09:53:23 +08:00
|
|
|
REF OpenSceneGraph-${OSG_VER}
|
2020-08-13 01:22:40 +08:00
|
|
|
SHA512 7002fa30a3bcf6551d2e1050b4ca75a3736013fd190e4f50953717406864da1952deb09f530bc8c5ddf6e4b90204baec7dbc283f497829846d46d561f66feb4b
|
2018-06-20 17:02:39 +08:00
|
|
|
HEAD_REF master
|
2019-02-12 06:23:46 +08:00
|
|
|
PATCHES
|
2019-05-03 13:57:43 +08:00
|
|
|
collada.patch
|
2020-02-14 09:53:23 +08:00
|
|
|
static.patch
|
|
|
|
fix-sdl.patch
|
|
|
|
fix-example-application.patch
|
|
|
|
disable-present3d-staticview-in-linux.patch #Due to some link error we cannot solve yet, disable them in linux.
|
|
|
|
fix-curl.patch
|
|
|
|
remove-prefix.patch # Remove this patch when cmake fix Findosg_functions.cmake
|
2020-04-17 04:49:55 +08:00
|
|
|
fix-liblas.patch
|
|
|
|
fix-nvtt.patch
|
2020-06-03 06:04:11 +08:00
|
|
|
use-boost-asio.patch
|
2020-10-13 00:28:49 +08:00
|
|
|
fix-dependency-coin.patch
|
2021-01-21 08:22:09 +08:00
|
|
|
osgdb_zip_nozip.patch # This is fix symbol clashes with other libs when built in static-lib mode
|
2017-07-22 16:28:48 +08:00
|
|
|
)
|
|
|
|
|
2019-04-03 03:55:16 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
set(OSG_DYNAMIC OFF)
|
|
|
|
else()
|
|
|
|
set(OSG_DYNAMIC ON)
|
|
|
|
endif()
|
2020-02-14 09:53:23 +08:00
|
|
|
|
2019-05-27 00:54:09 +08:00
|
|
|
file(REMOVE ${SOURCE_PATH}/CMakeModules/FindSDL2.cmake)
|
2020-02-04 06:22:52 +08:00
|
|
|
|
2020-02-14 09:53:23 +08:00
|
|
|
set(OSG_USE_UTF8_FILENAME ON)
|
|
|
|
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
message("Build osg requires gcc with version higher than 4.7.")
|
|
|
|
# Enable OSG_USE_UTF8_FILENAME will call some windows-only functions.
|
|
|
|
set(OSG_USE_UTF8_FILENAME OFF)
|
|
|
|
endif()
|
|
|
|
|
2020-02-04 06:22:52 +08:00
|
|
|
set(OPTIONS)
|
|
|
|
if(NOT "collada" IN_LIST FEATURES)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_COLLADA=ON)
|
|
|
|
endif()
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_FFmpeg=ON)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_DCMTK=ON)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_GStreamer=ON)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_GLIB=ON)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_SDL=ON)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_LIBLAS=ON)
|
|
|
|
|
2020-04-17 04:49:55 +08:00
|
|
|
# Due to nvtt CRT linkage error, we can only enable static builds here
|
|
|
|
set(ENABLE_NVTT ON)
|
|
|
|
if (VCPKG_TARGET_IS_WINDOWS AND OSG_DYNAMIC)
|
|
|
|
set(ENABLE_NVTT OFF)
|
|
|
|
endif()
|
|
|
|
list(APPEND OPTIONS -DENABLE_NVTT=${ENABLE_NVTT})
|
|
|
|
|
2021-03-26 04:28:42 +08:00
|
|
|
if (VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_FONTCONFIG=ON)
|
|
|
|
list(APPEND OPTIONS -DOSG_TEXT_USE_FONTCONFIG=OFF)
|
|
|
|
endif()
|
|
|
|
|
2020-04-17 04:49:55 +08:00
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
|
|
tools BUILD_OSG_APPLICATIONS
|
|
|
|
examples BUILD_OSG_EXAMPLES
|
|
|
|
plugins BUILD_OSG_PLUGINS
|
|
|
|
packages BUILD_OSG_PACKAGES
|
|
|
|
docs BUILD_DOCUMENTATION
|
|
|
|
docs BUILD_REF_DOCS_SEARCHENGINE
|
|
|
|
docs BUILD_REF_DOCS_TAGFILE
|
|
|
|
)
|
|
|
|
|
2017-07-22 16:28:48 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2020-04-17 04:49:55 +08:00
|
|
|
OPTIONS ${FEATURE_OPTIONS}
|
2020-02-14 09:53:23 +08:00
|
|
|
-DOSG_USE_UTF8_FILENAME=${OSG_USE_UTF8_FILENAME}
|
|
|
|
-DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC}
|
|
|
|
-DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC}
|
2020-04-17 04:49:55 +08:00
|
|
|
-DBUILD_DASHBOARD_REPORTS=OFF
|
2020-02-14 09:53:23 +08:00
|
|
|
-DCMAKE_CXX_STANDARD=11
|
2020-04-17 04:49:55 +08:00
|
|
|
${OPTIONS}
|
2017-07-22 16:28:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
|
2020-02-14 09:53:23 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2019-05-03 13:57:43 +08:00
|
|
|
# handle osg tools and plugins
|
2017-07-22 16:28:48 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
|
2020-02-14 09:53:23 +08:00
|
|
|
set(OSG_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
2017-07-22 16:28:48 +08:00
|
|
|
|
2020-02-14 09:53:23 +08:00
|
|
|
file(GLOB OSG_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
|
2020-04-17 04:49:55 +08:00
|
|
|
if (OSG_TOOLS)
|
|
|
|
file(MAKE_DIRECTORY ${OSG_TOOL_PATH})
|
|
|
|
file(COPY ${OSG_TOOLS} DESTINATION ${OSG_TOOL_PATH})
|
|
|
|
file(REMOVE_RECURSE ${OSG_TOOLS})
|
|
|
|
file(GLOB OSG_TOOLS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
|
|
|
|
file(REMOVE_RECURSE ${OSG_TOOLS_DBG})
|
|
|
|
endif()
|
|
|
|
file(GLOB OSG_TOOLS ${CURRENT_PACKAGES_DIR}/share/OpenSceneGraph/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
|
|
|
|
if (OSG_TOOLS)
|
|
|
|
file(COPY ${OSG_TOOLS} DESTINATION ${OSG_TOOL_PATH})
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/OpenSceneGraph)
|
|
|
|
endif()
|
|
|
|
|
2017-07-22 16:28:48 +08:00
|
|
|
|
2020-02-14 09:53:23 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
2020-04-17 04:49:55 +08:00
|
|
|
file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/*)
|
|
|
|
if (OSG_PLUGINS_DBG)
|
|
|
|
file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}/osgPlugins-${OSG_VER})
|
|
|
|
endif()
|
|
|
|
file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/*)
|
|
|
|
if (OSG_PLUGINS_REL)
|
|
|
|
if (NOT EXISTS ${OSG_TOOL_PATH})
|
|
|
|
file(MAKE_DIRECTORY ${OSG_TOOL_PATH})
|
|
|
|
endif()
|
|
|
|
file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-${OSG_VER})
|
|
|
|
endif()
|
2020-02-14 09:53:23 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/ ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/)
|
|
|
|
endif()
|
2017-07-22 16:28:48 +08:00
|
|
|
|
2020-04-17 04:49:55 +08:00
|
|
|
file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/*)
|
|
|
|
if (OSG_PLUGINS_DBG)
|
|
|
|
file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}/osgPlugins-${OSG_VER})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/*)
|
|
|
|
if (OSG_PLUGINS_REL)
|
|
|
|
if (NOT EXISTS ${OSG_TOOL_PATH})
|
|
|
|
file(MAKE_DIRECTORY ${OSG_TOOL_PATH})
|
|
|
|
endif()
|
|
|
|
file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-${OSG_VER})
|
|
|
|
endif()
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/ ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/)
|
2019-04-03 03:55:16 +08:00
|
|
|
|
|
|
|
#Cleanup
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
2020-02-14 09:53:23 +08:00
|
|
|
endif()
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/)
|
|
|
|
|
|
|
|
# Handle copyright
|
2020-05-20 05:47:19 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|