CMakeLists.txt 5.74 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
include (ACGCommon)

set ( ADDITIONAL_PLUGINLIB_LIBS "")
set ( ADDITIONAL_PLUGINLIB_INCS "")
set ( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS "")
set ( ADDITIONAL_PLUGINLIB_LINK_DIRS "")

# search all ObjectTypes in the ObjectType directory for additional build information
file (
  GLOB _plugin_buildinfos
  RELATIVE "${CMAKE_SOURCE_DIR}"
  "${CMAKE_SOURCE_DIR}/ObjectTypes/*/CMakeLists.txt"
13
14
  "${CMAKE_SOURCE_DIR}/Package*/ObjectTypes/*/CMakeLists.txt"

15
16
)

Jan Möbius's avatar
Jan Möbius committed
17
# include all cmake files found for objecttypes here
18
19
20
foreach ( _buildInfo ${_plugin_buildinfos})
  include ("${CMAKE_SOURCE_DIR}/${_buildInfo}")
endforeach ()
21
22
23
24
25
26
27
  
# Find all packages and include their Paths here like the toplevel would be
file(GLOB OF_PACKAGES RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/Package*" )

foreach ( OF_PACKAGE ${OF_PACKAGES})
   list(APPEND PACKAGE_INCLUDES "${CMAKE_SOURCE_DIR}/${OF_PACKAGES}")
endforeach ()
28

29
30
31
32
33
34
35
36

# search all lib directories in packages for OpenFlipper
file (
    GLOB PACKAGE_DIRS
      "${CMAKE_SOURCE_DIR}/Package-*"
)


37
38
include_directories (
  ..
39
  ${PACKAGE_DIRS}
40
  ${OPENMESH_INCLUDE_DIRS}
41
42
43
44
45
46
47
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLEW_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
  ${ADDITIONAL_PLUGINLIB_INCS}
48
  ${PACKAGE_INCLUDES}
49
50
51
52
53
54
55
)

link_directories (
  ${GLEW_LIBRARY_DIR}
  ${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)

Jan Möbius's avatar
Jan Möbius committed
56
57
58
#=======================================================
# General defines
#=======================================================
59
60
61
62

# generate dllexport macros on windows
if (WIN32)
  add_definitions (
Matthias Möller's avatar
Matthias Möller committed
63
    -DPLUGINLIBDLL
Jan Möbius's avatar
Jan Möbius committed
64
65
    -DACGDLL
    -DUSEACG
66
67
68
69
70
71
72
73
  )
endif ()

# define core version
add_definitions (
    -DCORE_VERSION="${OPENFLIPPER_VERSION}"
)

74
75
76
# Mark this build part as building OpenFLippers Core
add_definitions(-DOPENFLIPPERPLUGINLIB )

Jan Möbius's avatar
Jan Möbius committed
77
78
79
80
81
82
#=======================================================
# Add possibility to debug OpenFlipperSettings
#=======================================================

if ( NOT DEFINED OPENFLIPPER_SETTINGS_DEBUG )
  set( OPENFLIPPER_SETTINGS_DEBUG false CACHE BOOL "Enable or disable debugging of OpenFlipperSettings" )
83
  mark_as_advanced(OPENFLIPPER_SETTINGS_DEBUG)
Jan Möbius's avatar
Jan Möbius committed
84
85
86
endif()

if ( OPENFLIPPER_SETTINGS_DEBUG )
Matthias Möller's avatar
Matthias Möller committed
87
 add_definitions(-DOPENFLIPPER_SETTINGS_DEBUG )
Jan Möbius's avatar
Jan Möbius committed
88
89
90
91
92
93
94
endif()

#=======================================================
# Collect files to compile
#=======================================================

# source code directories
Matthias Möller's avatar
Matthias Möller committed
95
96
97
98
set (directories
  ../BasePlugin
  ../ACGHelper
  ../common
Jan Möbius's avatar
Jan Möbius committed
99
  ../threads
Matthias Möller's avatar
Matthias Möller committed
100
101
  ../common/bsp
  ../INIFile
Jan Möbius's avatar
Jan Möbius committed
102
103
  ../widgets/glWidget
  ../publicWidgets/objectSelectionWidget
Jan Möbius's avatar
REvert    
Jan Möbius committed
104
  ../widgets/filePicker 
Jan Möbius's avatar
Jan Möbius committed
105
  ../Utils/FileIO
Martin Schultz's avatar
Martin Schultz committed
106
  ../Utils/Memory
Jan Möbius's avatar
Jan Möbius committed
107
)
108

109
110
111
112
113
# collect all header,source and ui files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui "*.ui" ${directories})

114
115
116
117
118
119
120
####################################################################################
# Object Type stuff
####################################################################################

#########################################################
# add additional toplevel object type sources
#########################################################
121
122
acg_append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)
123
124
acg_append_files_recursive (ui "*.ui" ${CMAKE_SOURCE_DIR}/ObjectTypes)

125
126
127
128
129
130
131
#########################################################
# Find all packages and include their Object types
#########################################################

file(GLOB PACKAGES RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/Package*" )

foreach ( OF_PACKAGE ${PACKAGES})
Jan Möbius's avatar
Jan Möbius committed
132
133
134
  acg_append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/${OF_PACKAGE}/ObjectTypes)
  acg_append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/${OF_PACKAGE}/ObjectTypes)
  acg_append_files_recursive (ui "*.ui" ${CMAKE_SOURCE_DIR}/${OF_PACKAGE}/ObjectTypes)
