-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
379 lines (314 loc) · 12.4 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
################################################################
# Basic Instructions for User
#
# mkdir build;
# cd build;
# cmake ../ [-G see cmake --help for options] [-DMPI_BUILD=true] \
# [-DCMAKE_BUILD_TYPE=None | Debug | Release | RelWithDebInfo | MinSizeRel]
# [-DCMAKE_INSTALL_PREFIX=<path to install>]
#
# ccmake ./ to edit custom options
#
# Important notes:
# 1. do qmake -v -- if it does not say "Using Qt version 4.x.x.." (i.e., it says 3.x.x)
# then you must find the qmake that is for Qt version 4 and set your path so it is
# found first!
################################################################
# Step 0: ensure we have the right version of cmake -- this
# has to go directly here in this file otherwise cmake complains
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2 FATAL_ERROR)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
# Make 32-bit Mac build if user did:
# ./configure --emer-mac-arch-bits=32
if (EMER_MAC_ARCH_BITS EQUAL 32)
message(STATUS "Making 32-bit Mac build")
set(CMAKE_OSX_ARCHITECTURES "i386")
endif()
################################################################
# Step 1: set all the basic parameters about the project
# set Project -- this has important default side-effects,
# especially on Windows, and needs to be done before almost anything else
#TODO: capital-E needed on Windows to avoid additional non-standard overrides
# ... might it not be ok for Unix/Mac too???
if (WIN32)
PROJECT(Emergent)
if (NOT MSVC)
message(FATAL_ERROR "Only Microsoft Visual C++ (nmake or IDE) is supported")
endif (NOT MSVC)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
else ()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
endif ()
else (WIN32)
find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH)
find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} g++ PATHS ENV PATH NO_DEFAULT_PATH)
PROJECT(emergent)
endif (WIN32)
# version setting
set(EMERGENT_VERSION_MAJOR "8")
set(EMERGENT_VERSION_MINOR "6")
set(EMERGENT_VERSION_PATCH "1")
set(EMERGENT_VERSION "${EMERGENT_VERSION_MAJOR}.${EMERGENT_VERSION_MINOR}.${EMERGENT_VERSION_PATCH}")
# this is used for versioning the libs themselves
set(EMERGENT_LIB_VERSION ${EMERGENT_VERSION})
set(EMERGENT_LIB_SOVERSION ${EMERGENT_VERSION_MAJOR})
################################################################
# Step 2: set or lookup various defaults, for both Emergent
# and plugins -- this insures we have a consistent environment
include(CMakeModules/EmergentDefaults.cmake)
# use binary dir to preserve clean sep btwn src and build
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
################################################################
# Step 3: misc global stuff: paths, finding packages etc
# Typically no need to change anything below here
set(mod_path "${PROJECT_SOURCE_DIR}/CMakeModules")
set(CMAKE_MODULE_PATH ${mod_path})
# turn this on for debugging new things
#set(CMAKE_VERBOSE_MAKEFILE ON)
# set the lib and executable suffix based on build type
include(${mod_path}/SetBuildSuffix.cmake)
include(CTest)
# includes -- ours must come before others..
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/src/temt/lib
)
# find all of our dependencies -- also sets their include paths in include_directories
# and sets the EMERGENT_DEP_LIBRARIES variable to all the dependency libraries
find_package(EmergentDependencies)
# install destinations
if (WIN32)
set(EMERGENT_INCLUDE_DEST include)
set(EMERGENT_SHARE_DEST .)
else (WIN32)
set(EMERGENT_INCLUDE_DEST include/Emergent)
set(EMERGENT_SHARE_DEST share/Emergent)
endif (WIN32)
# several important macros in here:
include(${mod_path}/MacroLibrary.cmake)
# this one does all the configure checks to set various variables
include(${mod_path}/ConfigureChecks.cmake)
# this one makes the config.h from cmake_config.h.in
include(${mod_path}/ConfigureGenerate.cmake)
# all the support for maketa:
include(${mod_path}/Maketa.cmake)
####################################
# report on status prior to building
message( STATUS )
message( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "********************* Summary of Key Build Parameters *************************" )
message( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
message( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message( STATUS " (Options are: Debug | Release | RelWithDebInfo | MinSizeRel)" )
if (NOT WIN32)
message( STATUS "MPI_BUILD = ${MPI_BUILD} (true or false)" )
endif (NOT WIN32)
message( STATUS )
message( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
message( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "********************* Summary of Prerequisities ******************************" )
message( STATUS "-------------------------------------------------------------------------------" )
message( STATUS "QT_LIBRARIES = ${QT_LIBRARIES}" )
message( STATUS "COIN_LIBRARY = ${COIN_LIBRARY}" )
#message( STATUS "QUARTER_LIBRARY = ${QUARTER_LIBRARY}" )
message( STATUS "GSL_LIBRARIES = ${GSL_LIBRARIES}" )
message( STATUS "ODE_LIBRARY = ${ODE_LIBRARY}" )
message( STATUS "OPENGL_LIBRARIES = ${OPENGL_LIBRARIES}" )
message( STATUS "ZLIB_LIBRARIES = ${ZLIB_LIBRARIES}" )
message( STATUS "SUBVERSION_LIBRARIES = ${SUBVERSION_LIBRARIES}" )
if (NOT WIN32)
message( STATUS "READLINE_LIBRARY = ${READLINE_LIBRARY}" )
endif (NOT WIN32)
message( STATUS "optional libraries = ${EMERGENT_OPT_LIBRARIES}" )
message( STATUS "all EMERGENT_DEP_LIBRARIES = ${EMERGENT_DEP_LIBRARIES}")
####################################
# Now the actual building begins: all the subdirs
# TEMT system: The EMergent Toolkit
add_subdirectory(src/temt/quarter)
add_subdirectory(src/temt/maketa)
add_subdirectory(src/temt/ta_core)
add_subdirectory(src/temt/ta_math)
add_subdirectory(src/temt/ta_program)
add_subdirectory(src/temt/ta_data)
add_subdirectory(src/temt/ta_proj)
add_subdirectory(src/temt/ta_gui)
add_subdirectory(src/temt/ta_3d)
add_subdirectory(src/temt/css)
add_subdirectory(src/temt/lib)
add_subdirectory(src/temt/css_bin)
add_subdirectory(src/temt/ta_gui/images)
# Emergent code proper
add_subdirectory(src/emergent/network)
add_subdirectory(src/emergent/bp)
add_subdirectory(src/emergent/leabra)
# add_subdirectory(src/emergent/so)
# add_subdirectory(src/emergent/cs)
add_subdirectory(src/emergent/virt_env)
add_subdirectory(src/emergent/actr)
add_subdirectory(src/emergent/lib)
add_subdirectory(src/emergent/bin)
####################################
# plugin commands -- use these after make install to remake plugins
set(EMERGENT_INST_EXE "emergent${EMERGENT_SUFFIX}")
add_custom_target(plugins
COMMAND ${EMERGENT_INST_EXE} --make_all_plugins
)
add_custom_target(user_plugins
COMMAND ${EMERGENT_INST_EXE} --make_all_user_plugins
)
add_custom_target(system_plugins
COMMAND ${EMERGENT_INST_EXE} --make_all_system_plugins
)
add_custom_target(clean_plugins
COMMAND ${EMERGENT_INST_EXE} --clean_all_plugins
)
add_custom_target(clean_user_plugins
COMMAND ${EMERGENT_INST_EXE} --clean_all_user_plugins
)
add_custom_target(clean_system_plugins
COMMAND ${EMERGENT_INST_EXE} --clean_all_system_plugins
)
####################################
# plugin commands -- auto remake..
# share misc files
add_subdirectory(prog_lib)
add_subdirectory(proj_templates)
add_subdirectory(patch_lib)
add_subdirectory(3dobj_lib)
add_subdirectory(css_lib)
add_subdirectory(test)
add_subdirectory(bench/actual)
add_subdirectory(demo/actr)
add_subdirectory(demo/audioproc)
add_subdirectory(demo/bp)
add_subdirectory(demo/cs)
add_subdirectory(demo/data_proc)
add_subdirectory(demo/leabra)
add_subdirectory(demo/network_misc)
add_subdirectory(demo/programs)
add_subdirectory(demo/so)
add_subdirectory(demo/virt_env)
add_subdirectory(data/atlases)
add_subdirectory(data/standard)
if (false) #source to make stub includes -- must be run after making the TA files
file(GLOB_RECURSE xxx_HEADS "${PROJECT_SOURCE_DIR}/src/*.h")
message(STATUS "include files to be processed: ${xxx_HEADS}")
foreach(INC_FILE ${xxx_HEADS})
get_filename_component(DEST_FILE ${INC_FILE} NAME)
get_filename_component(DEST_FILE_WE ${INC_FILE} NAME_WE)
file(RELATIVE_PATH TARG_FILE "${PROJECT_SOURCE_DIR}/include" ${INC_FILE})
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/local_inc.h.in"
"${PROJECT_SOURCE_DIR}/include/${DEST_FILE_WE}.h"
IMMEDIATE @ONLY
)
message(STATUS "created include file for: ${INC_FILE}")
endforeach(INC_FILE)
endif (false)
# dependencies
add_dependencies(temt maketa)
add_dependencies(emergentlib temt)
add_dependencies(emergent emergentlib)
########### install files ###############
install(FILES AUTHORS COPYING COPYING.LIB
cmake_uninstall.cmake.in
DESTINATION ${EMERGENT_SHARE_DEST}
)
# also install our cmake module files for use by plugins, etc
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules
DESTINATION ${EMERGENT_SHARE_DEST}
FILES_MATCHING PATTERN "*.cmake")
#plugin template files NOTE: prolly a more elegant way to make this list...
set(PLT "plugins/template")
install(FILES ${PLT}/CMakeLists.txt ${PLT}/NOBUILD ${PLT}/configure
${PLT}/template_def.h
${PLT}/template.h ${PLT}/template.cpp
${PLT}/template_pl.h ${PLT}/template_pl.cpp
${PLT}/template_qtso.h ${PLT}/template_qtso.cpp
DESTINATION ${EMERGENT_SHARE_DEST}/plugins/template
)
if (WIN32)
if ("${EMER_MISC_LIBS_DIR}" STREQUAL "")
message (FATAL_ERROR "EMER_MISC_LIBS_DIR environment variable is not defined!! it must be -- typically C:\EmerMiscLibs")
endif()
if ("${EMER_SVN_LIBS_DIR}" STREQUAL "")
message (FATAL_ERROR "EMER_SVN_LIBS_DIR environment variable is not defined!! it must be -- typically C:\Subversion")
endif()
if ("${COINDIR}" STREQUAL "")
message (FATAL_ERROR "COINDIR environment variable is not defined!! it must be -- typically C:\Coin\4.0.0.a")
endif()
file(GLOB OUR_MISC_LIBS_FILES
"${EMER_MISC_LIBS_DIR}/bin/*.dll"
"${EMER_SVN_LIBS_DIR}/bin/*.dll"
"${COINDIR}/bin/*.dll"
"${QT_BINARY_DIR}/*.dll"
"${QT_BINARY_DIR}/QtWebEngineProcess.exe"
"${QT_RESOURCES_DIR}/*"
)
install(FILES ${OUR_MISC_LIBS_FILES}
DESTINATION bin
)
install(DIRECTORY "${EMER_MISC_LIBS_DIR}"
DESTINATION .
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/temt/ta_gui/images/emergent.ico
DESTINATION ${EMERGENT_SHARE_DEST}
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/temt/ta_gui/images/emergent.ico
DESTINATION bin
)
if (QT_USE_5)
install(FILES "${QT_PLUGINS_DIR}/platforms/qwindows.dll" "${QT_PLUGINS_DIR}/platforms/qminimal.dll"
DESTINATION bin/platforms
)
endif (QT_USE_5)
else (WIN32)
# plugin folder, so emergent doesn't complain
install(DIRECTORY
DESTINATION lib/Emergent/plugins
)
endif (WIN32)
########### uninstall files ###############
#TODO: Uninstall Windows Registry keys
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
########### cpack packaging ###############
include(CMakeModules/EmergentCPack.cmake)
########### special targets and commands ###############
# BUG: these targets are flakily forcing all the subtargets to become ALL
# targets on Windows (at least in VS) thus we have to omit them
if (NOT WIN32)
# use this to remove all ta files from source tree
add_custom_target(clean_ta_ta
DEPENDS clean_ta_ta_core clean_ta_ta_math clean_ta_ta_proj clean_ta_ta_program clean_ta_ta_data clean_ta_ta_gui clean_ta_ta_3d
)
add_custom_target(clean_ta_emergent
DEPENDS clean_ta_network clean_ta_leabra clean_ta_bp clean_ta_cs clean_ta_so clean_ta_actr
)
ADD_CUSTOM_TARGET(clean_ta_all
DEPENDS clean_ta_ta clean_ta_emergent
)
endif (NOT WIN32)
# svn commands b/c otherwise you're living in the build dir and this saves a cd..
ADD_CUSTOM_TARGET(svn_update
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND svn update
)
ADD_CUSTOM_TARGET(svn_commit
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND svn commit
)