aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>2020-02-14 09:53:23 +0800
committerGitHub <noreply@github.com>2020-02-13 17:53:23 -0800
commitad69a7fc8ee9324b95105cbfd89f2a615ad570af (patch)
treec0fdba243bc4b23065c16e7e960a2c8f0c6ea6aa
parent375ea0ec6b9df9a82704f01c3afc1bf3d00b618b (diff)
downloadvcpkg-ad69a7fc8ee9324b95105cbfd89f2a615ad570af.tar.gz
vcpkg-ad69a7fc8ee9324b95105cbfd89f2a615ad570af.zip
[osg]Fix windows-dynamic/linux build. (#8060)
* [osg]Fix dynamic build. * [sdl1]Fix linux command. * [osg]Fix linux build: disable present3D and osgstaticview. * [osg]fix windows build-only for windows. * [osg]Fix file INSTALL error. * [osg]Add dependency conditions. * [osg]disable OSG_USE_UTF8_FILENAME in Linux and OSX. * [osg]Fix find dependency curl. Replace version num by macro. * [osg]Add option CMAKE_CXX_STANDARD * [osg] Remove library prefix. * [osg] Fix install pdbs * [osg] Remove usless plugin libs. * update baseline * update baseline * update baseline * update baseline
-rw-r--r--ports/osg/CONTROL2
-rw-r--r--ports/osg/disable-present3d-staticview-in-linux.patch36
-rw-r--r--ports/osg/fix-builderror-with-libtiff.patch26
-rw-r--r--ports/osg/fix-curl.patch18
-rw-r--r--ports/osg/fix-example-application.patch34
-rw-r--r--ports/osg/fix-sdl.patch38
-rw-r--r--ports/osg/portfile.cmake63
-rw-r--r--ports/osg/remove-prefix.patch35
-rw-r--r--scripts/ci.baseline.txt8
9 files changed, 238 insertions, 22 deletions
diff --git a/ports/osg/CONTROL b/ports/osg/CONTROL
index 8df250d7c..b958ad092 100644
--- a/ports/osg/CONTROL
+++ b/ports/osg/CONTROL
@@ -2,7 +2,7 @@ Source: osg
Version: 3.6.4-1
Homepage: https://github.com/openscenegraph/OpenSceneGraph
Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit.
-Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff, fontconfig, sdl2, boost-asio (!windows), libxml2 (windows), giflib (windows), freeglut (windows)
+Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff, fontconfig, sdl2, boost-asio (!windows), libxml2 (windows), giflib (windows), freeglut (windows), expat (windows), libiconv (windows)
Feature: collada
Description: Support for Collada (.dae) files
diff --git a/ports/osg/disable-present3d-staticview-in-linux.patch b/ports/osg/disable-present3d-staticview-in-linux.patch
new file mode 100644
index 000000000..fd76db35b
--- /dev/null
+++ b/ports/osg/disable-present3d-staticview-in-linux.patch
@@ -0,0 +1,36 @@
+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-builderror-with-libtiff.patch b/ports/osg/fix-builderror-with-libtiff.patch
new file mode 100644
index 000000000..d3a938e42
--- /dev/null
+++ b/ports/osg/fix-builderror-with-libtiff.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeModules/OsgAndroidMacroUtils.cmake b/CMakeModules/OsgAndroidMacroUtils.cmake
+index 50c22e0..8e79b09 100644
+--- a/CMakeModules/OsgAndroidMacroUtils.cmake
++++ b/CMakeModules/OsgAndroidMacroUtils.cmake
+@@ -118,7 +118,7 @@ MACRO(ANDROID_3RD_PARTY)
+ #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
+ if(TIFF_INCLUDE_DIR)
+ message(STATUS "TIF found ${TIFF_INCLUDE_DIR}" )
+- set(TIFF_FOUND "Yes")
++ #set(TIFF_FOUND "Yes")
+ install(DIRECTORY 3rdparty/build/libtiff/ DESTINATION ./ )
+ else(TIFF_INCLUDE_DIR)
+ message(STATUS "TIF missing" )
+diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt
+index 77d66f8..1504bf9 100644
+--- a/src/osgPlugins/CMakeLists.txt
++++ b/src/osgPlugins/CMakeLists.txt
+@@ -115,7 +115,7 @@ IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
+ ADD_PLUGIN_DIRECTORY(png)
+ ENDIF()
+ IF(TIFF_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
+- ADD_PLUGIN_DIRECTORY(tiff)
++ #ADD_PLUGIN_DIRECTORY(tiff)
+ ENDIF()
+ IF(GDAL_FOUND)
+ ADD_PLUGIN_DIRECTORY(gdal)
diff --git a/ports/osg/fix-curl.patch b/ports/osg/fix-curl.patch
new file mode 100644
index 000000000..e95fbee5d
--- /dev/null
+++ b/ports/osg/fix-curl.patch
@@ -0,0 +1,18 @@
+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-example-application.patch b/ports/osg/fix-example-application.patch
new file mode 100644
index 000000000..4745f8b41
--- /dev/null
+++ b/ports/osg/fix-example-application.patch
@@ -0,0 +1,34 @@
+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(unofficial-iconv CONFIG REQUIRED)
++
++ list(APPEND TARGET_EXTERNAL_LIBRARIES EXPAT::EXPAT unofficial::iconv::libiconv unofficial::iconv::libcharset)
+ 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(unofficial-iconv CONFIG REQUIRED)
++
++ list(APPEND TARGET_EXTERNAL_LIBRARIES EXPAT::EXPAT unofficial::iconv::libiconv unofficial::iconv::libcharset)
++ENDIF()
++
+ SET(TARGET_SRC osgstaticviewer.cpp )
+ #### end var setup ###
+ SETUP_EXAMPLE(osgstaticviewer)
diff --git a/ports/osg/fix-sdl.patch b/ports/osg/fix-sdl.patch
new file mode 100644
index 000000000..fa092c784
--- /dev/null
+++ b/ports/osg/fix-sdl.patch
@@ -0,0 +1,38 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 81328ea..2566b48 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -755,8 +755,6 @@ 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,11 @@ ELSE()
+ FIND_PACKAGE(Lua51)
+ ENDIF()
+ ENDIF()
++
++ find_package(SDL)
++ if (NOT SDL_FOUND)
++ find_package(SDL2)
++ endif()
+
+ # V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
+ # FIND_PACKAGE(V8)
+diff --git a/examples/osgmovie/osgmovie.cpp b/examples/osgmovie/osgmovie.cpp
+index 9de15b1..ae96e11 100644
+--- a/examples/osgmovie/osgmovie.cpp
++++ b/examples/osgmovie/osgmovie.cpp
+@@ -691,7 +691,7 @@ int main(int argc, char** argv)
+
+ #if USE_SDL || USE_SDL2
+
+-#include "SDL.h"
++#include <SDL/SDL.h>
+
+ static void soundReadCallback(void * user_data, uint8_t * data, int datalen)
+ {
diff --git a/ports/osg/portfile.cmake b/ports/osg/portfile.cmake
index 03520aa9b..a4e3d7b73 100644
--- a/ports/osg/portfile.cmake
+++ b/ports/osg/portfile.cmake
@@ -1,15 +1,19 @@
-include(vcpkg_common_functions)
-
-vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
+set(OSG_VER 3.6.4)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openscenegraph/OpenSceneGraph
- REF OpenSceneGraph-3.6.4
+ REF OpenSceneGraph-${OSG_VER}
SHA512 7cb34fc279ba62a7d7177d3f065f845c28255688bd29026ffb305346e1bb2e515a22144df233e8a7246ed392044ee3e8b74e51bf655282d33ab27dcaf12f4b19
HEAD_REF master
PATCHES
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
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
@@ -17,8 +21,16 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
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)
@@ -33,33 +45,44 @@ list(APPEND OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_LIBLAS=ON)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DOSG_USE_UTF8_FILENAME=ON
+ -DOSG_USE_UTF8_FILENAME=${OSG_USE_UTF8_FILENAME}
+ -DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC}
+ -DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC}
+ -DBUILD_OSG_PLUGINS=ON # it should always be ON due to osgerath need this
+ -DBUILD_OSG_EXAMPLES=ON
+ -DBUILD_OSG_APPLICATIONS=ON
+ -DCMAKE_CXX_STANDARD=11
)
vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
# handle osg tools and plugins
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-set(OSG_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/osg)
+set(OSG_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/${PORT})
file(MAKE_DIRECTORY ${OSG_TOOL_PATH})
-file(GLOB OSG_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
+file(GLOB OSG_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(COPY ${OSG_TOOLS} DESTINATION ${OSG_TOOL_PATH})
file(REMOVE_RECURSE ${OSG_TOOLS})
-file(GLOB OSG_TOOLS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
+file(GLOB OSG_TOOLS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(REMOVE_RECURSE ${OSG_TOOLS_DBG})
-file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.4/*.dll)
-file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/osg/osgPlugins-3.6.4)
-file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.4/*.dll)
-file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-3.6.4)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.4/)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.4/)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX})
+ file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}/osgPlugins-${OSG_VER})
+ file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX})
+ file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-${OSG_VER})
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-${OSG_VER}/ ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-${OSG_VER}/)
+endif()
-# 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)
+file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/lib/osgPlugins-${OSG_VER}/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX})
+file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}/osgPlugins-${OSG_VER})
+file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/lib/osgPlugins-${OSG_VER}/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX})
+file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-${OSG_VER})
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/osgPlugins-${OSG_VER}/ ${CURRENT_PACKAGES_DIR}/debug/lib/osgPlugins-${OSG_VER}/)
#Cleanup
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
@@ -67,4 +90,8 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
-endif() \ No newline at end of file
+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) \ No newline at end of file
diff --git a/ports/osg/remove-prefix.patch b/ports/osg/remove-prefix.patch
new file mode 100644
index 000000000..62b1466c9
--- /dev/null
+++ b/ports/osg/remove-prefix.patch
@@ -0,0 +1,35 @@
+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()
+
+@@ -33,7 +33,7 @@ INSTALL(
+ )
+
+ IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
+- GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
++ set(PREFIX "")
+ INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
+ INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
+ ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
+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/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index e85acfcc7..b221eef53 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -1327,9 +1327,11 @@ opusfile:x64-uwp=fail
orc:x64-linux=ignore
orocos-kdl:arm-uwp=fail
orocos-kdl:x64-uwp=fail
-osg:x64-linux=fail
-osg:x64-osx=fail
-osg:x64-windows-static=fail
+osgearth:x64-osx=fail
+osgearth:x64-linux=fail
+osgearth:x64-windows-static=fail
+osg-qt:x64-linux=fail
+osg-qt:x64-windows-static=fail
otl:x64-windows=ignore
otl:x64-windows-static=ignore
otl:x64-uwp=ignore