135
136
137
138
139
140
endforeach ()

#=======================================================
# Cleanup
#=======================================================

141
142
143
# remove template cc files from source file list
acg_drop_templates (sources)

144
145
146
147
#=======================================================
# Moc/UIC handling
#=======================================================

148
# genereate uic and moc targets
Matthias Möller's avatar
Matthias Möller committed
149
150
151
152
153
154
155
if (QT5_FOUND)
  acg_qt5_autouic (uic_targets ${ui})
  acg_qt5_automoc (moc_targets ${headers})
elseif (QT4_FOUND)
  acg_qt4_autouic (uic_targets ${ui})
  acg_qt4_automoc (moc_targets ${headers})
endif ()
156

Jan Möbius's avatar
Jan Möbius committed
157
158
159
160
#=======================================================
# Create library
#=======================================================

Matthias Möller's avatar
Matthias Möller committed
161
162
163
164
165
166
if (QT5_FOUND)
  acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
elseif (QT4_FOUND)
  acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
endif ()

167
168
if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
  set_target_properties (
Matthias Möller's avatar
Matthias Möller committed
169
    OpenFlipperPluginLib PROPERTIES
170
171
172
    COMPILE_FLAGS ${ADDITIONAL_PLUGINLIB_COMPILER_FLAGS}
  )
endif()
173

174
target_link_libraries (OpenFlipperPluginLib
175
  ${OPENMESH_LIBRARIES}
176
177
178
179
180
181
182
183
  ACG
  ${QT_LIBRARIES}
  ${OPENGL_LIBRARIES}
  ${GLEW_LIBRARY}
  ${GLUT_LIBRARIES}
  ${FTGL_LIBS}
  ${ADDITIONAL_PLUGINLIB_LIBS}
)
Jan Möbius's avatar
Jan Möbius committed
184
185

#=======================================================
186
# Setup translation files for OpenFlipperPluginLib
Jan Möbius's avatar
Jan Möbius committed
187
188
189
190
191
#=======================================================

set (trans_files ${sources})
list (APPEND trans_files ${ui})
list (APPEND trans_files ${headers})
192
acg_add_translations (OpenFlipperPluginLib "de_DE" "${trans_files}")
Jan Möbius's avatar
Jan Möbius committed
193
194
195
196