This repository was archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathCMakeLists.txt
119 lines (105 loc) · 3.06 KB
/
CMakeLists.txt
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
file( GLOB_RECURSE SFCGAL_SOURCES "*.cpp" )
file( GLOB_RECURSE SFCGAL_HEADERS "*.h" )
file( GLOB_RECURSE SFCGAL_HEADERS_COPIED RELATIVE ${CMAKE_SOURCE_DIR}/src "*.h" )
add_custom_target(copy)
foreach (header ${SFCGAL_HEADERS_COPIED})
add_custom_command(TARGET copy
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/${header} ${CMAKE_BINARY_DIR}/include/SFCGAL/${header} DEPENDS ${CMAKE_SOURCE_DIR}/src/${header})
endforeach()
if (CGAL_VERSION VERSION_GREATER 4.13)
include_directories(../CGAL_patches)
endif()
set( SFCGAL_OSG_HEADERS
${CMAKE_SOURCE_DIR}/src/io/osg.h
${CMAKE_SOURCE_DIR}/src/detail/io/OsgFactory.h )
set( SFCGAL_OSG_SOURCES
${CMAKE_SOURCE_DIR}/src/io/osg.cpp
${CMAKE_SOURCE_DIR}/src/detail/io/OsgFactory.cpp )
message( STATUS "removing OSG dependencies from the library")
list(REMOVE_ITEM SFCGAL_HEADERS ${SFCGAL_OSG_HEADERS})
list(REMOVE_ITEM SFCGAL_SOURCES ${SFCGAL_OSG_SOURCES})
if( SFCGAL_USE_STATIC_LIBS )
add_definitions( "-DSFCGAL_USE_STATIC_LIBS" )
if (NOT MSVC)
add_definitions( "-fPIC" )
endif()
add_library(
SFCGAL
${SFCGAL_HEADERS}
${SFCGAL_SOURCES}
)
else()
add_definitions( "-DSFCGAL_BUILD_SHARED" )
add_library(
SFCGAL SHARED
${SFCGAL_HEADERS}
${SFCGAL_SOURCES}
)
endif()
add_dependencies( SFCGAL copy )
# set VERSION and SOVERSION
set_target_properties( SFCGAL PROPERTIES VERSION ${SFCGAL_VERSION}
SOVERSION ${SFCGAL_VERSION_MAJOR} )
target_link_libraries( SFCGAL CGAL::CGAL CGAL::CGAL_Core)
if( "${CGAL_VERSION}" VERSION_GREATER_EQUAL "5.0.0")
target_link_libraries( SFCGAL gmpxx )
endif()
target_link_libraries( SFCGAL ${Boost_LIBRARIES} )
if ( ${Use_precompiled_headers} )
if(PCHSupport_FOUND)
# Add "-fPIC" for shared library build
if( ${SFCGAL_USE_STATIC_LIBS} )
set( pch_option "" )
else()
set( pch_option "-fPIC" )
endif()
add_precompiled_header(SFCGAL
include/CGAL/all.h
${pch_option}
)
endif()
endif()
# install library
install(
TARGETS
SFCGAL
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# SFCGAL-osg
if ( SFCGAL_WITH_OSG )
if( SFCGAL_USE_STATIC_LIBS )
add_definitions( "-DSFCGAL_USE_STATIC_LIBS" )
if (NOT MSVC)
add_definitions( "-fPIC" )
endif()
add_library(
SFCGAL-osg
${SFCGAL_OSG_HEADERS}
${SFCGAL_OSG_SOURCES}
)
else()
add_definitions( "-DSFCGAL_BUILD_SHARED" )
add_library(
SFCGAL-osg SHARED
${SFCGAL_OSG_HEADERS}
${SFCGAL_OSG_SOURCES}
)
endif()
target_link_libraries( SFCGAL-osg
SFCGAL
${OPENSCENEGRAPH_LIBRARIES}
)
set_target_properties( SFCGAL-osg PROPERTIES VERSION ${SFCGAL_VERSION}
SOVERSION ${SFCGAL_VERSION_MAJOR} )
install(
TARGETS
SFCGAL-osg
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()