summaryrefslogtreecommitdiff
path: root/patches/collada-dom-v2.3-r7.patch
blob: c2da9d04ed477d2d9c702b2424b85b80c0b607b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1c1993..cdcba63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,25 @@
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-set(COLLADA14_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/1.4)
-set(COLLADA15_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/1.5)
+project(colladadom)
+cmake_minimum_required(VERSION 3.17)
+
+include(FindPkgConfig)
+
+find_package(Boost REQUIRED CONFIG)
+pkg_check_modules(LIBXML2 libxml-2.0)
+pkg_check_modules(MINIZIP minizip)
+pkg_check_modules(ZLIB zlib)
+
+set(COLLADA_DOM_SOVERSION "0")
+set(COLLADA_DOM_VERSION "2.3")
+
 file(GLOB dae_files ${CMAKE_CURRENT_SOURCE_DIR}/src/dae/*.cpp)
 file(GLOB libxmlplugin_files ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/LIBXMLPlugin/*.cpp)
 file(GLOB stddatabase_files ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/STLDatabase/*.cpp)
 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_LIBS minizip ${ZLIB_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-set(COLLADA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} ${Boost_CFLAGS} -DDOM_INCLUDE_LIBXML")
+set(COLLADA_LIBS ${LIBXML2_LIBRARIES} ${MINIZIP_LIBRARIES} ${ZLIB_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY})
+list(JOIN MINIZIP_CFLAGS " " VAR_MINIZIP_CFLAGS)
+set(COLLADA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} ${VAR_MINIZIP_CFLAGS} ${Boost_CFLAGS} -DDOM_INCLUDE_LIBXML")
 
 if( OPT_COLLADA15 )
   add_subdirectory(src/1.5)
@@ -17,8 +28,8 @@ if( OPT_COLLADA14 )
   add_subdirectory(src/1.4)
 endif()
 
-install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/1.4 DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
-install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/1.5 DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
-install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/dae DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
-install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/modules DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dae.h ${CMAKE_CURRENT_SOURCE_DIR}/include/dae.h DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR})
+# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/1.4 DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
+# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/1.5 DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
+# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/dae DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
+# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/modules DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR} PATTERN ".svn" EXCLUDE PATTERN ".~" EXCLUDE)
+# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dae.h ${CMAKE_CURRENT_SOURCE_DIR}/include/dae.h DESTINATION ${COLLADA_DOM_INCLUDE_INSTALL_DIR})
diff --git a/src/1.4/CMakeLists.txt b/src/1.4/CMakeLists.txt
index 17fbaea..86d2d1d 100644
--- a/src/1.4/CMakeLists.txt
+++ b/src/1.4/CMakeLists.txt
@@ -1,10 +1,32 @@
 file(GLOB dom_files ${CMAKE_CURRENT_SOURCE_DIR}/dom/*.cpp)
-include_directories(${COLLADA14_INCLUDE_DIR})
-add_library(collada14dom SHARED ${COLLADA_BASE_SOURCES} ${dom_files})
+add_library(collada14dom STATIC ${COLLADA_BASE_SOURCES} ${dom_files})
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  target_compile_options(collada14dom PRIVATE
+	"-Wno-error=unused-result" "-Wno-cast-user-defined" "-Wno-nonnull"
+  )
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+  target_compile_options(collada14dom PRIVATE
+	"-Wno-error=unused-result"
+  )
+endif()
+target_include_directories(collada14dom PRIVATE
+	${colladadom_SOURCE_DIR}/include
+	${colladadom_SOURCE_DIR}/include/1.4
+	${Boost_INCLUDE_DIRS}
+	${LIBXML2_INCLUDE_DIRS}
+	${MINIZIP_INCLUDE_DIRS}
+	${ZLIB_INCLUDE_DIRS}
+)
+target_link_directories(collada14dom INTERFACE
+	${Boost_LIBRARY_DIRS}
+	${LIBXML2_LIBRARY_DIRS}
+	${MINIZIP_LIBRARY_DIRS}
+	${ZLIB_LIBRARY_DIRS}
+)
 target_link_libraries(collada14dom ${COLLADA_LIBS})
 set_target_properties(collada14dom PROPERTIES
   COMPILE_FLAGS "${COLLADA_COMPILE_FLAGS}"
   CLEAN_DIRECT_OUTPUT 1
   SOVERSION ${COLLADA_DOM_SOVERSION}
   VERSION ${COLLADA_DOM_VERSION})
-install(TARGETS collada14dom DESTINATION lib${LIB_SUFFIX})
+# install(TARGETS collada14dom DESTINATION ${COLLADA_DOM_LIBS_INSTALL_DIR})
diff --git a/src/1.5/CMakeLists.txt b/src/1.5/CMakeLists.txt
index e061a01..fb73a70 100644
--- a/src/1.5/CMakeLists.txt
+++ b/src/1.5/CMakeLists.txt
@@ -1,10 +1,10 @@
 file(GLOB dom_files ${CMAKE_CURRENT_SOURCE_DIR}/dom/*.cpp)
 include_directories(${COLLADA15_INCLUDE_DIR})
-add_library(collada15dom SHARED ${COLLADA_BASE_SOURCES} ${dom_files})
+add_library(collada15dom STATIC ${COLLADA_BASE_SOURCES} ${dom_files})
 target_link_libraries(collada15dom ${COLLADA_LIBS})
 set_target_properties(collada15dom PROPERTIES
   COMPILE_FLAGS "${COLLADA_COMPILE_FLAGS}"
   CLEAN_DIRECT_OUTPUT 1
   SOVERSION ${COLLADA_DOM_SOVERSION}
   VERSION ${COLLADA_DOM_VERSION})
-install(TARGETS collada15dom DESTINATION lib${LIB_SUFFIX})
+install(TARGETS collada15dom DESTINATION ${COLLADA_DOM_LIBS_INSTALL_DIR})
diff --git a/src/dae/daeUtils.cpp b/src/dae/daeUtils.cpp
index 682692c..0e61ef1 100644
--- a/src/dae/daeUtils.cpp
+++ b/src/dae/daeUtils.cpp
@@ -118,7 +118,7 @@ list<string> cdom::makeStringList(const char* s, ...) {
 	va_end(args);
 	return result;
 }
-#endif 0
+#endif // 0
 
 string cdom::getCurrentDir() {
 #ifdef __CELLOS_LV2__
@@ -154,7 +154,7 @@ char cdom::getFileSeparator() {
 const string& cdom::getSystemTmpDir() {
 #ifdef WIN32
     static string tmpDir = string(getenv("TMP")) + getFileSeparator();
-#elif defined(__linux__) || defined(__linux)
+#elif defined(__linux__) || defined(__linux) || defined(__FreeBSD__)
     static string tmpDir = "/tmp/";
 #elif defined __APPLE_CC__
 static string tmpDir = string(getenv("TMPDIR"));
@@ -173,7 +173,7 @@ string cdom::getRandomFileName() {
     std::string tmp(tmpnam(&tmpbuffer[0]));
 #ifdef WIN32
     randomSegment = tmp.substr(tmp.find_last_of('\\')+1);
-#elif defined(__linux__) || defined(__linux)
+#elif defined(__linux__) || defined(__linux) || defined(__FreeBSD__)
     randomSegment = tmp.substr(tmp.find_last_of('/')+1);
 #elif defined __APPLE_CC__
 	randomSegment = tmp.substr(tmp.find_last_of('/')+1);