-
Notifications
You must be signed in to change notification settings - Fork 35
/
CMakeLists.txt
142 lines (122 loc) · 4.81 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
cmake_minimum_required(VERSION 3.14)
set (CMAKE_C_STANDARD 99)
set (CMAKE_CXX_STANDARD 98)
set (CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project("Open Inventor"
VERSION 2.1.6
DESCRIPTION "Object oriented OpenGL scene graph"
HOMEPAGE_URL "http://oss.sgi.com/projects/inventor/"
LANGUAGES CXX C)
include(GNUInstallDirs)
include(FeatureSummary)
option(INVENTOR_MAN "Build man pages" ON)
option(INVENTOR_NODES "Build node type extension plug-ins" ON)
option(INVENTOR_DEMOS "Build demo applications" ON)
option(INVENTOR_SAMPLES "Build sample applications" OFF)
option(INVENTOR_EXAMPLES "Build examples from Inventor Mentor and Inventor Toolmaker books" OFF)
option(INVENTOR_INTERNAL_GLW "Use included copy of GLw (OpenGL Xt/Motif widgets) library" ON)
option(INVENTOR_INSTALL_RPATH "Apply rpath when installing" ON)
option(INVENTOR_SANITIZE_UNDEFINED "Build with -fsanitize=undefined" OFF)
option(INVENTOR_SANITIZE_ADDRESS "Build with -fsanitize=address" OFF)
option(INVENTOR_SANITIZE_THREAD "Build with -fsanitize=thread" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
# this is used to override some of cmake's original find-modules
if(APPLE)
# don't use Frameworks and use X11 with matching OpenGL
set(CMAKE_FIND_FRAMEWORK NEVER)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/apple;${CMAKE_MODULE_PATH}")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
message("Setting CMAKE_BUILD_TYPE to ${CMAKE_BUILD_TYPE}")
endif()
set(BUILD_SHARED_LIBS TRUE)
if (BUILD_SHARED_LIBS AND INVENTOR_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-write-strings)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-c++11-compat-deprecated-writable-strings)
add_compile_options(-Wno-backslash-newline-escape)
add_compile_options(-Wno-dangling-else)
add_compile_options(-Wno-parentheses)
add_compile_options(-Wno-switch)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-fno-strict-aliasing)
add_compile_options(-funsigned-char)
endif()
set(ASAN_COMPILE_FLAGS)
set(ASAN_LINK_FLAGS)
if (INVENTOR_SANITIZE_UNDEFINED)
set(ASAN_LINK_FLAGS ${ASAN_LINK_FLAGS} -fsanitize=undefined)
set(ASAN_COMPILE_FLAGS ${ASAN_COMPILE_FLAGS} -fsanitize=undefined)
endif()
if (INVENTOR_SANITIZE_ADDRESS)
set(ASAN_LINK_FLAGS ${ASAN_LINK_FLAGS} -fsanitize=address)
set(ASAN_COMPILE_FLAGS ${ASAN_COMPILE_FLAGS} -fsanitize=address)
set(ASAN_COMPILE_FLAGS${ASAN_COMPILE_FLAGS} -fsanitize-address-use-after-scope)
endif()
if (INVENTOR_SANITIZE_THREAD)
set(ASAN_LINK_FLAGS ${ASAN_LINK_FLAGS} -fsanitize=thread)
set(ASAN_COMPILE_FLAGS ${ASAN_COMPILE_FLAGS} -fsanitize=thread)
endif()
if (INVENTOR_SANITIZE_THREAD OR INVENTOR_SANITIZE_ADDRESS OR INVENTOR_SANITIZE_UNDEFINED)
set(ASAN_COMPILE_FLAGS ${ASAN_COMPILE_FLAGS} -fno-omit-frame-pointer)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(${ASAN_COMPILE_FLAGS})
add_link_options(${ASAN_LINK_FLAGS})
endif()
endif()
find_program(SED_EXECUTABLE
NAMES sed
DOC "sed stream editor"
REQUIRED
)
find_package(StandardMathLibrary)
find_package(BISON REQUIRED)
find_package(JPEG REQUIRED)
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
find_package(X11 REQUIRED)
find_package(Iconv REQUIRED)
find_package(Motif REQUIRED)
if (NOT INVENTOR_INTERNAL_GLW)
find_package(GLw REQUIRED)
endif()
macro(ADD_DIRVAR VAR DIR)
set(${VAR} ${DIR})
add_definitions(-D${VAR}="${CMAKE_INSTALL_PREFIX}/${DIR}")
endmacro()
add_dirvar(IVBINDIR "${CMAKE_INSTALL_BINDIR}")
add_dirvar(IVHELPDIR "${CMAKE_INSTALL_DATADIR}/inventor/help")
add_dirvar(IVFONTPATH "${CMAKE_INSTALL_DATADIR}/inventor/fonts")
set(IVDATAROOT "${CMAKE_INSTALL_DATADIR}/inventor/data")
add_dirvar(IVDATADIR "${IVDATAROOT}/models")
add_dirvar(IVMATERIALSDIR "${IVDATAROOT}/materials")
add_dirvar(IVTEXTURESDIR "${IVDATAROOT}/textures")
add_dirvar(IVDEMODATADIR "${IVDATAROOT}/demos")
#add_dirvar(IVDEMOBINDIR "libexec/inventor")
add_dirvar(IVDEMOBINDIR "${CMAKE_INSTALL_LIBDIR}/inventor")
set(IVHDRTOP Inventor)
if(APPLE)
set(PDFVIEWER "open")
else()
set(PDFVIEWER "xdg-open")
endif()
add_definitions(-DPDFVIEWER="${PDFVIEWER}")
add_subdirectory(tools)
add_subdirectory(libimage)
add_subdirectory(libFL)
add_subdirectory(lib)
add_subdirectory(libSoXt)
add_subdirectory(doc)
add_subdirectory(apps)
add_subdirectory(data)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)