CMakeLists.txt 4.14 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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"
)

Jan Möbius's avatar
Jan Möbius committed
15
# include all cmake files found for objecttypes here
16
17
18
19
20
21
foreach ( _buildInfo ${_plugin_buildinfos})
  include ("${CMAKE_SOURCE_DIR}/${_buildInfo}")
endforeach ()

include_directories (
  ..
22
  ${OPENMESH_INCLUDE_DIRS}
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLEW_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
  ${ADDITIONAL_PLUGINLIB_INCS}
)

link_directories (
  ${GLEW_LIBRARY_DIR}
  ${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)

Jan Möbius's avatar
Jan Möbius committed
37
38
39
#=======================================================
# General defines
#=======================================================
40
41
42
43

# generate dllexport macros on windows
if (WIN32)
  add_definitions (
Matthias Möller's avatar
Matthias Möller committed
44
    -DPLUGINLIBDLL
Jan Möbius's avatar
Jan Möbius committed
45
46
    -DACGDLL
    -DUSEACG
47
48
49
50
51
52
53
54
  )
endif ()

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

55
56
57
# Mark this build part as building OpenFLippers Core
add_definitions(-DOPENFLIPPERPLUGINLIB )

Jan Möbius's avatar
Jan Möbius committed
58
59
60
61
62
63
#=======================================================
# Add possibility to debug OpenFlipperSettings
#=======================================================

if ( NOT DEFINED OPENFLIPPER_SETTINGS_DEBUG )
  set( OPENFLIPPER_SETTINGS_DEBUG false CACHE BOOL "Enable or disable debugging of OpenFlipperSettings" )
64
  mark_as_advanced(OPENFLIPPER_SETTINGS_DEBUG)
Jan Möbius's avatar
Jan Möbius committed
65
66
67
endif()

if ( OPENFLIPPER_SETTINGS_DEBUG )
Matthias Möller's avatar
Matthias Möller committed
68
 add_definitions(-DOPENFLIPPER_SETTINGS_DEBUG )
Jan Möbius's avatar
Jan Möbius committed
69
70
71
72
73
74
75
endif()

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

# source code directories
Matthias Möller's avatar
Matthias Möller committed
76
77
78
79
set (directories
  ../BasePlugin
  ../ACGHelper
  ../common
Jan Möbius's avatar
Jan Möbius committed
80
  ../threads
Matthias Möller's avatar
Matthias Möller committed
81
82
  ../common/bsp
  ../INIFile
Jan Möbius's avatar
Jan Möbius committed
83
84
  ../widgets/glWidget
  ../publicWidgets/objectSelectionWidget
Martin Schultz's avatar
Martin Schultz committed
85
86
87
  ../widgets/filePicker
  ../Utils/Memory 
  ../Utils/FileIO
Jan Möbius's avatar
Jan Möbius committed
88
  ../Utils/Memory/procps
Jan Möbius's avatar
Jan Möbius committed
89
)
90

91
92
93
94
95
96
97
98
# 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})

# add additional object type sources
acg_append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)
99
100
acg_append_files_recursive (ui "*.ui" ${CMAKE_SOURCE_DIR}/ObjectTypes)

101
102
103
104
# remove template cc files from source file list
acg_drop_templates (sources)

# genereate uic and moc targets
Matthias Möller's avatar
Matthias Möller committed
105
106
107
108
109
110
111
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 ()
112

Jan Möbius's avatar
Jan Möbius committed
113
114
115
116
#=======================================================
# Create library
#=======================================================

Jan Möbius's avatar
Jan Möbius committed
117
118
119

add_definitions( -DPROCPS_ENABLED )

Matthias Möller's avatar
Matthias Möller committed
120
121
122
123
124
125
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 ()

126
127
if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
  set_target_properties (
Matthias Möller's avatar
Matthias Möller committed
128
    OpenFlipperPluginLib PROPERTIES
129
130
131
    COMPILE_FLAGS ${ADDITIONAL_PLUGINLIB_COMPILER_FLAGS}
  )
endif()
132

133
target_link_libraries (OpenFlipperPluginLib
134
  ${OPENMESH_LIBRARIES}
135
136
137
138
139
140
141
142
  ACG
  ${QT_LIBRARIES}
  ${OPENGL_LIBRARIES}
  ${GLEW_LIBRARY}
  ${GLUT_LIBRARIES}
  ${FTGL_LIBS}
  ${ADDITIONAL_PLUGINLIB_LIBS}
)
Jan Möbius's avatar
Jan Möbius committed
143
144

#=======================================================
145
# Setup translation files for OpenFlipperPluginLib
Jan Möbius's avatar
Jan Möbius committed
146
147
148
149
150
#=======================================================

set (trans_files ${sources})
list (APPEND trans_files ${ui})
list (APPEND trans_files ${headers})
151
acg_add_translations (OpenFlipperPluginLib "de_DE" "${trans_files}")
Jan Möbius's avatar
Jan Möbius committed
152
153
154
155