diff --git a/ports/osg/disable-present3d-staticview-in-linux.patch b/ports/osg/disable-present3d-staticview-in-linux.patch deleted file mode 100644 index fd76db35bb59b6..00000000000000 --- a/ports/osg/disable-present3d-staticview-in-linux.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt -index ab491c6..bee3d1f 100644 ---- a/applications/CMakeLists.txt -+++ b/applications/CMakeLists.txt -@@ -32,12 +32,16 @@ IF(DYNAMIC_OPENSCENEGRAPH) - ADD_SUBDIRECTORY(osgconv) - ADD_SUBDIRECTORY(osgfilecache) - ADD_SUBDIRECTORY(osgversion) -- ADD_SUBDIRECTORY(present3D) -+ if (NOT UNIX) -+ ADD_SUBDIRECTORY(present3D) -+ endif() - ELSE() - # need to define this on win32 or linker cries about _declspecs - ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) - - ADD_SUBDIRECTORY(osgversion) -- ADD_SUBDIRECTORY(present3D) -+ if (NOT UNIX) -+ ADD_SUBDIRECTORY(present3D) -+ endif() - ENDIF() - -diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 788e507..3c550bc 100644 ---- a/examples/CMakeLists.txt -+++ b/examples/CMakeLists.txt -@@ -245,7 +245,7 @@ ELSE(DYNAMIC_OPENSCENEGRAPH) - - IF(OSG_BUILD_PLATFORM_IPHONE) - ADD_SUBDIRECTORY(osgviewerIPhone) -- ELSE() -+ ELSEIF (NOT UNIX) - ADD_SUBDIRECTORY(osgstaticviewer) - ENDIF() - diff --git a/ports/osg/fix-curl.patch b/ports/osg/fix-curl.patch deleted file mode 100644 index e95fbee5dc3dbc..00000000000000 --- a/ports/osg/fix-curl.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/osgPlugins/curl/CMakeLists.txt b/src/osgPlugins/curl/CMakeLists.txt -index cc459ff..370dbec 100644 ---- a/src/osgPlugins/curl/CMakeLists.txt -+++ b/src/osgPlugins/curl/CMakeLists.txt -@@ -23,11 +23,11 @@ SET(TARGET_H - - IF(ZLIB_FOUND) - SET(TARGET_LIBRARIES_VARS -- CURL_LIBRARY -+ CURL_LIBRARIES - ZLIB_LIBRARIES) - ELSE() - SET(TARGET_LIBRARIES_VARS -- CURL_LIBRARY) -+ CURL_LIBRARIES) - ENDIF() - - IF(WIN32 OR MINGW) diff --git a/ports/osg/fix-dependency-coin.patch b/ports/osg/fix-dependency-coin.patch deleted file mode 100644 index b04318683331b5..00000000000000 --- a/ports/osg/fix-dependency-coin.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 798b8b9..c975d78 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -740,7 +740,7 @@ ELSE() - # Common to all platforms except android: - FIND_PACKAGE(Freetype) - FIND_PACKAGE(ilmbase) -- FIND_PACKAGE(Inventor) -+ FIND_PACKAGE(coin CONFIG) - FIND_PACKAGE(Jasper) - FIND_PACKAGE(OpenEXR) - FIND_PACKAGE(OpenCascade) -diff --git a/src/osgPlugins/Inventor/CMakeLists.txt b/src/osgPlugins/Inventor/CMakeLists.txt -index 963a494..e34b6b8 100644 ---- a/src/osgPlugins/Inventor/CMakeLists.txt -+++ b/src/osgPlugins/Inventor/CMakeLists.txt -@@ -17,10 +17,6 @@ SET(TARGET_HDRS - ShuttleCallback.h - ) - --ADD_DEFINITIONS(-DCOIN_DLL) -- --INCLUDE_DIRECTORIES(${INVENTOR_INCLUDE_DIR}) -- --SET(TARGET_ADDED_LIBRARIES ${INVENTOR_LIBRARY}) -+SET(TARGET_ADDED_LIBRARIES Coin::Coin) - - SETUP_PLUGIN(iv iv) diff --git a/ports/osg/fix-example-application.patch b/ports/osg/fix-example-application.patch deleted file mode 100644 index ebef27fd4764f6..00000000000000 --- a/ports/osg/fix-example-application.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/applications/present3D/CMakeLists.txt b/applications/present3D/CMakeLists.txt -index df859d0..123313a 100644 ---- a/applications/present3D/CMakeLists.txt -+++ b/applications/present3D/CMakeLists.txt -@@ -103,6 +103,11 @@ ENDIF() - IF (WIN32) - # to support cluster code - SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32) -+ -+ find_package(EXPAT REQUIRED) -+ find_package(Iconv REQUIRED) -+ -+ list(APPEND TARGET_EXTERNAL_LIBRARIES EXPAT::EXPAT Iconv::Iconv) - ELSE() - CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" LIB_NSL_HAS_GETHOSTBYNAME) - IF(LIB_NSL_HAS_GETHOSTBYNAME) -diff --git a/examples/osgstaticviewer/CMakeLists.txt b/examples/osgstaticviewer/CMakeLists.txt -index 071ab26..bf8d85f 100644 ---- a/examples/osgstaticviewer/CMakeLists.txt -+++ b/examples/osgstaticviewer/CMakeLists.txt -@@ -19,6 +19,13 @@ IF(FREETYPE_FOUND) - SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype) - ENDIF(FREETYPE_FOUND) - -+IF (WIN32) -+ find_package(EXPAT REQUIRED) -+ find_package(Iconv REQUIRED) -+ -+ list(APPEND TARGET_EXTERNAL_LIBRARIES EXPAT::EXPAT Iconv::Iconv) -+ENDIF() -+ - SET(TARGET_SRC osgstaticviewer.cpp ) - #### end var setup ### - SETUP_EXAMPLE(osgstaticviewer) diff --git a/ports/osg/fix-liblas.patch b/ports/osg/fix-liblas.patch deleted file mode 100644 index c36396e97bfbb2..00000000000000 --- a/ports/osg/fix-liblas.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b84fa06..a991670 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -765,7 +765,10 @@ ELSE() - ENDIF() - FIND_PACKAGE(ZeroConf) - -- FIND_PACKAGE(LIBLAS) -+ FIND_PACKAGE(liblas CONFIG) -+ set(LIBLAS_FOUND ${liblas_FOUND}) -+ set(LIBLAS_LIBRARY liblas) -+ set(LIBLASC_LIBRARY liblas_c) - - IF (NOT(OSG_USE_LOCAL_LUA_SOURCE)) - FIND_PACKAGE(Lua52) diff --git a/ports/osg/fix-nvtt-squish.patch b/ports/osg/fix-nvtt-squish.patch new file mode 100644 index 00000000000000..fb7ef087087283 --- /dev/null +++ b/ports/osg/fix-nvtt-squish.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeModules/FindNVTT.cmake b/CMakeModules/FindNVTT.cmake +index d0e7414..f6fb761 100644 +--- a/CMakeModules/FindNVTT.cmake ++++ b/CMakeModules/FindNVTT.cmake +@@ -120,7 +120,7 @@ FIND_LIBRARY(NVTHREAD_LIBRARY_DEBUG + + # SQUISH + FIND_LIBRARY(NVSQUISH_LIBRARY_RELEASE +- NAMES squish ++ NAMES nvsquish NAMES_PER_DIR + PATHS + /usr/local + /usr +@@ -129,7 +129,7 @@ FIND_LIBRARY(NVSQUISH_LIBRARY_RELEASE + PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static + ) + FIND_LIBRARY(NVSQUISH_LIBRARY_DEBUG +- NAMES squish_d ++ NAMES nvsquish_d NAMES_PER_DIR + PATHS + /usr/local + /usr diff --git a/ports/osg/fix-nvtt.patch b/ports/osg/fix-nvtt.patch deleted file mode 100644 index 3cc1c4d5883701..00000000000000 --- a/ports/osg/fix-nvtt.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a991670..5b530c5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -759,7 +759,9 @@ ELSE() - FIND_PACKAGE(RSVG) - FIND_PACKAGE(GtkGl) - FIND_PACKAGE(DirectInput) -+ if (ENABLE_NVTT) - FIND_PACKAGE(NVTT) -+ endif() - IF (NOT WIN32) - FIND_PACKAGE(Asio) - ENDIF() diff --git a/ports/osg/fix-sdl.patch b/ports/osg/fix-sdl.patch index e97d86476f3cbd..be0030fea4f16f 100644 --- a/ports/osg/fix-sdl.patch +++ b/ports/osg/fix-sdl.patch @@ -2,26 +2,16 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 81328ea..c735419 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -755,8 +755,6 @@ ELSE() +@@ -755,7 +755,8 @@ ELSE() FIND_PACKAGE(GStreamer COMPONENTS app pbutils) FIND_PACKAGE(GLIB COMPONENTS gobject) FIND_PACKAGE(DirectShow) - FIND_PACKAGE(SDL2) -- FIND_PACKAGE(SDL) - FIND_PACKAGE(Poppler-glib) - FIND_PACKAGE(RSVG) - FIND_PACKAGE(GtkGl) -@@ -775,6 +773,10 @@ ELSE() - FIND_PACKAGE(Lua51) - ENDIF() - ENDIF() -+ -+ find_package(SDL) + find_package(SDL2 CONFIG) + set(SDL2_LIBRARY SDL2::SDL2 SDL2::SDL2main) - - # V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this. - # FIND_PACKAGE(V8) + FIND_PACKAGE(SDL) + FIND_PACKAGE(Poppler-glib) + FIND_PACKAGE(RSVG) diff --git a/examples/osgmovie/osgmovie.cpp b/examples/osgmovie/osgmovie.cpp index 9de15b1..ae96e11 100644 --- a/examples/osgmovie/osgmovie.cpp diff --git a/ports/osg/link-libraries.patch b/ports/osg/link-libraries.patch new file mode 100644 index 00000000000000..7eb0a8f37dc890 --- /dev/null +++ b/ports/osg/link-libraries.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake +index ce55be0..9b7107c 100644 +--- a/CMakeModules/OsgMacroUtils.cmake ++++ b/CMakeModules/OsgMacroUtils.cmake +@@ -37,6 +37,11 @@ SET(VALID_BUILDER_VERSION OFF) + + MACRO(LINK_WITH_VARIABLES TRGTNAME) + FOREACH(varname ${ARGN}) ++ string(REPLACE "_LIBRARY" "_LIBRARIES" lwv_libraries "${varname}") ++ if(DEFINED ${lwv_libraries}) ++ TARGET_LINK_LIBRARIES(${TRGTNAME} ${${lwv_libraries}}) ++ continue() ++ endif() + IF(${varname}_DEBUG) + IF(${varname}_RELEASE) + TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}_RELEASE}" debug "${${varname}_DEBUG}") diff --git a/ports/osg/plugin-pdb-install.patch b/ports/osg/plugin-pdb-install.patch new file mode 100644 index 00000000000000..2ba45651410f7f --- /dev/null +++ b/ports/osg/plugin-pdb-install.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake +index a12fcf1..ce55be0 100644 +--- a/CMakeModules/OsgMacroUtils.cmake ++++ b/CMakeModules/OsgMacroUtils.cmake +@@ -351,7 +351,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) + LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) + IF(MSVC AND DYNAMIC_OPENSCENEGRAPH) + INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo) +- INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug) ++ INSTALL(FILES $ DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug) + ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH) + ELSE(WIN32) + INSTALL(TARGETS ${TARGET_TARGETNAME} diff --git a/ports/osg/portfile.cmake b/ports/osg/portfile.cmake index d4cd4aaa5ac97c..88ec457c5bc2be 100644 --- a/ports/osg/portfile.cmake +++ b/ports/osg/portfile.cmake @@ -7,167 +7,154 @@ vcpkg_from_github( SHA512 7002fa30a3bcf6551d2e1050b4ca75a3736013fd190e4f50953717406864da1952deb09f530bc8c5ddf6e4b90204baec7dbc283f497829846d46d561f66feb4b HEAD_REF master PATCHES + link-libraries.patch collada.patch - 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 - fix-liblas.patch - fix-nvtt.patch + fix-nvtt-squish.patch + plugin-pdb-install.patch use-boost-asio.patch - fix-dependency-coin.patch osgdb_zip_nozip.patch # This is fix symbol clashes with other libs when built in static-lib mode + unofficial-export.patch ) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(OSG_DYNAMIC OFF) -else() - set(OSG_DYNAMIC ON) -endif() - -file(REMOVE ${SOURCE_PATH}/CMakeModules/FindSDL2.cmake) - -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() - -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) +file(REMOVE + "${SOURCE_PATH}/CMakeModules/FindFontconfig.cmake" + "${SOURCE_PATH}/CMakeModules/FindFreetype.cmake" + "${SOURCE_PATH}/CMakeModules/FindSDL2.cmake" +) -# 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}) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" OSG_DYNAMIC) -if (VCPKG_TARGET_IS_WINDOWS) - list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_FONTCONFIG=ON) - list(APPEND OPTIONS -DOSG_TEXT_USE_FONTCONFIG=OFF) +set(OPTIONS "") +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND OPTIONS -DOSG_USE_UTF8_FILENAME=ON) endif() 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 + FEATURES + tools BUILD_OSG_APPLICATIONS + examples BUILD_OSG_EXAMPLES + plugins BUILD_OSG_PLUGINS_BY_DEFAULT + packages BUILD_OSG_PACKAGES + docs BUILD_DOCUMENTATION + docs BUILD_REF_DOCS_SEARCHENGINE + docs BUILD_REF_DOCS_TAGFILE + fontconfig OSG_TEXT_USE_FONTCONFIG + freetype BUILD_OSG_PLUGIN_FREETYPE + collada BUILD_OSG_PLUGIN_DAE + nvtt BUILD_OSG_PLUGIN_NVTT + openexr BUILD_OSG_PLUGIN_EXR + openexr CMAKE_REQUIRE_FIND_PACKAGE_OpenEXR + rest-http-device BUILD_OSG_PLUGIN_RESTHTTPDEVICE + sdl BUILD_OSG_PLUGIN_SDL + INVERTED_FEATURES + sdl CMAKE_DISABLE_FIND_PACKAGE_SDL # for apps and examples ) -set(BUILD_OSG_PLUGIN_RESTHTTPDEVICE ON) -if(VCPKG_TARGET_IS_WINDOWS) - set(BUILD_OSG_PLUGIN_RESTHTTPDEVICE OFF) -endif() - # The package osg can be configured to use different OpenGL profiles via a custom triplet file: # Possible values are GLCORE, GL2, GL3, GLES1, GLES2, GLES3, and GLES2+GLES3 if(NOT DEFINED osg_OPENGL_PROFILE) set(osg_OPENGL_PROFILE "GL3") endif() -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS ${FEATURE_OPTIONS} - -DOSG_USE_UTF8_FILENAME=${OSG_USE_UTF8_FILENAME} +# Plugin control variables are used only if prerequisites are satisfied. +set(plugin_vars "") +file(STRINGS "${SOURCE_PATH}/src/osgPlugins/CMakeLists.txt" plugin_lines REGEX "ADD_PLUGIN_DIRECTORY") +foreach(line IN LISTS plugin_lines) + if(NOT line MATCHES "ADD_PLUGIN_DIRECTORY\\(([^)]*)" OR NOT EXISTS "${SOURCE_PATH}/src/osgPlugins/${CMAKE_MATCH_1}/CMakeLists.txt") + continue() + endif() + string(TOUPPER "${CMAKE_MATCH_1}" plugin_upper) + list(APPEND plugin_vars "BUILD_OSG_PLUGIN_${plugin_upper}") +endforeach() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} -DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC} -DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC} + -DOSG_MSVC_VERSIONED_DLL=OFF + -DOSG_DETERMINE_WIN_VERSION=OFF + -DUSE_3RDPARTY_BIN=OFF -DBUILD_OSG_PLUGIN_DICOM=OFF -DBUILD_OSG_PLUGIN_OPENCASCADE=OFF -DBUILD_OSG_PLUGIN_INVENTOR=OFF -DBUILD_OSG_PLUGIN_FBX=OFF -DBUILD_OSG_PLUGIN_DIRECTSHOW=OFF + -DBUILD_OSG_PLUGIN_LAS=OFF -DBUILD_OSG_PLUGIN_QTKIT=OFF -DBUILD_OSG_PLUGIN_SVG=OFF -DBUILD_OSG_PLUGIN_VNC=OFF -DBUILD_OSG_PLUGIN_LUA=OFF -DOPENGL_PROFILE=${osg_OPENGL_PROFILE} - -DBUILD_OSG_PLUGIN_RESTHTTPDEVICE=${BUILD_OSG_PLUGIN_RESTHTTPDEVICE} -DBUILD_OSG_PLUGIN_ZEROCONFDEVICE=OFF -DBUILD_DASHBOARD_REPORTS=OFF -DCMAKE_CXX_STANDARD=11 - ${OPTIONS} + -DCMAKE_DISABLE_FIND_PACKAGE_FFmpeg=ON + -DCMAKE_DISABLE_FIND_PACKAGE_DCMTK=ON + -DCMAKE_DISABLE_FIND_PACKAGE_GStreamer=ON + -DCMAKE_DISABLE_FIND_PACKAGE_GLIB=ON + -DCMAKE_DISABLE_FIND_PACKAGE_Inventor=ON + ${OPTIONS} + OPTIONS_DEBUG + -DBUILD_OSG_APPLICATIONS=OFF + -DBUILD_OSG_EXAMPLES=OFF + -DBUILD_DOCUMENTATION=OFF + MAYBE_UNUSED_VARIABLES + BUILD_REF_DOCS_SEARCHENGINE + BUILD_REF_DOCS_TAGFILE + OSG_DETERMINE_WIN_VERSION + USE_3RDPARTY_BIN + ${plugin_vars} ) - -vcpkg_install_cmake() - +vcpkg_cmake_install() vcpkg_copy_pdbs() +configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-osg-config.cmake" "${CURRENT_PACKAGES_DIR}/share/unofficial-osg/unofficial-osg-config.cmake" @ONLY) +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-osg) -# handle osg tools and plugins -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -set(OSG_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/${PORT}) - -file(GLOB OSG_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX}) -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) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(APPEND "${CURRENT_PACKAGES_DIR}/include/osg/Config" "#ifndef OSG_LIBRARY_STATIC\n#define OSG_LIBRARY_STATIC 1\n#endif\n") endif() - -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - 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}) +# Move all osg plugins to [/debug]/plugins/osgPlugins-${OSG_VER}, +# as a staging area for later deployment. +set(osg_plugins_subdir "osgPlugins-${OSG_VER}") +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/plugins") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}" "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}") + if(NOT VCPKG_BUILD_TYPE) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/${osg_plugins_subdir}" "${CURRENT_PACKAGES_DIR}/debug/plugins/${osg_plugins_subdir}") 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}/) endif() -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() +if("tools" IN_LIST FEATURES) + set(osg_plugin_pattern "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}osgdb*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}") + file(GLOB osg_plugins "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osg_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${osg_plugins_subdir}") + if(NOT VCPKG_BUILD_TYPE) + file(GLOB osg_plugins "${CURRENT_PACKAGES_DIR}/debug/plugins/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osg_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/${osg_plugins_subdir}") + 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}) + set(tools osgversion present3D) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + list(APPEND tools osgviewer osgarchive osgconv osgfilecache) endif() - file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-${OSG_VER}) + vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN) endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/ ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/) -#Cleanup -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/openscenegraph.pc" "\\\n" " ") +if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/openscenegraph.pc" "\\\n" " ") endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/) - -# Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) - vcpkg_fixup_pkgconfig() -# Handle usage file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/osg/remove-prefix.patch b/ports/osg/remove-prefix.patch deleted file mode 100644 index ced94522cdb579..00000000000000 --- a/ports/osg/remove-prefix.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/CMakeModules/ModuleInstall.cmake b/CMakeModules/ModuleInstall.cmake -index bb3be63..356edcd 100644 ---- a/CMakeModules/ModuleInstall.cmake -+++ b/CMakeModules/ModuleInstall.cmake -@@ -21,7 +21,7 @@ SOURCE_GROUP( - FILES ${TARGET_H} - ) - --IF(MSVC AND OSG_MSVC_VERSIONED_DLL) -+IF(0) - HANDLE_MSVC_DLL() - ENDIF() - -diff --git a/src/OpenThreads/win32/CMakeLists.txt b/src/OpenThreads/win32/CMakeLists.txt -index 84550bd..0e816f7 100644 ---- a/src/OpenThreads/win32/CMakeLists.txt -+++ b/src/OpenThreads/win32/CMakeLists.txt -@@ -39,7 +39,7 @@ LINK_DIRECTORIES( - ${CMAKE_CURRENT_BINARY_DIR} - ) - --IF(MSVC AND OSG_MSVC_VERSIONED_DLL) -+IF(0) - HANDLE_MSVC_DLL(ot ${OPENTHREADS_SOVERSION}) - ENDIF() - diff --git a/ports/osg/static.patch b/ports/osg/static.patch deleted file mode 100644 index c7278d282c2487..00000000000000 --- a/ports/osg/static.patch +++ /dev/null @@ -1,7 +0,0 @@ ---- 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() diff --git a/ports/osg/unofficial-export.patch b/ports/osg/unofficial-export.patch new file mode 100644 index 00000000000000..1061f704de30d1 --- /dev/null +++ b/ports/osg/unofficial-export.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c975d78..cc53332 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1374,3 +1374,6 @@ ADD_CUSTOM_TARGET(uninstall + # + include(FeatureSummary) + feature_summary(WHAT ALL) ++ ++INSTALL(EXPORT osg-targets NAMESPACE unofficial::osg:: DESTINATION share/unofficial-osg) ++INSTALL(EXPORT osg-plugins NAMESPACE unofficial::osg:: DESTINATION share/unofficial-osg) +diff --git a/CMakeModules/ModuleInstall.cmake b/CMakeModules/ModuleInstall.cmake +index f6714c5..d58f6fd 100644 +--- a/CMakeModules/ModuleInstall.cmake ++++ b/CMakeModules/ModuleInstall.cmake +@@ -27,6 +27,7 @@ ENDIF() + + INSTALL( + TARGETS ${LIB_NAME} ++ EXPORT osg-targets + RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph + LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT libopenscenegraph + ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev +diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake +index dcc1fe3..a12fcf1 100644 +--- a/CMakeModules/OsgMacroUtils.cmake ++++ b/CMakeModules/OsgMacroUtils.cmake +@@ -345,6 +345,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) + #the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS} + IF(WIN32) + INSTALL(TARGETS ${TARGET_TARGETNAME} ++ EXPORT osg-plugins + RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT} + ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev + LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) +@@ -354,6 +355,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) + ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH) + ELSE(WIN32) + INSTALL(TARGETS ${TARGET_TARGETNAME} ++ EXPORT osg-plugins + RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT} + ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev + LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) +diff --git a/src/OpenThreads/pthreads/CMakeLists.txt b/src/OpenThreads/pthreads/CMakeLists.txt +index e18969c..5a8ad62 100644 +--- a/src/OpenThreads/pthreads/CMakeLists.txt ++++ b/src/OpenThreads/pthreads/CMakeLists.txt +@@ -157,6 +157,7 @@ ELSE() + + INSTALL( + TARGETS OpenThreads ++ EXPORT osg-targets + ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev + LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads + RUNTIME DESTINATION bin COMPONENT libopenthreads +diff --git a/src/OpenThreads/win32/CMakeLists.txt b/src/OpenThreads/win32/CMakeLists.txt +index 0e816f7..0c083fd 100644 +--- a/src/OpenThreads/win32/CMakeLists.txt ++++ b/src/OpenThreads/win32/CMakeLists.txt +@@ -45,6 +45,7 @@ ENDIF() + + INSTALL( + TARGETS OpenThreads ++ EXPORT osg-targets + ARCHIVE DESTINATION lib COMPONENT libopenthreads-dev + LIBRARY DESTINATION lib COMPONENT libopenthreads + RUNTIME DESTINATION bin COMPONENT libopenthreads diff --git a/ports/osg/unofficial-osg-config.cmake b/ports/osg/unofficial-osg-config.cmake new file mode 100644 index 00000000000000..1b3d88f42d4559 --- /dev/null +++ b/ports/osg/unofficial-osg-config.cmake @@ -0,0 +1,20 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0057 NEW) +include("${CMAKE_CURRENT_LIST_DIR}/osg-targets.cmake") +include(CMakeFindDependencyMacro) +if("@OSG_TEXT_USE_FONTCONFIG@") + find_dependency(Fontconfig) # CMake 3.14 +endif() +if("plugins" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + include("${CMAKE_CURRENT_LIST_DIR}/osg-plugins.cmake") + if(TARGET unofficial::osg::osgdb_curl) + find_dependency(CURL) + endif() + if(TARGET unofficial::osg::osgdb_gdal OR TARGET unofficial::osg::osgdb_ogr) + find_dependency(GDAL) + endif() +endif() +set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "@OSG_VER@") +cmake_policy(POP) diff --git a/ports/osg/vcpkg.json b/ports/osg/vcpkg.json index 1a939cdd3ac450..00a16a7ca67be4 100644 --- a/ports/osg/vcpkg.json +++ b/ports/osg/vcpkg.json @@ -1,7 +1,7 @@ { "name": "osg", "version": "3.6.5", - "port-version": 12, + "port-version": 13, "description": "The OpenSceneGraph is an open source high performance 3D graphics toolkit.", "homepage": "https://github.com/openscenegraph/OpenSceneGraph", "dependencies": [ @@ -9,17 +9,26 @@ "name": "expat", "platform": "windows" }, - { - "name": "fontconfig", - "platform": "!windows" - }, "opengl-registry", { "name": "openimageio", "platform": "osx" }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, "zlib" ], + "default-features": [ + "default-features", + "freetype", + "plugins" + ], "features": { "collada": { "description": "Support for Collada (.dae) files", @@ -27,98 +36,165 @@ "collada-dom" ] }, + "default-features": { + "description": "Platform-dependent default features", + "dependencies": [ + { + "name": "osg", + "default-features": false, + "features": [ + "openexr" + ], + "platform": "!uwp" + }, + { + "name": "osg", + "default-features": false, + "features": [ + "rest-http-device" + ], + "platform": "!windows" + }, + { + "name": "osg", + "default-features": false, + "features": [ + "fontconfig" + ], + "platform": "!android & !ios & !uwp" + }, + { + "name": "osg", + "default-features": false, + "features": [ + "nvtt" + ], + "platform": "!x86 & !(windows & arm64) & !uwp" + } + ] + }, "docs": { "description": "Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads" }, "examples": { "description": "Enable to build OSG Examples", "dependencies": [ - "freetype", { "name": "libiconv", "platform": "windows" }, - "sdl1", + { + "name": "osg", + "default-features": false, + "features": [ + "freetype" + ] + }, "sdl2" ] }, + "fontconfig": { + "description": "Enable Fontconfig support for osgText", + "dependencies": [ + "fontconfig", + { + "name": "osg", + "default-features": false, + "features": [ + "freetype" + ] + } + ] + }, + "freetype": { + "description": "Enable Freetype support", + "dependencies": [ + { + "name": "freetype", + "default-features": false + } + ] + }, + "nvtt": { + "description": "Build texture processing tools plugin", + "dependencies": [ + "nvtt" + ] + }, + "openexr": { + "description": "Build the exr plugin", + "dependencies": [ + "ilmbase", + "openexr" + ] + }, "packages": { "description": "Set to ON to generate CPack configuration files and packaging targets" }, "plugins": { - "description": "Build OSG Plugins - Disable for compile testing examples on a time limit", + "description": "Build most OSG Plugins", "dependencies": [ - { - "name": "boost-asio", - "platform": "!windows" - }, - { - "name": "boost-bind", - "platform": "!windows" - }, - { - "name": "boost-core", - "platform": "!windows" - }, - { - "name": "boost-lexical-cast", - "platform": "!windows" - }, - { - "name": "boost-logic", - "platform": "!windows" - }, - { - "name": "boost-smart-ptr", - "platform": "!windows" - }, - { - "name": "boost-tuple", - "platform": "!windows" - }, - "coin", "curl", - "freetype", "gdal", { "name": "giflib", "platform": "windows" }, - "ilmbase", - "jasper", + { + "name": "jasper", + "default-features": false + }, "libgta", { "name": "libiconv", "platform": "windows" }, "libjpeg-turbo", - "liblas", "libpng", { "name": "libxml2", "platform": "windows" }, - { - "name": "nvtt", - "platform": "!x86" - }, - "openexr", - "sdl1", "tiff" ] }, + "rest-http-device": { + "description": "Build RestHttpDevice plugin", + "supports": "!windows", + "dependencies": [ + "boost-array", + "boost-asio", + "boost-bind", + "boost-core", + "boost-lexical-cast", + "boost-logic", + "boost-smart-ptr", + "boost-tuple" + ] + }, + "sdl1": { + "description": "Build SDL 1 plugin, and enable SDL 1 app features", + "dependencies": [ + "sdl1" + ] + }, "tools": { "description": "Enable to build OSG Applications (e.g. osgviewer)", "dependencies": [ "curl", - "freetype", { "name": "libiconv", "platform": "windows" }, "libjpeg-turbo", "libpng", - "sdl1" + { + "name": "osg", + "default-features": false, + "features": [ + "freetype" + ] + } ] } } diff --git a/ports/osgearth/StaticOSG.patch b/ports/osgearth/StaticOSG.patch deleted file mode 100644 index 2f4b1bff11c7de..00000000000000 --- a/ports/osgearth/StaticOSG.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 4e719ceacdc8df729f3296f62c9f50075c862967 Mon Sep 17 00:00:00 2001 -From: Ankur Verma -Date: Sun, 27 Dec 2020 22:26:32 -0800 -Subject: [PATCH] StaticOSG - ---- - CMakeLists.txt | 9 ++++++ - CMakeModules/FindGEOS.cmake | 29 +++++++++++++++++++++++++++-- - 2 files changed, 36 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 049e37e..d75a3b9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -266,6 +266,15 @@ ELSE() - SET(OSGEARTH_DYNAMIC_OR_STATIC "STATIC") - ENDIF() - -+IF(NOT OSGEARTH_BUILD_SHARED_LIBS) -+ ADD_DEFINITIONS(-DOSGEARTH_LIBRARY_STATIC) -+ENDIF() -+ -+OPTION(OSG_IS_STATIC "Set to ON to build OSG for static linking. Use OFF for dynamic." OFF) -+IF (OSG_IS_STATIC) -+ ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -+ LINK_LIBRARIES(${CMAKE_DL_LIBS}) -+ENDIF(OSG_IS_STATIC) - - # OE Libraries - ADD_SUBDIRECTORY(src) -diff --git a/CMakeModules/FindGEOS.cmake b/CMakeModules/FindGEOS.cmake -index e85f922..b1bbfed 100644 ---- a/CMakeModules/FindGEOS.cmake -+++ b/CMakeModules/FindGEOS.cmake -@@ -65,7 +65,7 @@ FIND_LIBRARY(GEOS_LIBRARY - ) - - FIND_LIBRARY(GEOS_LIBRARY_DEBUG -- NAMES geos_cd geos_i_d geosd -+ NAMES geos_cd geos_i_d - PATHS - ${GEOS_DIR}/lib - $ENV{GEOS_DIR} -@@ -74,7 +74,7 @@ FIND_LIBRARY(GEOS_LIBRARY_DEBUG - ) - - FIND_LIBRARY(GEOS_LIBRARY_DEBUG -- NAMES geos_cd geos_i_d geosd -+ NAMES geos_cd geos_i_d - PATHS - ~/Library/Frameworks - /Library/Frameworks -@@ -92,3 +92,28 @@ SET(GEOS_FOUND "NO") - IF(GEOS_LIBRARY AND GEOS_INCLUDE_DIR) - SET(GEOS_FOUND "YES") - ENDIF(GEOS_LIBRARY AND GEOS_INCLUDE_DIR) -+ -+OPTION(GEOS_IS_STATIC "Set to ON to build GEOS for static linking. Use OFF for dynamic." OFF) -+IF (GEOS_IS_STATIC) -+ FIND_LIBRARY(GEOS_CXX_LIBRARY -+ NAMES geos -+ PATHS -+ ${GEOS_DIR}/lib -+ $ENV{GEOS_DIR} -+ NO_DEFAULT_PATH -+ PATH_SUFFIXES lib64 lib -+ ) -+ -+ FIND_LIBRARY(GEOS_CXX_LIBRARY_DEBUG -+ NAMES geosd -+ PATHS -+ ${GEOS_DIR}/lib -+ $ENV{GEOS_DIR} -+ NO_DEFAULT_PATH -+ PATH_SUFFIXES lib64 lib -+ ) -+ -+ set(GEOS_LIBRARY "${GEOS_LIBRARY};${GEOS_CXX_LIBRARY}" CACHE STRING "Geos Libraries" FORCE ) -+ set(GEOS_LIBRARY_DEBUG "${GEOS_LIBRARY_DEBUG};${GEOS_CXX_LIBRARY_DEBUG}" CACHE STRING "Geos Debug Libraries" FORCE ) -+ -+ENDIF(GEOS_IS_STATIC) --- -2.29.2 - diff --git a/ports/osgearth/make-all-find-packages-required.patch b/ports/osgearth/find-package.patch similarity index 55% rename from ports/osgearth/make-all-find-packages-required.patch rename to ports/osgearth/find-package.patch index b685f7dba43799..399be807f158d6 100644 --- a/ports/osgearth/make-all-find-packages-required.patch +++ b/ports/osgearth/find-package.patch @@ -2,7 +2,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 7541c8d07..cc14d2160 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -122,40 +122,53 @@ option(OSGEARTH_ENABLE_GEOCODER "Enable the geocoder (GDAL/OGR must be built wit +@@ -122,9 +122,9 @@ option(OSGEARTH_ENABLE_GEOCODER "Enable the geocoder (GDAL/OGR must be built wit # Mobile/GLES: IF (OSGEARTH_USE_GLES) @@ -14,14 +14,9 @@ index 7541c8d07..cc14d2160 100755 ENDIF (OSGEARTH_USE_GLES) # required - find_package(OSG REQUIRED) --find_package(CURL REQUIRED) -+find_package(CURL CONFIG REQUIRED) -+set(CURL_LIBRARY CURL::libcurl) +@@ -162,28 +162,33 @@ find_package(GDAL REQUIRED) -- -+set(GDAL_LIBRARY ${GDAL_LIBRARIES}) -+set(GDAL_FOUND 1) + # optional -find_package(GEOS) -find_package(Sqlite3) @@ -31,23 +26,18 @@ index 7541c8d07..cc14d2160 100755 -find_package(Protobuf) -find_package(WEBP) -find_package(Blend2D) -+find_package(geos CONFIG REQUIRED) -+set(GEOS_LIBRARY GEOS::geos GEOS::geos_c) -+set(GEOS_FOUND 1) -+find_package(unofficial-sqlite3 CONFIG REQUIRED) -+set(SQLITE3_FOUND 1) ++find_package(GEOS CONFIG REQUIRED) ++set(GEOS_LIBRARY GEOS::geos_c) ++find_package(SQLITE3 NAMES unofficial-sqlite3 REQUIRED) +set(SQLITE3_LIBRARY unofficial::sqlite3::sqlite3) +find_package(Draco REQUIRED) +find_package(BASISU REQUIRED) +find_package(GLEW REQUIRED) -+set(GLEW_LIBRARIES GLEW::GLEW) -+set(GLEW_FOUND 1) -+find_package(protobuf CONFIG REQUIRED) -+set(Protobuf_LIBRARIES protobuf::libprotoc protobuf::libprotobuf) -+set(Protobuf_FOUND 1) ++find_package(Protobuf REQUIRED) +find_package(WEBP NAMES WebP CONFIG REQUIRED) +set(WEBP_LIBRARY WebP::webp) -+find_package(Blend2D CONFIG REQUIRED) ++find_package(BLEND2D CONFIG REQUIRED) ++set(BLEND2D_LIBRARY blend2d::blend2d) if(OSGEARTH_ENABLE_PROFILING) - find_package(Tracy) @@ -56,9 +46,8 @@ index 7541c8d07..cc14d2160 100755 if(OSGEARTH_BUILD_ZIP_PLUGIN) - find_package(LIBZIP) -+ find_package(libzip CONFIG REQUIRED) ++ find_package(LIBZIP CONFIG REQUIRED) + set(LIBZIP_LIBRARY libzip::zip) -+ set(LIBZIP_FOUND 1) endif() if(OSGEARTH_BUILD_TRITON_NODEKIT) @@ -71,7 +60,6 @@ index 7541c8d07..cc14d2160 100755 + find_package(SilverLining QUIET REQUIRED) endif() - # Sqlite enables the MBTiles format: @@ -193,7 +207,7 @@ SET (PROTOBUF_USE_DLLS FALSE CACHE BOOL "Set this to true if Protobuf is compile # Duktape is the JavaScript interpreter SET (WITH_EXTERNAL_DUKTAPE FALSE CACHE BOOL "Use bundled or system wide version of Duktape") @@ -81,34 +69,13 @@ index 7541c8d07..cc14d2160 100755 ENDIF (WITH_EXTERNAL_DUKTAPE) # Whether to install shaders (glsl files). -@@ -204,7 +218,9 @@ OPTION(OSGEARTH_INSTALL_SHADERS "Whether to deploy GLSL shaders when doing a Mak +@@ -204,7 +218,8 @@ OPTION(OSGEARTH_INSTALL_SHADERS "Whether to deploy GLSL shaders when doing a Mak # TinyXML is an XML parsing library SET (WITH_EXTERNAL_TINYXML FALSE CACHE BOOL "Use bundled or system wide version of TinyXML") IF (WITH_EXTERNAL_TINYXML) - find_package(TinyXML) -+ find_package(tinyxml CONFIG REQUIRED) -+ set(TINYXML_FOUND 1) ++ find_package(TINYXML NAMES tinyxml REQUIRED) + set(TINYXML_LIBRARY unofficial-tinyxml::unofficial-tinyxml) ENDIF (WITH_EXTERNAL_TINYXML) # postfix settings for various configs -diff --git a/src/osgEarth/CMakeLists.txt b/src/osgEarth/CMakeLists.txt -index cd55c1164..4ecb61f0d 100644 ---- a/src/osgEarth/CMakeLists.txt -+++ b/src/osgEarth/CMakeLists.txt -@@ -909,11 +909,11 @@ IF(FILEGDB_FOUND) - LINK_WITH_VARIABLES(${LIB_NAME} FILEGDB_LIBRARY) - ENDIF() - --IF(BLEND2D_FOUND) -+#IF(BLEND2D_FOUND) - add_definitions(-DOSGEARTH_HAVE_BLEND2D) -- include_directories(${BLEND2D_INCLUDES}) -- link_with_variables(${LIB_NAME} BLEND2D_LIBRARY) --ENDIF() -+# include_directories(${BLEND2D_INCLUDES}) -+ target_link_libraries(${LIB_NAME} blend2d::blend2d) -+#ENDIF() - - IF (WIN32) - LINK_EXTERNAL(${LIB_NAME} ${TARGET_EXTERNAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ) diff --git a/ports/osgearth/fix-dependency-osg.patch b/ports/osgearth/fix-dependency-osg.patch deleted file mode 100644 index 6aae9a560c28ec..00000000000000 --- a/ports/osgearth/fix-dependency-osg.patch +++ /dev/null @@ -1,176 +0,0 @@ -diff --git a/CMakeModules/FindOSG.cmake b/CMakeModules/FindOSG.cmake -index b7dff11..d1ec2ff 100644 ---- a/CMakeModules/FindOSG.cmake -+++ b/CMakeModules/FindOSG.cmake -@@ -121,5 +121,40 @@ IF( OSG_LIBRARY AND OSG_INCLUDE_DIR ) - SET( OSG_FOUND "YES" ) - SET( OSG_INCLUDE_DIRS ${OSG_INCLUDE_DIR} ${OSG_GEN_INCLUDE_DIR} ) - GET_FILENAME_COMPONENT( OSG_LIBRARIES_DIR ${OSG_LIBRARY} PATH ) -+ -+ find_package(ZLIB REQUIRED) -+ set(ZLIB_LIBRARY ZLIB::ZLIB) -+ -+ find_package(Freetype REQUIRED) -+ set(FREETYPE_LIBRARY Freetype::Freetype) -+ -+ find_package(unofficial-brotli CONFIG REQUIRED) -+ find_package(BZip2 REQUIRED) -+ find_package(expat CONFIG REQUIRED) -+ find_package(PNG REQUIRED) -+ find_package(JPEG REQUIRED) -+ find_package(TIFF REQUIRED) -+ find_package(zstd REQUIRED) -+ find_package(GIF REQUIRED) -+ if (WIN32) -+ find_package(pthreads CONFIG REQUIRED) -+ list(APPEND OSG_DEPENDS_LIBRARY PThreads4W::PThreads4W) -+ endif() -+ -+ if (UNIX) -+ list(APPEND OSG_DEPENDS_LIBRARY ${OSG_DEPENDS_LIBRARY} -pthread) -+ # Due to Linux Linker dependency issues these need to included again -+ set(DEPEND_LIB_LIST fontconfig freetype uuid gdal json-c expat zstd proj sqlite3 webp gif cfitsio openjp2 xml2) -+ else(UNIX) -+ set(DEPEND_LIB_LIST cfitsio) -+ endif() -+ foreach (libname ${DEPEND_LIB_LIST}) -+ find_library(${libname}_LIBRARY_RELEASE NAMES ${libname} NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED) -+ find_library(${libname}_LIBRARY_DEBUG NAMES ${libname} ${libname}d ${libname}_d NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED) -+ select_library_configurations(${libname}) -+ list(APPEND OSG_DEPENDS_LIBRARY ${${libname}_LIBRARY}) -+ endforeach() -+ list(APPEND OSG_DEPENDS_LIBRARY ZLIB::ZLIB Freetype::Freetype expat::expat PNG::PNG JPEG::JPEG TIFF::TIFF ${GIF_LIBRARIES} ${CFITSIO_LIBRARY}) -+ - ENDIF( OSG_LIBRARY AND OSG_INCLUDE_DIR ) - -diff --git a/src/applications/osgearth_3pv/CMakeLists.txt b/src/applications/osgearth_3pv/CMakeLists.txt -index e1dc876..6d688ff 100644 ---- a/src/applications/osgearth_3pv/CMakeLists.txt -+++ b/src/applications/osgearth_3pv/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_3pv.cpp ) - -diff --git a/src/applications/osgearth_atlas/CMakeLists.txt b/src/applications/osgearth_atlas/CMakeLists.txt -index aadbb5e..69698c7 100644 ---- a/src/applications/osgearth_atlas/CMakeLists.txt -+++ b/src/applications/osgearth_atlas/CMakeLists.txt -@@ -1,6 +1,6 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) - --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_atlas.cpp ) - -diff --git a/src/applications/osgearth_boundarygen/CMakeLists.txt b/src/applications/osgearth_boundarygen/CMakeLists.txt -index fe9ec6b..52915b0 100644 ---- a/src/applications/osgearth_boundarygen/CMakeLists.txt -+++ b/src/applications/osgearth_boundarygen/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_H - BoundaryUtil -diff --git a/src/applications/osgearth_clamp/CMakeLists.txt b/src/applications/osgearth_clamp/CMakeLists.txt -index 996ea43..728ee77 100644 ---- a/src/applications/osgearth_clamp/CMakeLists.txt -+++ b/src/applications/osgearth_clamp/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_clamp.cpp) - -diff --git a/src/applications/osgearth_conv/CMakeLists.txt b/src/applications/osgearth_conv/CMakeLists.txt -index a77d703..2aac5f2 100644 ---- a/src/applications/osgearth_conv/CMakeLists.txt -+++ b/src/applications/osgearth_conv/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_conv.cpp ) - -diff --git a/src/applications/osgearth_overlayviewer/CMakeLists.txt b/src/applications/osgearth_overlayviewer/CMakeLists.txt -index bb2802a..5175cfc 100644 ---- a/src/applications/osgearth_overlayviewer/CMakeLists.txt -+++ b/src/applications/osgearth_overlayviewer/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_overlayviewer.cpp ) - -diff --git a/src/applications/osgearth_tfs/CMakeLists.txt b/src/applications/osgearth_tfs/CMakeLists.txt -index 90c153a..d331019 100644 ---- a/src/applications/osgearth_tfs/CMakeLists.txt -+++ b/src/applications/osgearth_tfs/CMakeLists.txt -@@ -1,6 +1,6 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) - --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_tfs.cpp ) - -diff --git a/src/applications/osgearth_toc/CMakeLists.txt b/src/applications/osgearth_toc/CMakeLists.txt -index b32c523..7b25b79 100644 ---- a/src/applications/osgearth_toc/CMakeLists.txt -+++ b/src/applications/osgearth_toc/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY OSGWIDGET_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGWIDGET_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_toc.cpp ) - -diff --git a/src/applications/osgearth_version/CMakeLists.txt b/src/applications/osgearth_version/CMakeLists.txt -index 1f1d48d..01e963b 100644 ---- a/src/applications/osgearth_version/CMakeLists.txt -+++ b/src/applications/osgearth_version/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_version.cpp ) - -diff --git a/src/applications/osgearth_viewer/CMakeLists.txt b/src/applications/osgearth_viewer/CMakeLists.txt -index 8c61e42..bbda7be 100644 ---- a/src/applications/osgearth_viewer/CMakeLists.txt -+++ b/src/applications/osgearth_viewer/CMakeLists.txt -@@ -1,5 +1,5 @@ - INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIRS} ) --SET(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+SET(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OPENTHREADS_LIBRARY) - - SET(TARGET_SRC osgearth_viewer.cpp ) - -diff --git a/src/osgEarth/CMakeLists.txt b/src/osgEarth/CMakeLists.txt -index cd55c1164..7cecdac74 100644 ---- a/src/osgEarth/CMakeLists.txt -+++ b/src/osgEarth/CMakeLists.txt -@@ -928,9 +928,11 @@ ENDIF(TRACY_FOUND) - - OPTION(NRL_STATIC_LIBRARIES "Link osgEarth against static GDAL and cURL, including static OpenSSL, Proj4, JPEG, PNG, and TIFF." OFF) - if(NOT NRL_STATIC_LIBRARIES) -- LINK_WITH_VARIABLES(${LIB_NAME} OSG_LIBRARY OSGUTIL_LIBRARY OSGSIM_LIBRARY OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGTEXT_LIBRARY OSGGA_LIBRARY OSGSHADOW_LIBRARY CURL_LIBRARY GDAL_LIBRARY OSGMANIPULATOR_LIBRARY) -+ LINK_WITH_VARIABLES(${LIB_NAME} OSGSIM_LIBRARY OSGVIEWER_LIBRARY OSGTEXT_LIBRARY OSGDB_LIBRARY OSGGA_LIBRARY OSGSHADOW_LIBRARY OPENTHREADS_LIBRARY OSGMANIPULATOR_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY) -+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${OSG_DEPENDS_LIBRARY} ${CURL_LIBRARY} ${GDAL_LIBRARIES}) - else(NOT NRL_STATIC_LIBRARIES) -- LINK_WITH_VARIABLES(${LIB_NAME} OSG_LIBRARY OSGUTIL_LIBRARY OSGSIM_LIBRARY OSGDB_LIBRARY OSGVIEWER_LIBRARY OSGTEXT_LIBRARY OSGGA_LIBRARY OSGSHADOW_LIBRARY CURL_LIBRARY GDAL_LIBRARY OSGMANIPULATOR_LIBRARY SSL_EAY_RELEASE LIB_EAY_RELEASE TIFF_LIBRARY PROJ4_LIBRARY PNG_LIBRARY JPEG_LIBRARY) -+ LINK_WITH_VARIABLES(${LIB_NAME} OSGSIM_LIBRARY OSGVIEWER_LIBRARY OSGTEXT_LIBRARY OSGDB_LIBRARY OSGGA_LIBRARY OSGSHADOW_LIBRARY OPENTHREADS_LIBRARY OSGMANIPULATOR_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY) -+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${OSG_DEPENDS_LIBRARY} ${CURL_LIBRARY} ${GDAL_LIBRARIES} ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} ${TIFF_LIBRARY} ${PROJ4_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY}) - endif(NOT NRL_STATIC_LIBRARIES) - - LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY}) - diff --git a/ports/osgearth/fix-imgui.patch b/ports/osgearth/fix-imgui.patch deleted file mode 100644 index 495c3dff864041..00000000000000 --- a/ports/osgearth/fix-imgui.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 2aa1535341c9aace4a5ca0115fa51dbf76f582ec Mon Sep 17 00:00:00 2001 -From: Ankur Verma -Date: Wed, 29 Sep 2021 23:12:52 -0700 -Subject: [PATCH] patch - ---- - src/applications/osgearth_imgui/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/applications/osgearth_imgui/CMakeLists.txt b/src/applications/osgearth_imgui/CMakeLists.txt -index 246fd89..5ea6f63 100644 ---- a/src/applications/osgearth_imgui/CMakeLists.txt -+++ b/src/applications/osgearth_imgui/CMakeLists.txt -@@ -1,3 +1,3 @@ --set(TARGET_LIBRARIES_VARS OSG_LIBRARY OSGDB_LIBRARY OSGUTIL_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) -+set(TARGET_LIBRARIES_VARS OSGDB_LIBRARY OSGUTIL_LIBRARY OSG_LIBRARY OSGVIEWER_LIBRARY OPENTHREADS_LIBRARY) - set(TARGET_SRC osgearth_imgui.cpp) - SETUP_IMGUI_APPLICATION(osgearth_imgui) --- -2.31.1 - diff --git a/ports/osgearth/link-libraries.patch b/ports/osgearth/link-libraries.patch new file mode 100644 index 00000000000000..19f34fb18c2b23 --- /dev/null +++ b/ports/osgearth/link-libraries.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeModules/OsgEarthMacroUtils.cmake b/CMakeModules/OsgEarthMacroUtils.cmake +index 7dd0998..730af85 100644 +--- a/CMakeModules/OsgEarthMacroUtils.cmake ++++ b/CMakeModules/OsgEarthMacroUtils.cmake +@@ -92,6 +92,11 @@ ENDMACRO(DETECT_OSG_VERSION) + + MACRO(LINK_WITH_VARIABLES TRGTNAME) + FOREACH(varname ${ARGN}) ++ string(REPLACE "_LIBRARY" "_LIBRARIES" lwv_libraries "${varname}") ++ if(DEFINED ${lwv_libraries}) ++ TARGET_LINK_LIBRARIES(${TRGTNAME} ${${lwv_libraries}}) ++ continue() ++ endif() + IF(${varname}_DEBUG) + IF(${varname}_RELEASE) + TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}_RELEASE}" debug "${${varname}_DEBUG}") diff --git a/ports/osgearth/osgearth-library-static.patch b/ports/osgearth/osgearth-library-static.patch new file mode 100644 index 00000000000000..9d0244a20e05ec --- /dev/null +++ b/ports/osgearth/osgearth-library-static.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 049e37e..d75a3b9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -264,6 +264,7 @@ ELSE() + SET(OSGEARTH_DYNAMIC_OR_STATIC "SHARED") + ELSE() + SET(OSGEARTH_DYNAMIC_OR_STATIC "STATIC") ++ ADD_DEFINITIONS(-DOSGEARTH_LIBRARY_STATIC) + ENDIF() + + diff --git a/ports/osgearth/portfile.cmake b/ports/osgearth/portfile.cmake index edc87e6eb42458..de6e99eaf32959 100644 --- a/ports/osgearth/portfile.cmake +++ b/ports/osgearth/portfile.cmake @@ -1,13 +1,3 @@ -# Only dynamic build need dlls -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(GLOB OSG_PLUGINS_SUBDIR "${CURRENT_INSTALLED_DIR}/tools/osg/osgPlugins-*") - list(LENGTH OSG_PLUGINS_SUBDIR OSG_PLUGINS_SUBDIR_LENGTH) - if(NOT OSG_PLUGINS_SUBDIR_LENGTH EQUAL 1) - message(FATAL_ERROR "Could not determine osg version") - endif() - string(REPLACE "${CURRENT_INSTALLED_DIR}/tools/osg/" "" OSG_PLUGINS_SUBDIR "${OSG_PLUGINS_SUBDIR}") -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO gwaldron/osgearth @@ -15,33 +5,38 @@ vcpkg_from_github( SHA512 f922e8bbb041a498e948587f03e8dc8a07b92e641f38d50a8eafb8b3ce1e0c92bb1ee01360d57e794429912734b60cf05ba143445a442bc95af39e3dd9fc3670 HEAD_REF master PATCHES - StaticOSG.patch # Fix port compilation in static-md module - make-all-find-packages-required.patch - fix-dependency-osg.patch + osgearth-library-static.patch + link-libraries.patch + use-unofficial-osg-config.patch + find-package.patch remove-tool-debug-suffix.patch - fix-imgui.patch fix-gcc11-compilation.patch blend2d-fix.patch ) -# Upstream bug, see https://github.com/gwaldron/osgearth/issues/1002 -file(REMOVE "${SOURCE_PATH}/src/osgEarth/tinyxml.h") +file(REMOVE + "${SOURCE_PATH}/CMakeModule/FindGEOS.cmake" + "${SOURCE_PATH}/CMakeModule/FindLibZip.cmake" + "${SOURCE_PATH}/CMakeModule/FindOSG.cmake" + "${SOURCE_PATH}/CMakeModule/FindSqlite3.cmake" + "${SOURCE_PATH}/CMakeModule/FindWEBP.cmake" + "${SOURCE_PATH}/src/osgEarth/tinyxml.h" # https://github.com/gwaldron/osgearth/issues/1002 +) -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - tools OSGEARTH_BUILD_TOOLS + FEATURES + tools OSGEARTH_BUILD_TOOLS + blend2d CMAKE_REQUIRE_FIND_PACKAGE_BLEND2D ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" - OPTIONS ${FEATURE_OPTIONS} + OPTIONS + ${FEATURE_OPTIONS} + -DLIB_POSTFIX= -DOSGEARTH_BUILD_SHARED_LIBS=${BUILD_SHARED} - -DNRL_STATIC_LIBRARIES=${BUILD_STATIC} - -DOSG_IS_STATIC=${BUILD_STATIC} - -DGEOS_IS_STATIC=${BUILD_STATIC} - -DCURL_IS_STATIC=${BUILD_STATIC} -DOSGEARTH_BUILD_EXAMPLES=OFF -DOSGEARTH_BUILD_TESTS=OFF -DOSGEARTH_BUILD_DOCS=OFF @@ -49,35 +44,44 @@ vcpkg_cmake_configure( -DOSGEARTH_BUILD_TRITON_NODEKIT=OFF -DOSGEARTH_BUILD_SILVERLINING_NODEKIT=OFF -DWITH_EXTERNAL_TINYXML=ON + -DCMAKE_JOB_POOL_LINK=console # Serialize linking to avoid OOM + OPTIONS_DEBUG + -DOSGEARTH_BUILD_TOOLS=OFF ) vcpkg_cmake_install() -if (WIN32 AND (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")) - #Release - set(OSGEARTH_TOOL_PATH "${CURRENT_PACKAGES_DIR}/tools/${PORT}") - set(OSGEARTH_TOOL_PLUGIN_PATH "${OSGEARTH_TOOL_PATH}/${OSG_PLUGINS_SUBDIR}") - - file(MAKE_DIRECTORY "${OSGEARTH_TOOL_PLUGIN_PATH}") - file(GLOB OSGDB_PLUGINS "${CURRENT_PACKAGES_DIR}/bin/${OSG_PLUGINS_SUBDIR}/osgdb*.dll") - - file(COPY ${OSGDB_PLUGINS} DESTINATION "${OSGEARTH_TOOL_PLUGIN_PATH}") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/${OSG_PLUGINS_SUBDIR}") - - #Debug - set(OSGEARTH_DEBUG_TOOL_PATH "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}") - set(OSGEARTH_DEBUG_TOOL_PLUGIN_PATH "${OSGEARTH_DEBUG_TOOL_PATH}/${OSG_PLUGINS_SUBDIR}") - - file(MAKE_DIRECTORY "${OSGEARTH_DEBUG_TOOL_PLUGIN_PATH}") - - file(GLOB OSGDB_DEBUG_PLUGINS "${CURRENT_PACKAGES_DIR}/debug/bin/${OSG_PLUGINS_SUBDIR}/osgdb*.dll") - - file(COPY ${OSGDB_DEBUG_PLUGINS} DESTINATION "${OSGEARTH_DEBUG_TOOL_PLUGIN_PATH}") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/osgEarth/Export" "defined( OSGEARTH_LIBRARY_STATIC )" "1") +endif() - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/${OSG_PLUGINS_SUBDIR}") +# Merge osgearth plugins into [/debug]/plugins/osgPlugins-${OSG_VER}, +# as a staging area for later deployment. +set(osg_plugin_pattern "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}osgdb*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(GLOB osg_plugins_subdir RELATIVE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/bin/osgPlugins-*") + list(LENGTH osg_plugins_subdir osg_plugins_subdir_LENGTH) + if(NOT osg_plugins_subdir_LENGTH EQUAL 1) + message(FATAL_ERROR "Could not determine osg plugins directory.") + endif() + file(GLOB osgearth_plugins "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osgearth_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}") + if(NOT VCPKG_BUILD_TYPE) + file(GLOB osgearth_plugins "${CURRENT_PACKAGES_DIR}/debug/bin/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osgearth_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/plugins/${osg_plugins_subdir}") + endif() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}" "${CURRENT_PACKAGES_DIR}/debug/bin/${osg_plugins_subdir}") endif() -if ("tools" IN_LIST FEATURES) +if("tools" IN_LIST FEATURES) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(GLOB osg_plugins "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osg_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${osg_plugins_subdir}") + if(NOT VCPKG_BUILD_TYPE) + file(GLOB osg_plugins "${CURRENT_PACKAGES_DIR}/debug/plugins/${osg_plugins_subdir}/${osg_plugin_pattern}") + file(INSTALL ${osg_plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/${osg_plugins_subdir}") + endif() + endif() vcpkg_copy_tools(TOOL_NAMES osgearth_3pv osgearth_atlas osgearth_boundarygen osgearth_clamp osgearth_conv osgearth_imgui osgearth_overlayviewer osgearth_tfs osgearth_toc osgearth_version osgearth_viewer AUTO_CLEAN diff --git a/ports/osgearth/use-unofficial-osg-config.patch b/ports/osgearth/use-unofficial-osg-config.patch new file mode 100644 index 00000000000000..6a770a0190d2a0 --- /dev/null +++ b/ports/osgearth/use-unofficial-osg-config.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bf8971b..242f412 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -143,7 +144,19 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") + ENDIF (OSGEARTH_USE_GLES) + + # required +-find_package(OSG REQUIRED) ++find_package(OSG NAMES unofficial-osg) ++find_path(OSG_INCLUDE_DIR osg/Version) # For detecting the version and setting the plugin path ++set(OSG_INCLUDE_DIRS "") ++set(OSG_LIBRARY unofficial::osg::osg) ++set(OSGUTIL_LIBRARY unofficial::osg::osgUtil) ++set(OSGDB_LIBRARY unofficial::osg::osgDB) ++set(OSGTEXT_LIBRARY unofficial::osg::osgText) ++set(OSGSIM_LIBRARY unofficial::osg::osgSim) ++set(OSGVIEWER_LIBRARY unofficial::osg::osgViewer) ++set(OSGGA_LIBRARY unofficial::osg::osgViewer) ++set(OSGSHADOW_LIBRARY unofficial::osg::osgShadow) ++set(OSGMANIPULATOR_LIBRARY unofficial::osg::osgManipulator) ++set(OPENTHREADS_LIBRARY unofficial::osg::OpenThreads) + find_package(CURL REQUIRED) + find_package(GDAL REQUIRED) + diff --git a/ports/osgearth/vcpkg.json b/ports/osgearth/vcpkg.json index 558f4e6e447aa4..7bf7707c0546eb 100644 --- a/ports/osgearth/vcpkg.json +++ b/ports/osgearth/vcpkg.json @@ -1,13 +1,12 @@ { "name": "osgearth", "version": "3.2", - "port-version": 5, + "port-version": 6, "description": "osgEarth - Dynamic map generation toolkit for OpenSceneGraph Copyright 2021 Pelican Mapping.", "homepage": "https://github.com/gwaldron/osgearth", "supports": "!(x86 | wasm32)", "dependencies": [ "basisu", - "blend2d", "cfitsio", "draco", "geos", @@ -17,6 +16,7 @@ "opengl", { "name": "osg", + "default-features": false, "features": [ "plugins" ] @@ -31,9 +31,28 @@ } ], "default-features": [ - "tools" + "default-features" ], "features": { + "blend2d": { + "description": "Enable Blend2D support", + "dependencies": [ + "blend2d" + ] + }, + "default-features": { + "description": "Platform-dependent default features", + "dependencies": [ + { + "name": "osgearth", + "default-features": false, + "features": [ + "blend2d" + ], + "platform": "!arm & !uwp & !wasm32" + } + ] + }, "tools": { "description": "Build tools" } diff --git a/versions/baseline.json b/versions/baseline.json index 17f604404b049f..19b46e2dd434a0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5262,7 +5262,7 @@ }, "osg": { "baseline": "3.6.5", - "port-version": 12 + "port-version": 13 }, "osg-qt": { "baseline": "Qt5", @@ -5270,7 +5270,7 @@ }, "osgearth": { "baseline": "3.2", - "port-version": 5 + "port-version": 6 }, "osi": { "baseline": "0.108.6", diff --git a/versions/o-/osg.json b/versions/o-/osg.json index a90a66ae2681bb..a5f9145b0f02bc 100644 --- a/versions/o-/osg.json +++ b/versions/o-/osg.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "fa03ab64f6d05d837a9ce14419d03b36cc8796ea", + "version": "3.6.5", + "port-version": 13 + }, { "git-tree": "f438ec006b58ffd222b0f3bdce8d05b21611204e", "version": "3.6.5", diff --git a/versions/o-/osgearth.json b/versions/o-/osgearth.json index ef767931f59e48..c758d6afe53751 100644 --- a/versions/o-/osgearth.json +++ b/versions/o-/osgearth.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8445895488485c8931b96483e6da43969260855a", + "version": "3.2", + "port-version": 6 + }, { "git-tree": "80311fbaa014b84f8cdb3faa8abbdc16e01837d5", "version": "3.2",