1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 FUNCTION(PROCESS_FILES SUBDIR OUTLIST FILES)
4 FOREACH(_ON_FILE ${${FILES}})
6 COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${OSGOpenNurbsSrcDir}/${SUBDIR}/${_ON_FILE}"
7 "${CMAKE_BINARY_DIR}/External/opennurbs/${SUBDIR}/")
9 LIST(APPEND TMP_OUTLIST "${CMAKE_BINARY_DIR}/External/opennurbs/${SUBDIR}/${_ON_FILE}")
13 SET(${OUTLIST} ${TMP_OUTLIST} PARENT_SCOPE)
16 IF(OSGOpenNurbsSrcDir)
20 SET(${PROJECT_NAME}SharedTarget osgopennurbs)
22 SET(${PROJECT_NAME}StaticTarget libosgopennurbs)
24 SET(${PROJECT_NAME}StaticTarget osgopennurbslib)
28 SET(OSG_OPENNURBS_LSRCS opennurbs_3dm_attributes.cpp
29 opennurbs_3dm_properties.cpp
30 opennurbs_3dm_settings.cpp
31 opennurbs_annotation.cpp
32 opennurbs_annotation2.cpp
34 opennurbs_arccurve.cpp
42 opennurbs_beziervolume.cpp
44 opennurbs_bounding_box.cpp
47 opennurbs_brep_extrude.cpp
49 opennurbs_brep_isvalid.cpp
50 opennurbs_brep_region.cpp
51 opennurbs_brep_tools.cpp
52 opennurbs_brep_v2valid.cpp
55 opennurbs_compress.cpp
59 opennurbs_curveonsurface.cpp
60 opennurbs_curveproxy.cpp
61 opennurbs_cylinder.cpp
64 opennurbs_dimstyle.cpp
66 opennurbs_embedded_file.cpp
68 opennurbs_error_message.cpp
69 opennurbs_evaluate_nurbs.cpp
70 opennurbs_extensions.cpp
73 opennurbs_geometry.cpp
77 opennurbs_instance.cpp
78 opennurbs_intersect.cpp
83 opennurbs_linecurve.cpp
84 opennurbs_linetype.cpp
86 opennurbs_massprop.cpp
87 opennurbs_material.cpp
91 opennurbs_memory_util.c
93 opennurbs_mesh_ngon.cpp
94 opennurbs_mesh_tools.cpp
96 opennurbs_nurbscurve.cpp
97 opennurbs_nurbssurface.cpp
98 opennurbs_nurbsvolume.cpp
100 opennurbs_object_history.cpp
102 opennurbs_offsetsurface.cpp
103 opennurbs_optimize.cpp
105 opennurbs_planesurface.cpp
106 opennurbs_pluginlist.cpp
108 opennurbs_pointcloud.cpp
109 opennurbs_pointgeometry.cpp
110 opennurbs_pointgrid.cpp
111 opennurbs_polycurve.cpp
112 opennurbs_polyedgecurve.cpp
113 opennurbs_polyline.cpp
114 opennurbs_polylinecurve.cpp
115 opennurbs_quaternion.cpp
117 opennurbs_revsurface.cpp
123 opennurbs_sumsurface.cpp
124 opennurbs_surface.cpp
125 opennurbs_surfaceproxy.cpp
126 opennurbs_textlog.cpp
128 opennurbs_unicode.cpp
129 opennurbs_userdata.cpp
131 opennurbs_viewport.cpp
132 opennurbs_workspace.cpp
133 opennurbs_wstring.cpp
136 opennurbs_zlib_memory.cpp)
138 SET(OSG_OPENNURBS_LHDR opennurbs.h
140 opennurbs_3dm_attributes.h
141 opennurbs_3dm_properties.h
142 opennurbs_3dm_settings.h
143 opennurbs_annotation.h
144 opennurbs_annotation2.h
153 opennurbs_bounding_box.h
162 opennurbs_curveonsurface.h
163 opennurbs_curveproxy.h
170 opennurbs_evaluate_nurbs.h
171 opennurbs_extensions.h
180 opennurbs_hsort_template.h
182 opennurbs_intersect.h
187 opennurbs_linecurve.h
188 opennurbs_linestyle.h
198 opennurbs_nurbscurve.h
199 opennurbs_nurbssurface.h
201 opennurbs_object_history.h
203 opennurbs_offsetsurface.h
206 opennurbs_planesurface.h
207 opennurbs_pluginlist.h
209 opennurbs_pointcloud.h
210 opennurbs_pointgeometry.h
211 opennurbs_pointgrid.h
212 opennurbs_polycurve.h
213 opennurbs_polyedgecurve.h
215 opennurbs_polylinecurve.h
216 opennurbs_qsort_template.h
217 opennurbs_quaternion.h
219 opennurbs_rendering.h
220 opennurbs_revsurface.h
224 opennurbs_sumsurface.h
226 opennurbs_surfaceproxy.h
229 opennurbs_texture_mapping.h
235 opennurbs_workspace.h
239 SET(OSG_OPENNURBS_HDR_PATCH opennurbs_array_defs.h
242 opennurbs_version.h )
244 SET(OSG_OPENNURBS_ZLIB_LSRCS adler32.c
256 SET(OSG_OPENNURBS_ZLIB_LHDR crc32.h
267 SET(OSG_OPENNURBS_PATCHES 01_array_defs.patch
272 SET(OSGOPENNURBS_DEF MY_ZCALLOC;Z_PREFIX)
275 SET(OSGOPENNURBS_DEF ${OSGOPENNURBS_DEF};UNICODE;_UNICODE)
277 SET(OSGOPENNURBS_DEF ${OSGOPENNURBS_DEF};_GNU_SOURCE)
282 COMMAND "${CMAKE_COMMAND}" -E make_directory "${OSGOpenNurbsSrcDir}/patched")
284 COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/External/opennurbs/")
286 COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/External/opennurbs/zlib/")
288 FOREACH(_ON_PATCHED_HDR ${OSG_OPENNURBS_HDR_PATCH})
290 COMMAND "${CMAKE_COMMAND}" -E copy "${OSGOpenNurbsSrcDir}/${_ON_PATCHED_HDR}" "${OSGOpenNurbsSrcDir}/patched/")
293 FOREACH(_ON_PATCH ${OSG_OPENNURBS_PATCHES})
294 EXECUTE_PROCESS(COMMAND "patch" "-p1"
295 INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_ON_PATCH}"
296 WORKING_DIRECTORY "${OSGOpenNurbsSrcDir}/patched")
299 PROCESS_FILES(. "OSG_OPENNURBS_SRCS" OSG_OPENNURBS_LSRCS)
300 PROCESS_FILES(. "OSG_OPENNURBS_HDR" OSG_OPENNURBS_LHDR)
302 PROCESS_FILES(zlib "OSG_OPENNURBS_ZLIB_SRCS" OSG_OPENNURBS_ZLIB_LSRCS)
303 PROCESS_FILES(zlib "OSG_OPENNURBS_ZLIB_HDR" OSG_OPENNURBS_ZLIB_LHDR)
305 FOREACH(_ON_PATCHED_HDR ${OSG_OPENNURBS_HDR_PATCH})
307 COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${OSGOpenNurbsSrcDir}/patched/${_ON_PATCHED_HDR}"
308 "${CMAKE_BINARY_DIR}/External/opennurbs/")
309 LIST(APPEND OSG_OPENNURBS_HDR "${CMAKE_BINARY_DIR}/External/opennurbs/${_ON_PATCHED_HDR}")
313 INCLUDE_DIRECTORIES(${OSG_ZLIB_INCLUDE_DIR})
316 IF(BUILD_SHARED_LIBS)
317 ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED
318 ${OSG_OPENNURBS_SRCS}
319 ${OSG_OPENNURBS_ZLIB_SRCS})
321 ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}SharedTarget})
324 SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
327 TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OPENGL_gl_LIBRARY}
328 ${OPENGL_glu_LIBRARY}
333 TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OPENGL_gl_LIBRARY})
337 SET(OSGOPENNURBS_DEF_SHARED ${OSGOPENNURBS_DEF};ON_DLL_EXPORTS;ON_COMPILING_OPENNURBS)
339 SET(OSGOPENNURBS_DEF_SHARED ${OSGOPENNURBS_DEF})
342 SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
343 COMPILE_DEFINITIONS "${OSGOPENNURBS_DEF_SHARED}")
346 INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
347 CONFIGURATIONS Release
348 RUNTIME DESTINATION bin COMPONENT release_runtimes
349 LIBRARY DESTINATION lib COMPONENT release_libraries
350 ARCHIVE DESTINATION lib COMPONENT release_libraries)
352 INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
354 RUNTIME DESTINATION bin COMPONENT debug_runtimes
355 LIBRARY DESTINATION lib COMPONENT debug_libraries
356 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
358 INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
359 RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries
360 LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries
361 ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries)
364 ENDIF(BUILD_SHARED_LIBS)
366 IF(BUILD_STATIC_LIBS)
367 ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_OPENNURBS_SRCS})
369 ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget})
372 SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES
376 SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES
377 COMPILE_DEFINITIONS "${OSGOPENNURBS_DEF}")
381 INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
382 CONFIGURATIONS Release
383 RUNTIME DESTINATION lib COMPONENT release_libraries
384 LIBRARY DESTINATION lib COMPONENT release_libraries
385 ARCHIVE DESTINATION lib COMPONENT release_libraries)
387 INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
389 RUNTIME DESTINATION lib COMPONENT debug_libraries
390 LIBRARY DESTINATION lib COMPONENT debug_libraries
391 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
393 INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
394 RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries
395 LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries
396 ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries)
399 ENDIF(BUILD_STATIC_LIBS)
401 INSTALL(FILES ${OSG_OPENNURBS_HDR}
402 DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/opennurbs
403 COMPONENT code_headers
404 PERMISSIONS OWNER_WRITE OWNER_READ
408 INSTALL(FILES ${OSG_OPENNURBS_ZLIB_HDR}
409 DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/opennurbs/zlib
410 COMPONENT code_headers
411 PERMISSIONS OWNER_WRITE OWNER_READ
415 ELSE(OSGOpenNurbsSrcDir)
416 SET(OSGOpenNurbsSrcDir "" CACHE PATH "")
417 ENDIF(OSGOpenNurbsSrcDir)