|
|
8c9df41 |
From a52bb1d9b030ee888ab44b8ad9a2a2b8ebb909a3 Mon Sep 17 00:00:00 2001
|
|
|
8c9df41 |
From: Helio Chissini de Castro <helio@kde.org>
|
|
|
8c9df41 |
Date: Thu, 27 Apr 2017 17:19:51 +0200
|
|
|
8c9df41 |
Subject: [PATCH] - Apply mechanism to decide use for IrrXML external or
|
|
|
8c9df41 |
internal
|
|
|
8c9df41 |
|
|
|
8c9df41 |
Several distributions usually decide for shared external libraries
|
|
|
8c9df41 |
instead of an usual embedded, for security reasons, duplicatiion issues.
|
|
|
8c9df41 |
This change enable the possibility to set SYSTEM_IRRXML=ON for detect
|
|
|
8c9df41 |
and build against a system installed irrxml.
|
|
|
8c9df41 |
By default, the internal copy is compiled.
|
|
|
8c9df41 |
|
|
|
8c9df41 |
Changes on build:
|
|
|
8c9df41 |
- Added a FindIrrXML cmake module.
|
|
|
8c9df41 |
- Moved the source recipe for proper CMakeLists inside contrib directory
|
|
|
8c9df41 |
- Includes aren't path based anymore, using the provided INCLUDE_DIR
|
|
|
8c9df41 |
- Compiler option are grouped in a singled entry on main CMakeLists
|
|
|
8c9df41 |
---
|
|
|
8c9df41 |
CMakeLists.txt | 88 +++++++++++++++++++++++++++++++++++-------
|
|
|
8c9df41 |
cmake-modules/FindIrrXML.cmake | 17 ++++++++
|
|
|
8c9df41 |
code/CMakeLists.txt | 20 +++-------
|
|
|
8c9df41 |
code/irrXMLWrapper.h | 6 +--
|
|
|
8c9df41 |
contrib/CMakeLists.txt | 4 ++
|
|
|
8c9df41 |
contrib/irrXML/CMakeLists.txt | 13 +++++++
|
|
|
8c9df41 |
6 files changed, 116 insertions(+), 32 deletions(-)
|
|
|
8c9df41 |
create mode 100644 cmake-modules/FindIrrXML.cmake
|
|
|
8c9df41 |
create mode 100644 contrib/CMakeLists.txt
|
|
|
8c9df41 |
create mode 100644 contrib/irrXML/CMakeLists.txt
|
|
|
8c9df41 |
|
|
|
8c9df41 |
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
|
8c9df41 |
index 6989510..c2b3faa 100644
|
|
|
8c9df41 |
--- a/CMakeLists.txt
|
|
|
8c9df41 |
+++ b/CMakeLists.txt
|
|
|
8c9df41 |
@@ -39,7 +39,65 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
|
|
|
8c9df41 |
cmake_minimum_required( VERSION 2.8 )
|
|
|
8c9df41 |
PROJECT( Assimp )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
|
|
|
8c9df41 |
+# All supported options ###############################################
|
|
|
8c9df41 |
+OPTION( BUILD_SHARED_LIBS
|
|
|
8c9df41 |
+ "Build package with shared libraries."
|
|
|
8c9df41 |
+ ON
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION( ASSIMP_DOUBLE_PRECISION
|
|
|
8c9df41 |
+ "Set to ON to enable double precision processing"
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION( ASSIMP_OPT_BUILD_PACKAGES
|
|
|
8c9df41 |
+ "Set to ON to generate CPack configuration files and packaging targets"
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION( ASSIMP_ANDROID_JNIIOSYSTEM
|
|
|
8c9df41 |
+ "Android JNI IOSystem support is active"
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION( ASSIMP_NO_EXPORT
|
|
|
8c9df41 |
+ "Disable Assimp's export functionality."
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION( ASSIMP_BUILD_ZLIB
|
|
|
8c9df41 |
+ "Build your own zlib"
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+option( ASSIMP_BUILD_ASSIMP_TOOLS
|
|
|
8c9df41 |
+ "If the supplementary tools for Assimp are built in addition to the library."
|
|
|
8c9df41 |
+ ON
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+option ( ASSIMP_BUILD_SAMPLES
|
|
|
8c9df41 |
+ "If the official samples are built as well (needs Glut)."
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION ( ASSIMP_BUILD_TESTS
|
|
|
8c9df41 |
+ "If the test suite for Assimp is built in addition to the library."
|
|
|
8c9df41 |
+ ON
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+OPTION ( ASSIMP_COVERALLS
|
|
|
8c9df41 |
+ "EaĆable this to measure test coverage."
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+option ( SYSTEM_IRRXML
|
|
|
8c9df41 |
+ "Use system installed Irrlicht/IrrXML library."
|
|
|
8c9df41 |
+ OFF
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+#OPTION ( BUILD_DOCS
|
|
|
8c9df41 |
+# "Build documentation using Doxygen."
|
|
|
8c9df41 |
+# OFF
|
|
|
8c9df41 |
+#)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+IF(MSVC)
|
|
|
8c9df41 |
+ set (CMAKE_PREFIX_PATH "D:\\libs\\devil")
|
|
|
8c9df41 |
+ OPTION( ASSIMP_INSTALL_PDB
|
|
|
8c9df41 |
+ "Install MSVC debug files."
|
|
|
8c9df41 |
+ ON
|
|
|
8c9df41 |
+ )
|
|
|
8c9df41 |
+ENDIF(MSVC)
|
|
|
8c9df41 |
|
|
|
8c9df41 |
IF(NOT BUILD_SHARED_LIBS)
|
|
|
8c9df41 |
SET(LINK_SEARCH_START_STATIC TRUE)
|
|
|
ebb3df7 |
@@ -116,17 +174,17 @@ IF( UNIX )
|
|
|
8c9df41 |
include(GNUInstallDirs)
|
|
|
8c9df41 |
ENDIF( UNIX )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
|
|
|
8c9df41 |
- IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit
|
|
|
8c9df41 |
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
8c9df41 |
- ENDIF()
|
|
|
8c9df41 |
+# Grouped compiler settings
|
|
|
8c9df41 |
+IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
|
|
8c9df41 |
# hide all not-exported symbols
|
|
|
8c9df41 |
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" )
|
|
|
8c9df41 |
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -std=c++0x" )
|
|
|
8c9df41 |
+ SET(LIBSTDC++_LIBRARIES -lstdc++)
|
|
|
ebb3df7 |
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
|
|
|
8c9df41 |
ELSEIF(MSVC)
|
|
|
8c9df41 |
# enable multi-core compilation with MSVC
|
|
|
8c9df41 |
add_compile_options(/MP)
|
|
|
8c9df41 |
-ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
|
|
8c9df41 |
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
|
|
8c9df41 |
+ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
|
|
8c9df41 |
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -pedantic -std=c++11" )
|
|
|
8c9df41 |
ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
|
|
8c9df41 |
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
|
|
8c9df41 |
ENDIF()
|
|
|
8c9df41 |
@@ -176,14 +233,14 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C
|
|
|
8c9df41 |
|
|
|
8c9df41 |
FIND_PACKAGE( DirectX )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-OPTION ( ASSIMP_NO_EXPORT
|
|
|
8c9df41 |
- "Disable Assimp's export functionality."
|
|
|
8c9df41 |
- OFF
|
|
|
8c9df41 |
-)
|
|
|
8c9df41 |
+#IF( BUILD_DOCS )
|
|
|
8c9df41 |
+# add_subdirectory(doc)
|
|
|
8c9df41 |
+#ENDIF( BUILD_DOCS )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-IF( CMAKE_COMPILER_IS_GNUCXX )
|
|
|
8c9df41 |
- SET(LIBSTDC++_LIBRARIES -lstdc++)
|
|
|
8c9df41 |
-ENDIF( CMAKE_COMPILER_IS_GNUCXX )
|
|
|
8c9df41 |
+# Look for system installed irrXML
|
|
|
8c9df41 |
+IF ( SYSTEM_IRRXML )
|
|
|
8c9df41 |
+ find_package( IrrXML REQUIRED )
|
|
|
8c9df41 |
+ENDIF( SYSTEM_IRRXML )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
# Search for external dependencies, and build them from source if not found
|
|
|
8c9df41 |
# Search for zlib
|
|
|
8c9df41 |
@@ -287,6 +344,7 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|
|
8c9df41 |
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
|
|
8c9df41 |
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|
|
8c9df41 |
|
|
|
8c9df41 |
+ADD_SUBDIRECTORY(contrib)
|
|
|
8c9df41 |
|
|
|
8c9df41 |
ADD_SUBDIRECTORY( code/ )
|
|
|
8c9df41 |
option ( ASSIMP_BUILD_ASSIMP_TOOLS
|
|
|
8c9df41 |
diff --git a/cmake-modules/FindIrrXML.cmake b/cmake-modules/FindIrrXML.cmake
|
|
|
8c9df41 |
new file mode 100644
|
|
|
8c9df41 |
index 0000000..5434e0b
|
|
|
8c9df41 |
--- /dev/null
|
|
|
8c9df41 |
+++ b/cmake-modules/FindIrrXML.cmake
|
|
|
8c9df41 |
@@ -0,0 +1,17 @@
|
|
|
8c9df41 |
+# Find IrrXMl from irrlicht project
|
|
|
8c9df41 |
+#
|
|
|
8c9df41 |
+# Find LibIrrXML headers and library
|
|
|
8c9df41 |
+#
|
|
|
8c9df41 |
+# IRRXML_FOUND - IrrXML found
|
|
|
8c9df41 |
+# IRRXML_INCLUDE_DIR - Headers location
|
|
|
8c9df41 |
+# IRRXML_LIBRARY - IrrXML main library
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+find_path(IRRXML_INCLUDE_DIR irrXML.h
|
|
|
8c9df41 |
+ PATH_SUFFIXES include/irrlicht include/irrxml)
|
|
|
8c9df41 |
+find_library(IRRXML_LIBRARY IrrXML)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+include(FindPackageHandleStandardArgs)
|
|
|
8c9df41 |
+find_package_handle_standard_args(IrrXML REQUIRED_VARS IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+mark_as_advanced(IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
|
|
8c9df41 |
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
|
|
|
8c9df41 |
index 35ecf50..52073d1 100644
|
|
|
8c9df41 |
--- a/code/CMakeLists.txt
|
|
|
8c9df41 |
+++ b/code/CMakeLists.txt
|
|
|
8c9df41 |
@@ -542,6 +542,9 @@ SET( PostProcessing_SRCS
|
|
|
8c9df41 |
)
|
|
|
8c9df41 |
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
|
|
|
8c9df41 |
|
|
|
8c9df41 |
+SET( IrrXML_SRCS irrXMLWrapper.h )
|
|
|
8c9df41 |
+SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
ADD_ASSIMP_IMPORTER( Q3D
|
|
|
8c9df41 |
Q3DLoader.cpp
|
|
|
8c9df41 |
Q3DLoader.h
|
|
|
8c9df41 |
@@ -637,18 +640,6 @@ SET( Extra_SRCS
|
|
|
8c9df41 |
)
|
|
|
8c9df41 |
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-SET( IrrXML_SRCS
|
|
|
8c9df41 |
- irrXMLWrapper.h
|
|
|
8c9df41 |
- ../contrib/irrXML/CXMLReaderImpl.h
|
|
|
8c9df41 |
- ../contrib/irrXML/heapsort.h
|
|
|
8c9df41 |
- ../contrib/irrXML/irrArray.h
|
|
|
8c9df41 |
- ../contrib/irrXML/irrString.h
|
|
|
8c9df41 |
- ../contrib/irrXML/irrTypes.h
|
|
|
8c9df41 |
- ../contrib/irrXML/irrXML.cpp
|
|
|
8c9df41 |
- ../contrib/irrXML/irrXML.h
|
|
|
8c9df41 |
-)
|
|
|
8c9df41 |
-SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
|
|
8c9df41 |
-
|
|
|
8c9df41 |
SET( ConvertUTF_SRCS
|
|
|
8c9df41 |
../contrib/ConvertUTF/ConvertUTF.h
|
|
|
8c9df41 |
../contrib/ConvertUTF/ConvertUTF.c
|
|
|
8c9df41 |
@@ -756,7 +747,8 @@ SET( assimp_src
|
|
|
8c9df41 |
ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
INCLUDE_DIRECTORIES(
|
|
|
8c9df41 |
- ../contrib/openddlparser/include
|
|
|
8c9df41 |
+ ${IRRXML_INCLUDE_DIR}
|
|
|
8c9df41 |
+ ../contrib/openddlparser/include
|
|
|
8c9df41 |
)
|
|
|
8c9df41 |
|
|
|
8c9df41 |
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|
|
8c9df41 |
@@ -766,7 +758,7 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|
|
8c9df41 |
|
|
|
8c9df41 |
ADD_LIBRARY( assimp ${assimp_src} )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
-TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} )
|
|
|
8c9df41 |
+TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
|
|
8c9df41 |
|
|
|
8c9df41 |
if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
|
|
8c9df41 |
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
|
|
|
8c9df41 |
diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h
|
|
|
8c9df41 |
index 41e4188..9d96456 100644
|
|
|
8c9df41 |
--- a/code/irrXMLWrapper.h
|
|
|
8c9df41 |
+++ b/code/irrXMLWrapper.h
|
|
|
8c9df41 |
@@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
8c9df41 |
#define INCLUDED_AI_IRRXML_WRAPPER
|
|
|
8c9df41 |
|
|
|
8c9df41 |
// some long includes ....
|
|
|
8c9df41 |
-#include "./../contrib/irrXML/irrXML.h"
|
|
|
8c9df41 |
+#include <irrXML.h>
|
|
|
8c9df41 |
#include "./../include/assimp/IOStream.hpp"
|
|
|
8c9df41 |
#include "BaseImporter.h"
|
|
|
8c9df41 |
#include <vector>
|
|
|
8c9df41 |
@@ -128,8 +128,8 @@ public:
|
|
|
8c9df41 |
|
|
|
8c9df41 |
// ----------------------------------------------------------------------------------
|
|
|
8c9df41 |
//! Returns size of file in bytes
|
|
|
8c9df41 |
- virtual int getSize() {
|
|
|
8c9df41 |
- return (int)data.size();
|
|
|
8c9df41 |
+ virtual long getSize() const {
|
|
|
8c9df41 |
+ return (long)data.size();
|
|
|
8c9df41 |
}
|
|
|
8c9df41 |
|
|
|
8c9df41 |
private:
|
|
|
8c9df41 |
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
|
|
|
8c9df41 |
new file mode 100644
|
|
|
8c9df41 |
index 0000000..362f165
|
|
|
8c9df41 |
--- /dev/null
|
|
|
8c9df41 |
+++ b/contrib/CMakeLists.txt
|
|
|
8c9df41 |
@@ -0,0 +1,4 @@
|
|
|
8c9df41 |
+# Compile internal irrXML only if system is not requested
|
|
|
8c9df41 |
+if( NOT SYSTEM_IRRXML )
|
|
|
8c9df41 |
+ add_subdirectory(irrXML)
|
|
|
8c9df41 |
+endif( NOT SYSTEM_IRRXML )
|
|
|
8c9df41 |
diff --git a/contrib/irrXML/CMakeLists.txt b/contrib/irrXML/CMakeLists.txt
|
|
|
8c9df41 |
new file mode 100644
|
|
|
8c9df41 |
index 0000000..82ede3a
|
|
|
8c9df41 |
--- /dev/null
|
|
|
8c9df41 |
+++ b/contrib/irrXML/CMakeLists.txt
|
|
|
8c9df41 |
@@ -0,0 +1,13 @@
|
|
|
8c9df41 |
+set( IrrXML_SRCS
|
|
|
8c9df41 |
+ CXMLReaderImpl.h
|
|
|
8c9df41 |
+ heapsort.h
|
|
|
8c9df41 |
+ irrArray.h
|
|
|
8c9df41 |
+ irrString.h
|
|
|
8c9df41 |
+ irrTypes.h
|
|
|
8c9df41 |
+ irrXML.cpp
|
|
|
8c9df41 |
+ irrXML.h
|
|
|
8c9df41 |
+)
|
|
|
8c9df41 |
+
|
|
|
8c9df41 |
+add_library(IrrXML STATIC ${IrrXML_SRCS})
|
|
|
8c9df41 |
+set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" )
|
|
|
8c9df41 |
+set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" )
|
|
|
8c9df41 |
--
|
|
|
8c9df41 |
2.9.3
|
|
|
8c9df41 |
|