changed: gcc8 base update
[opensg.git] / Support / collada / CMakeLists.txt
blob1ecfe304936f2352708ffe521f90c6c89fd54f5e
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 IF(WIN32)
4   IF(OSGColladaSrcDir AND OSGPcreSrcDir AND OSGLibXml2SrcDir)
5     SET(_OSG_COLLADA_PRECOND TRUE)
6   ELSE()
7     SET(_OSG_COLLADA_PRECOND FALSE)
8   ENDIF(OSGColladaSrcDir AND OSGPcreSrcDir AND OSGLibXml2SrcDir)
9 ELSE(WIN32)
10   FIND_PACKAGE(LibXml2)
12   IF(OSGColladaSrcDir AND LIBXML2_FOUND)
13     SET(_OSG_COLLADA_PRECOND TRUE)
14   ELSE()
15     SET(_OSG_COLLADA_PRECOND FALSE)
16   ENDIF(OSGColladaSrcDir AND LIBXML2_FOUND)
17 ENDIF(WIN32)
20 IF(_OSG_COLLADA_PRECOND)
22   MESSAGE(STATUS "adding collada from : ${OSGColladaSrcDir}")
24   PROJECT(OSGCollada)
26   SET(${PROJECT_NAME}SharedTarget_14 osgcollada14dom22)
27   SET(${PROJECT_NAME}SharedTarget_15 osgcollada15dom22)
29   IF(WIN32)
30     SET(${PROJECT_NAME}StaticTarget_14 libosgcollada14dom24)
31     SET(${PROJECT_NAME}StaticTarget_15 libosgcollada15dom24)
32   ELSE(WIN32)
33     SET(${PROJECT_NAME}StaticTarget_14 osgcollada14dom24lib)
34     SET(${PROJECT_NAME}StaticTarget_15 osgcollada15dom24lib)
35   ENDIF(WIN32)
37 #  FILE(GLOB variable [RELATIVE path] [globbing expressions]...)
39   FILE(GLOB OSG_COLLADADAE_SRCS "${OSGColladaSrcDir}/dom/src/dae/*.cpp")
41   SET(OSG_COLLADADAE_SRCS ${OSG_COLLADADAE_SRCS}
42                           ${OSGColladaSrcDir}/dom/src/modules/STLDatabase/daeSTLDatabase.cpp
43                           ${OSGColladaSrcDir}/dom/src/modules/stdErrPlugin/stdErrPlugin.cpp
44                           ${OSGColladaSrcDir}/dom/src/modules/LIBXMLPlugin/daeLIBXMLPlugin.cpp
45                           ${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/ioapi.c
46                           ${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/zip.c
47                           ${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/unzip.c)
49   IF(WIN32)
50     SET(OSG_COLLADADAE_SRCS ${OSG_COLLADADAE_SRCS}
51                             ${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/iowin32.c)
52   ENDIF()
54   FILE(GLOB OSG_COLLADADAE_HDR "${OSGColladaSrcDir}/dom/include/dae/*.h")
55   FILE(GLOB OSG_COLLADA_HDR    "${OSGColladaSrcDir}/dom/include/*.h")
56   FILE(GLOB OSG_COLLADA14_SRCS "${OSGColladaSrcDir}/dom/src/1.4/dom/*.cpp")
57   FILE(GLOB OSG_COLLADA15_SRCS "${OSGColladaSrcDir}/dom/src/1.5/dom/*.cpp")
58   FILE(GLOB OSG_COLLADA14_HDR  "${OSGColladaSrcDir}/dom/include/1.4/dom/*.h")
59   FILE(GLOB OSG_COLLADA15_HDR  "${OSGColladaSrcDir}/dom/include/1.5/dom/*.h")
61   SET(OSG_COLLADAMOD_HDR ${OSGColladaSrcDir}/dom/include/modules/daeLIBXMLPlugin.h
62                          ${OSGColladaSrcDir}/dom/include/modules/stdErrPlugin.h
63                          ${OSGColladaSrcDir}/dom/include/modules/daeSTLDatabase.h)
65   SET(OSGCOLLADA_DEF DOM_INCLUDE_LIBXML)
67   IF(APPLE)
68     SET(OSGCOLLADA_DEF ${OSGCOLLADA_DEF};USE_FILE32API)
69   ENDIF()
71   EXECUTE_PROCESS(
72     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
73                      "${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/crypt.h"
74                      "${CMAKE_BINARY_DIR}/collada/include/crypt.h")
75   EXECUTE_PROCESS(
76     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
77                      "${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/ioapi.h"
78                      "${CMAKE_BINARY_DIR}/collada/include/ioapi.h")
80   EXECUTE_PROCESS(
81     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
82                      "${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/iowin32.h"
83                      "${CMAKE_BINARY_DIR}/collada/include/iowin32.h")
85   EXECUTE_PROCESS(
86     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
87                      "${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/unzip.h"
88                      "${CMAKE_BINARY_DIR}/collada/include/unzip.h")
89   EXECUTE_PROCESS(
90     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
91                      "${OSGColladaSrcDir}/dom/external-libs/minizip-1.1/zip.h"
92                      "${CMAKE_BINARY_DIR}/collada/include/zip.h")
94   INCLUDE_DIRECTORIES(${OSG_BOOST_INCDIRS})
95   INCLUDE_DIRECTORIES(${OSGColladaSrcDir}/dom/include)
96   INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
98   IF(UNIX AND APPLE AND EXISTS /sw/include)
99     INCLUDE_DIRECTORIES(/sw/include)
100   ENDIF(UNIX AND APPLE AND EXISTS /sw/include)
102   IF(UNIX AND APPLE AND EXISTS /sw/lib)
103     LINK_DIRECTORIES(/sw/lib)
104   ENDIF(UNIX AND APPLE AND EXISTS /sw/lib)
106   IF(WIN32)
107     INCLUDE_DIRECTORIES(${OSGPcreSrcDir})
108     INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/pcre)
109     INCLUDE_DIRECTORIES(${OSGLibXml2SrcDir}/include)
110     INCLUDE_DIRECTORIES(${OSG_ZLIB_INCLUDE_DIR})
111   ELSE(WIN32)
112     INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
113   ENDIF(WIN32)
116   ## 1.4 ##
118   ADD_SUBDIRECTORY(Dom14)
120   ## 1.5 ##
122   IF(OSG_BUILD_COLLADADOM_15)
124     ADD_SUBDIRECTORY(Dom15)
126   ENDIF(OSG_BUILD_COLLADADOM_15)
129   INSTALL(FILES ${OSG_COLLADA_HDR}
130           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}
131           COMPONENT code_headers
132           PERMISSIONS OWNER_WRITE OWNER_READ
133                       GROUP_READ
134                       WORLD_READ)
135   INSTALL(FILES ${OSG_COLLADADAE_HDR}
136           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/dae
137           COMPONENT code_headers
138           PERMISSIONS OWNER_WRITE OWNER_READ
139                       GROUP_READ
140                       WORLD_READ)
141   INSTALL(FILES ${OSG_COLLADAMOD_HDR}
142           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/modules
143           COMPONENT code_headers
144           PERMISSIONS OWNER_WRITE OWNER_READ
145                       GROUP_READ
146                       WORLD_READ)
148   INSTALL(FILES ${OSG_COLLADA14_HDR}
149           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/1.4/dom
150           COMPONENT code_headers
151           PERMISSIONS OWNER_WRITE OWNER_READ
152                       GROUP_READ
153                       WORLD_READ)
155   IF(OSG_BUILD_COLLADADOM_15)
156     INSTALL(FILES ${OSG_COLLADA15_HDR}
157             DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/1.5/dom
158             COMPONENT code_headers
159             PERMISSIONS OWNER_WRITE OWNER_READ
160                         GROUP_READ
161                         WORLD_READ)
162   ENDIF(OSG_BUILD_COLLADADOM_15)
164 ELSE(_OSG_COLLADA_PRECOND)
165   MESSAGE(STATUS "ignoring collada")
167   SET(OSGColladaSrcDir "" CACHE PATH "")
168 ENDIF(_OSG_COLLADA_PRECOND)