Skip to content

Commit

Permalink
[osg] Add feature examples and plugins, fix configure options (#10082)
Browse files Browse the repository at this point in the history
* [osg] Add feature examples and plugins, fix configure options

* [osg] Add feature tools, packages and docs

* [osgearth] Set dependency to osg[plugins]

* [osgearth] bump version

* [osg] Fix dependency

* [osg] Remove feature plugins dependency nvtt

* [osg] Remove empty folder

* [osg] Fix dependency sdl and liblas

* [osg] Fix install issue

* [osg] Fix dependency nvtt

* [osg] Re-fix dependency nvtt

* [osg] Fix judgment when selecting nvtt

* [osg] Create tools folder based on conditions

* [osg] Fix typo

* update baseline

* re-trigger ci test

* re-trigger ci test
  • Loading branch information
JackBoosY committed Apr 16, 2020
1 parent 29c933d commit b12256a
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 28 deletions.
22 changes: 20 additions & 2 deletions ports/osg/CONTROL
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
Source: osg
Version: 3.6.4-1
Version: 3.6.4-2
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), expat (windows), libiconv (windows)
Build-Depends: zlib, fontconfig, boost-asio (!windows), freeglut (windows), expat (windows), openimageio (osx)

Feature: collada
Description: Support for Collada (.dae) files
Build-Depends: collada-dom

Feature: tools
Description: Enable to build OSG Applications (e.g. osgviewer)
Build-Depends: freetype, sdl1, curl, libjpeg-turbo, libpng, libiconv (windows)

Feature: examples
Description: Enable to build OSG Examples
Build-Depends: freetype, sdl1, sdl2, libiconv (windows)

Feature: plugins
Description: Build OSG Plugins - Disable for compile testing examples on a time limit
Build-Depends: freetype, sdl1, curl, openexr, ilmbase, gdal, giflib (windows), jasper, libjpeg-turbo, libpng, tiff, libxml2 (windows), libiconv (windows), libgta, liblas, nvtt

Feature: packages
Description: Set to ON to generate CPack configuration files and packaging targets

Feature: docs
Description: Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads
16 changes: 16 additions & 0 deletions ports/osg/fix-liblas.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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)
14 changes: 14 additions & 0 deletions ports/osg/fix-nvtt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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()
9 changes: 4 additions & 5 deletions ports/osg/fix-sdl.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81328ea..2566b48 100644
index 81328ea..c735419 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -755,8 +755,6 @@ ELSE()
Expand All @@ -11,15 +11,14 @@ index 81328ea..2566b48 100644
FIND_PACKAGE(Poppler-glib)
FIND_PACKAGE(RSVG)
FIND_PACKAGE(GtkGl)
@@ -775,6 +773,11 @@ ELSE()
@@ -775,6 +773,10 @@ ELSE()
FIND_PACKAGE(Lua51)
ENDIF()
ENDIF()
+
+ find_package(SDL)
+ if (NOT SDL_FOUND)
+ find_package(SDL2)
+ endif()
+ 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)
Expand Down
78 changes: 59 additions & 19 deletions ports/osg/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ vcpkg_from_github(
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
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
Expand Down Expand Up @@ -42,16 +44,32 @@ 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)

# 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})

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
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
OPTIONS ${FEATURE_OPTIONS}
-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
-DBUILD_DASHBOARD_REPORTS=OFF
-DCMAKE_CXX_STANDARD=11
${OPTIONS}
)

vcpkg_install_cmake()
Expand All @@ -62,31 +80,53 @@ vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

set(OSG_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/${PORT})
file(MAKE_DIRECTORY ${OSG_TOOL_PATH})

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/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(REMOVE_RECURSE ${OSG_TOOLS_DBG})
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()


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(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}/)
endif()

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}/)
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}/)

#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)
Expand Down
4 changes: 2 additions & 2 deletions ports/osgearth/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: osgearth
Version: 2.10.2
Version: 2.10.2-1
Description: osgEarth - Dynamic map generation toolkit for OpenSceneGraph Copyright 2015 Pelican Mapping.
Build-Depends: osg
Build-Depends: osg[plugins]

0 comments on commit b12256a

Please sign in to comment.