mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 03:49:01 +08:00
[osg] Add Collada model support to OpenSceneGraph (#3950)
* [collada-dom] Initial collada-dom port * [osg] Add Collada file support
This commit is contained in:
parent
f5f4070c96
commit
10bde77210
4
ports/collada-dom/CONTROL
Normal file
4
ports/collada-dom/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: collada-dom
|
||||
Version: 2.5.0
|
||||
Description: The COLLADA Document Object Model (DOM) is an application programming interface (API) that provides a C++ object representation of a COLLADA XML instance document.
|
||||
Build-Depends: zlib, libxml2, minizip, pcre, uriparser, boost-filesystem, boost-system
|
27
ports/collada-dom/portfile.cmake
Normal file
27
ports/collada-dom/portfile.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/collada-dom-2.5.0)
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO rdiankov/collada-dom
|
||||
REF d37ae7532e350b87c88712e9f6ab4b1f440d20cd
|
||||
SHA512 cb923d296219765096f5246cc7a2b69712931f58171ae885dbdbd215fca86d911c34d12748d3304d6a5a350dc737ff0caead2495acac488af5431b437cbacc7d
|
||||
HEAD_REF v2.5.0
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/vs-version-detection.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-uriparser.patch"
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/collada_dom-2.5")
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/licenses/license_e.txt DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/share/collada-dom
|
||||
RENAME copyright)
|
127
ports/collada-dom/use-uriparser.patch
Normal file
127
ports/collada-dom/use-uriparser.patch
Normal file
@ -0,0 +1,127 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 3ec1527..3f044d3 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -237,23 +237,29 @@ else()
|
||||
set(MINIZIP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dom/external-libs/minizip-1.1 ${ZLIB_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
-pkg_check_modules(liburiparser liburiparser)
|
||||
-
|
||||
-if(liburiparser_FOUND)
|
||||
- set(liburiparser_CFLAGS_OTHERS "-DUSE_URIPARSER")
|
||||
+find_package(UriParser)
|
||||
+if(URIPARSER_FOUND)
|
||||
+ set(URIPARSER_CFLAGS_OTHERS "-DUSE_URIPARSER")
|
||||
+ set(URIPARSER_LIBRARIES ${URIPARSER_LIBRARY})
|
||||
+ message(STATUS "liburiparser found")
|
||||
else()
|
||||
- # try using pcrecpp
|
||||
- pkg_check_modules(libpcrecpp libpcrecpp)
|
||||
- if( libpcrecpp_FOUND )
|
||||
+ pkg_check_modules(liburiparser liburiparser)
|
||||
+ if(liburiparser_FOUND)
|
||||
+ set(URIPARSER_CFLAGS_OTHERS "-DUSE_URIPARSER")
|
||||
+ message(STATUS "liburiparser found")
|
||||
+ else()
|
||||
+ # try using pcrecpp
|
||||
+ pkg_check_modules(libpcrecpp libpcrecpp)
|
||||
+ if( libpcrecpp_FOUND )
|
||||
set(CMAKE_REQUIRED_INCLUDES ${libpcrecpp_INCLUDE_DIRS})
|
||||
check_include_file_cxx(pcrecpp.h HAVE_PCRECPP_H)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
if( NOT HAVE_PCRECPP_H )
|
||||
- set(libpcrecpp_FOUND 0)
|
||||
+ set(libpcrecpp_FOUND 0)
|
||||
+ endif()
|
||||
endif()
|
||||
- endif()
|
||||
|
||||
- if( NOT libpcrecpp_FOUND )
|
||||
+ if( NOT libpcrecpp_FOUND )
|
||||
message(STATUS "System pcre not found, using local from sources")
|
||||
# include the local pcre
|
||||
add_subdirectory(dom/external-libs/pcre-8.02)
|
||||
@@ -262,6 +268,7 @@ else()
|
||||
set(libpcrecpp_LIBRARIES pcrecpp_local)
|
||||
set(libpcrecpp_CFLAGS_OTHERS "-DPCRE_STATIC")
|
||||
set(libpcrecpp_LDFLAGS_OTHERS)
|
||||
+ endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
diff --git a/cmake-modules/FindUriParser.cmake b/cmake-modules/FindUriParser.cmake
|
||||
new file mode 100644
|
||||
index 0000000..91f466b
|
||||
--- /dev/null
|
||||
+++ b/cmake-modules/FindUriParser.cmake
|
||||
@@ -0,0 +1,35 @@
|
||||
+# Find the UriParser library
|
||||
+# Defines:
|
||||
+
|
||||
+# URIPARSER_INCLUDE_DIR - uriparser include directory
|
||||
+# URIPARSER_LIBRARY - uriparser library file
|
||||
+# URIPARSER_FOUND - TRUE if uriparser is found
|
||||
+
|
||||
+if (URIPARSER_INCLUDE_DIR)
|
||||
+ #check cache
|
||||
+ set(URIPARSER_FIND_QUIETLY TRUE)
|
||||
+endif ()
|
||||
+
|
||||
+if (NOT URIPARSER_INCLUDE_DIR)
|
||||
+ find_path(URIPARSER_INCLUDE_DIR NAMES Uri.h PATH_SUFFIXES uriparser)
|
||||
+ set(URIPARSER_INCLUDE_DIR ${URIPARSER_INCLUDE_DIR}/uriparser CACHE PATH "uriparser includes")
|
||||
+endif ()
|
||||
+
|
||||
+find_library(URIPARSER_LIBRARY NAMES uriparser)
|
||||
+
|
||||
+if (URIPARSER_INCLUDE_DIR AND URIPARSER_LIBRARY)
|
||||
+ set(URIPARSER_FOUND TRUE)
|
||||
+ set(UriParser_FOUND TRUE)
|
||||
+endif ()
|
||||
+
|
||||
+if (URIPARSER_FOUND)
|
||||
+ if (NOT URIPARSER_FIND_QUIETLY)
|
||||
+ message(STATUS "Found UriParser library: ${URIPARSER_LIBRARY}")
|
||||
+ endif ()
|
||||
+else ()
|
||||
+ if (NOT URIPARSER_FIND_QUIETLY)
|
||||
+ message(FATAL_ERROR "Could NOT find UriParser library")
|
||||
+ else ()
|
||||
+ message(STATUS "Could NOT find UriParser library")
|
||||
+ endif ()
|
||||
+endif ()
|
||||
diff --git a/dom/CMakeLists.txt b/dom/CMakeLists.txt
|
||||
index f7ffb27..62e1b8a 100644
|
||||
--- a/dom/CMakeLists.txt
|
||||
+++ b/dom/CMakeLists.txt
|
||||
@@ -1,6 +1,6 @@
|
||||
set(COLLADA_INTERNAL_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(${COLLADA_INTERNAL_INCLUDE})
|
||||
-set(COLLADA_LIBS minizip ${liburiparser_LIBRARIES} ${libpcrecpp_LIBRARIES} ${ZLIB_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
||||
+set(COLLADA_LIBS minizip ${URIPARSER_LIBRARIES} ${libpcrecpp_LIBRARIES} ${ZLIB_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
||||
|
||||
file(GLOB dae_files ${CMAKE_CURRENT_SOURCE_DIR}/src/dae/*.cpp)
|
||||
if( LIBXML2_FOUND )
|
||||
@@ -13,7 +13,7 @@ file(GLOB stddatabase_files ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/STLDatabase/
|
||||
file(GLOB stderrplugin_files ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/stdErrPlugin/*.cpp)
|
||||
|
||||
set(COLLADA_BASE_SOURCES ${dae_files} ${libxmlplugin_files} ${stddatabase_files} ${stderrplugin_files})
|
||||
-set(COLLADA_COMPILE_FLAGS "${liburiparser_CFLAGS_OTHERS} ${libpcrecpp_CFLAGS_OTHERS} ${EXTRA_COMPILE_FLAGS} ${Boost_CFLAGS}")
|
||||
+set(COLLADA_COMPILE_FLAGS "${URIPARSER_CFLAGS_OTHERS} ${libpcrecpp_CFLAGS_OTHERS} ${EXTRA_COMPILE_FLAGS} ${Boost_CFLAGS}")
|
||||
# create dynamic libraries
|
||||
set(COLLADA_COMPILE_FLAGS "${COLLADA_COMPILE_FLAGS} -DDOM_DYNAMIC -DDOM_EXPORT")
|
||||
|
||||
diff --git a/dom/src/dae/daeURI.cpp b/dom/src/dae/daeURI.cpp
|
||||
index 3a8f815..1623753 100644
|
||||
--- a/dom/src/dae/daeURI.cpp
|
||||
+++ b/dom/src/dae/daeURI.cpp
|
||||
@@ -790,7 +790,7 @@ bool cdom::parseUriRef(const string& uriRef,
|
||||
scheme = fromRange(uri.scheme);
|
||||
authority = fromRange(uri.hostText);
|
||||
path = fromList(uri.pathHead, "/");
|
||||
- if (uri.absolutePath != URI_TRUE and uri.hostText.first == NULL)
|
||||
+ if (uri.absolutePath != URI_TRUE && uri.hostText.first == NULL)
|
||||
path = path.erase(0, 1);
|
||||
query = fromRange(uri.query);
|
||||
fragment = fromRange(uri.fragment);
|
39
ports/collada-dom/vs-version-detection.patch
Normal file
39
ports/collada-dom/vs-version-detection.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2596a23..3ec1527 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required (VERSION 2.6.0)
|
||||
+cmake_minimum_required (VERSION 3.7.0)
|
||||
project (collada-dom)
|
||||
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
|
||||
|
||||
@@ -89,14 +89,22 @@ string(TOUPPER ${COMPONENT_PREFIX} COMPONENT_PREFIX_UPPER)
|
||||
set(CPACK_COMPONENTS_ALL ${COMPONENT_PREFIX}-base ${COMPONENT_PREFIX}-dev)
|
||||
|
||||
if( MSVC )
|
||||
- if( MSVC70 OR MSVC71 )
|
||||
- set(MSVC_PREFIX "vc70")
|
||||
- elseif( MSVC80 )
|
||||
- set(MSVC_PREFIX "vc80")
|
||||
- elseif( MSVC90 )
|
||||
+ if( MSVC_VERSION GREATER_EQUAL 1910 )
|
||||
+ set(MSVC_PREFIX "vc140")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1900 )
|
||||
+ set(MSVC_PREFIX "vc130")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1800 )
|
||||
+ set(MSVC_PREFIX "vc120")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1700 )
|
||||
+ set(MSVC_PREFIX "vc110")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1600 )
|
||||
+ set(MSVC_PREFIX "vc100")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1500 )
|
||||
set(MSVC_PREFIX "vc90")
|
||||
+ elseif( MSVC_VERSION GREATER_EQUAL 1400 )
|
||||
+ set(MSVC_PREFIX "vc80")
|
||||
else()
|
||||
- set(MSVC_PREFIX "vc100")
|
||||
+ set(MSVC_PREFIX "vc70")
|
||||
endif()
|
||||
set(COLLADA_DOM_LIBRARY_SUFFIX "${COLLADA_DOM_SOVERSION}-${COLLADA_PRECISION}-${MSVC_PREFIX}-mt")
|
||||
else()
|
@ -2,3 +2,7 @@ Source: osg
|
||||
Version: 3.6.2
|
||||
Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit.
|
||||
Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff
|
||||
|
||||
Feature: collada
|
||||
Description: Support for Collada (.dae) files
|
||||
Build-Depends: collada-dom
|
||||
|
76
ports/osg/collada.patch
Normal file
76
ports/osg/collada.patch
Normal file
@ -0,0 +1,76 @@
|
||||
diff --git a/CMakeModules/FindCOLLADA.cmake b/CMakeModules/FindCOLLADA.cmake
|
||||
index 8c9c2fc33..6a8ab04ca 100644
|
||||
--- a/CMakeModules/FindCOLLADA.cmake
|
||||
+++ b/CMakeModules/FindCOLLADA.cmake
|
||||
@@ -25,11 +25,11 @@ ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
SET(COLLADA_BUILDNAME "mac")
|
||||
- SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
|
||||
+ SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
|
||||
ELSEIF(MINGW)
|
||||
SET(COLLADA_BUILDNAME "mingw")
|
||||
- SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
|
||||
-ELSEIF(MSVC_VERSION EQUAL 1900 OR MSVC_VERSION EQUAL 1910 )
|
||||
+ SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
|
||||
+ELSEIF(MSVC_VERSION GREATER_EQUAL 1900 )
|
||||
SET(COLLADA_BUILDNAME "vc14")
|
||||
SET(COLLADA_BOOST_BUILDNAME "vc140")
|
||||
ELSEIF(MSVC_VERSION EQUAL 1800)
|
||||
@@ -58,6 +58,7 @@ ENDIF()
|
||||
|
||||
|
||||
FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
||||
+ PATHS
|
||||
${COLLADA_DOM_ROOT}/include
|
||||
$ENV{COLLADA_DIR}/include
|
||||
$ENV{COLLADA_DIR}
|
||||
@@ -65,27 +66,19 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
||||
/Library/Frameworks
|
||||
/opt/local/Library/Frameworks #macports
|
||||
/usr/local/include
|
||||
- /usr/local/include/colladadom
|
||||
- /usr/local/include/collada-dom
|
||||
- /usr/local/include/collada-dom2.5
|
||||
- /usr/local/include/collada-dom2.4
|
||||
- /usr/local/include/collada-dom2.2
|
||||
- /opt/local/include/collada-dom
|
||||
- /opt/local/include/collada-dom2.5
|
||||
- /opt/local/include/collada-dom2.4
|
||||
- /opt/local/include/collada-dom2.2
|
||||
/usr/include/
|
||||
- /usr/include/colladadom
|
||||
- /usr/include/collada-dom
|
||||
- /usr/include/collada-dom2.5
|
||||
- /usr/include/collada-dom2.4
|
||||
- /usr/include/collada-dom2.2
|
||||
/sw/include # Fink
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
/usr/freeware/include
|
||||
${ACTUAL_3DPARTY_DIR}/include
|
||||
+ PATH_SUFFIXES
|
||||
+ colladadom
|
||||
+ collada-dom
|
||||
+ collada-dom2.5
|
||||
+ collada-dom2.4
|
||||
+ collada-dom2.2
|
||||
)
|
||||
|
||||
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
||||
diff --git a/src/osgPlugins/dae/CMakeLists.txt b/src/osgPlugins/dae/CMakeLists.txt
|
||||
index af03fb866..7eadfc2f3 100644
|
||||
--- a/src/osgPlugins/dae/CMakeLists.txt
|
||||
+++ b/src/osgPlugins/dae/CMakeLists.txt
|
||||
@@ -49,7 +49,9 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-DNO_BOOST)
|
||||
-ADD_DEFINITIONS(-DCOLLADA_DOM_SUPPORT141)
|
||||
+ADD_DEFINITIONS(-DCOLLADA_DOM_USING_141
|
||||
+ -DCOLLADA_DOM_SUPPORT141
|
||||
+ -DCOLLADA_DOM_SUPPORT150)
|
||||
|
||||
IF (COLLADA_DOM_2_4_OR_LATER)
|
||||
ADD_DEFINITIONS(-DCOLLADA_DOM_2_4_OR_LATER)
|
@ -22,6 +22,8 @@ vcpkg_from_github(
|
||||
REF OpenSceneGraph-3.6.2
|
||||
SHA512 6949dd4dea9dcffe4228086b72eafdb253bf1403b3b7a70a4727848c3cde23ad0270f41b1c3e2bdbfd410ec067ecce2052a5d26c61b032b6d46ce84b8c931bfb
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/collada.patch"
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
|
Loading…
Reference in New Issue
Block a user