forked from cyclus/cyclus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
546 lines (470 loc) · 23.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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#taken from http://geant4.cern.ch/support/source/geant4/CMakeLists.txt
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Cyclus requires an out-of-source build.")
message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
message(STATUS "CMakeCache.txt")
message(STATUS "CMakeFiles")
message(STATUS "Once these files are removed, create a separate directory")
message(STATUS "and run CMake from there")
message(FATAL_ERROR "in-source build detected")
ENDIF()
# Set some policies
cmake_policy(SET CMP0040 OLD)
cmake_policy(SET CMP0042 OLD)
# This project name is cyclus.
PROJECT(CYCLUS)
# check for and enable c++11 support (required for cyclus)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE()
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
ENDIF()
# enable assembly
enable_language(ASM)
# quiets fortify_source warnings when not compiling with optimizations
# in linux distros where compilers were compiled with fortify_source enabled by
# default (e.g. Arch linux).
MESSAGE("-- CMake Build Type: ${CMAKE_BUILD_TYPE}")
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
IF(NOT ${BUILD_TYPE} STREQUAL "release")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0")
ENDIF()
# no overflow warnings because of silly coin-ness
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overflow")
IF(NOT CYCLUS_DOC_ONLY)
##############################################################################################
################################# begin cmake configuration ##################################
##############################################################################################
# set project directories
SET(PROJECT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CYCLUS_SHARE_DIR "${PROJECT_SOURCE_DIR}/share")
SET(CYCLUS_CLI_DIR "${PROJECT_SOURCE_DIR}/cli")
SET(CYCLUS_DOC_DIR "${PROJECT_SOURCE_DIR}/doc")
SET(CYCLUS_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
SET(CYCLUS_STUB_DIR "${PROJECT_SOURCE_DIR}/stubs")
SET(CYCLUS_TEST_DIR "${PROJECT_SOURCE_DIR}/tests")
SET(CYCLUS_AGENTS_DIR "${PROJECT_SOURCE_DIR}/agents")
SET(CYCLUS_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
SET(CYCLUS_PYSOURCE_DIR "${PROJECT_SOURCE_DIR}/cyclus")
# set cycpp var
SET(CYCPP "${CYCLUS_CLI_DIR}/cycpp.py")
# set cython post-processor var
SET(CYTHON_POST_PROCESSOR "${CYCLUS_CLI_DIR}/post-process-cython.py")
# This makes all the libraries build as SHARED
SET(BUILD_SHARED_LIBS true)
# Setup build locations.
IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CYCLUS_BINARY_DIR}/bin")
endif()
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CYCLUS_BINARY_DIR}/lib")
endif()
IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CYCLUS_BINARY_DIR}/lib")
ENDIF()
SET(CYCLUS_EXECUTABLE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/cyclus")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/cyclus")
GET_FILENAME_COMPONENT(cxxCompilerRoot ${CMAKE_CXX_COMPILER} DIRECTORY)
GET_FILENAME_COMPONENT(cxxCompilerRoot ${cxxCompilerRoot} DIRECTORY)
IF (NOT "${CMAKE_INSTALL_RPATH}" STREQUAL "${cxxCompilerRoot}")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${cxxCompilerRoot}/lib;${cxxCompilerRoot}/lib/cyclus")
ENDIF (NOT "${CMAKE_INSTALL_RPATH}" STREQUAL "${cxxCompilerRoot}")
ENDIF("${isSystemDir}" STREQUAL "-1")
MESSAGE("-- CMAKE_INSTALL_RPATH: ${CMAKE_INSTALL_RPATH}")
if (APPLE)
set(BUILD_WITH_INSTALL_NAME_DIR TRUE)
endif()
# Tell CMake where the modules are
LIST(APPEND CMAKE_MODULE_PATH
"${CMAKE_DIR}/share/cmake-2.8/Modules" "${PROJECT_SOURCE_DIR}/cmake")
# Include macros
INCLUDE(CopyWhenDiffMacro)
INCLUDE(DownloadAndExtract)
INCLUDE(UseCyclus)
# set configuration variables
cyclus_platform()
cyclus_set_fast_compile()
# set configuration for all library builds
IF (WIN32)
set(suffix ".dll")
set(dynamicloadlib "windows_helper_functions.h")
ELSEIF(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
set(suffix ".dylib")
set(dynamicloadlib "unix_helper_functions.h")
ELSE()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--allow-shlib-undefined")
set(suffix ".so")
set(dynamicloadlib "unix_helper_functions.h")
ENDIF()
# enable testing, must be at top-level cmake file
OPTION(USE_TESTING "Build testing" ON)
IF(USE_TESTING)
enable_testing()
INCLUDE(CTest)
ENDIF()
##############################################################################################
################################## end cmake configuration ###################################
##############################################################################################
##############################################################################################
################################### begin find libraries #####################################
##############################################################################################
if (NOT DEPS_ROOT_DIR)
get_filename_component(compdir ${CMAKE_CXX_COMPILER} DIRECTORY)
get_filename_component(DEPS_ROOT_DIR ${compdir} DIRECTORY)
endif (NOT DEPS_ROOT_DIR)
SET(DEPS_HINTS HINTS "${DEPS_ROOT_DIR}")
SET(DEPS_BIN_HINTS ${DEPS_HINTS} "${DEPS_ROOT_DIR}/bin")
SET(DEPS_LIB_HINTS ${DEPS_HINTS} "${DEPS_ROOT_DIR}/lib")
SET(DEPS_INCLUDE_HINTS HINTS "${DEPS_ROOT_DIR}/include")
MESSAGE("-- Dependency Root Dir (DEPS_ROOT_DIR): ${DEPS_ROOT_DIR}")
MESSAGE("-- Dependency Hints (DEPS_HINTS): ${DEPS_HINTS}")
MESSAGE("-- Dependency Binary Hints (DEPS_BIN_HINTS): ${DEPS_BIN_HINTS}")
MESSAGE("-- Dependency Library Hints (DEPS_LIB_HINTS): ${DEPS_LIB_HINTS}")
MESSAGE("-- Dependency Include Hints (DEPS_INCLUDE_HINTS): ${DEPS_INCLUDE_HINTS}")
# Debian installs useful LibXML2 files to /usr/include/libxml2/libxml
# libxml2 is required for relaxng schema validation
FIND_PACKAGE(LibXml2 ${DEPS_HINTS})
IF(NOT LIBXML2_LIBRARIES)
FIND_LIBRARY(LibXml2 REQUIRED ${DEPS_HINTS})
ENDIF()
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
SET(LIBS ${LIBS} ${LIBXML2_LIBRARIES})
# Find LibXML++ and dependencies
FIND_PACKAGE(LibXML++)
IF(NOT LibXML++_LIBRARIES)
FIND_LIBRARY(LibXML++ REQUIRED ${DEPS_HINTS})
ENDIF()
SET(LIBS ${LIBS} ${LibXML++_LIBRARIES})
message("-- LibXML++ Include Dir: ${LibXML++_INCLUDE_DIR}")
# find lapack and link to it
FIND_PACKAGE(LAPACK REQUIRED)
set(LIBS ${LIBS} ${LAPACK_LIBRARIES})
MESSAGE("-- Found LAPACK Linker Flags: ${LAPACK_LINKER_FLAGS}")
MESSAGE("-- Found LAPACK Libraries: ${LAPACK_LIBRARIES}")
MESSAGE("-- Found BLAS Libraries: ${BLAS_LIBRARIES}")
# Find Sqlite3
FIND_PACKAGE(Sqlite3 REQUIRED)
SET(LIBS ${LIBS} ${SQLITE3_LIBRARIES})
# Find HDF5
FIND_PACKAGE(HDF5 REQUIRED COMPONENTS HL)
ADD_DEFINITIONS(${HDF5_DEFINITIONS})
if(NOT HDF5_LIBRARY_DIRS STREQUAL "")
set(LIBS ${LIBS} ${HDF5_LIBRARIES})
link_directories(${HDF5_LIBRARY_DIRS})
endif()
set(LIBS ${LIBS} ${HDF5_C_LIBRARIES} ${HDF5_C_HL_LIBRARIES})
MESSAGE("-- HDF5 Root: ${HDF5_ROOT}")
MESSAGE("-- HDF5 Include directory: ${HDF5_INCLUDE_DIR}")
MESSAGE("-- HDF5 Library directories: ${HDF5_LIBRARY_DIRS}")
MESSAGE("-- HDF5 Libraries: ${HDF5_C_LIBRARIES}")
MESSAGE("-- HDF5 High Level Libraries: ${HDF5_C_HL_LIBRARIES}")
# Include the boost header files and the program_options library
# Please be sure to use Boost rather than BOOST.
# Capitalization matters on some platforms
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_STATIC_RUNTIME OFF)
# SET(Boost_USE_MULTITHREADED OFF)
if (DEPS_ROOT_DIR)
SET(BOOST_ROOT "${DEPS_ROOT_DIR}")
SET(BOOST_INCLUDEDIR "${DEPS_INCLUDE_HINTS}")
endif (DEPS_ROOT_DIR)
FIND_PACKAGE(Boost COMPONENTS program_options filesystem system serialization REQUIRED)
MESSAGE("-- Boost Root: ${Boost_ROOT}")
MESSAGE("-- Boost Include directory: ${Boost_INCLUDE_DIR}")
MESSAGE("-- Boost Library directories: ${Boost_LIBRARY_DIRS}")
SET(LIBS ${LIBS} ${Boost_PROGRAM_OPTIONS_LIBRARY})
MESSAGE("-- Boost Program Options location: ${Boost_PROGRAM_OPTIONS_LIBRARY}")
SET(LIBS ${LIBS} ${Boost_SYSTEM_LIBRARY})
MESSAGE("-- Boost System location: ${Boost_SYSTEM_LIBRARY}")
SET(LIBS ${LIBS} ${Boost_FILESYSTEM_LIBRARY})
MESSAGE("-- Boost Filesystem location: ${Boost_FILESYSTEM_LIBRARY}")
SET(LIBS ${LIBS} ${Boost_SERIALIZATION_LIBRARY})
MESSAGE("-- Boost Serialization location: ${Boost_SERIALIZATION_LIBRARY}")
# find coin and link to it
FIND_PACKAGE(COIN)
MESSAGE("-- COIN Version: ${COIN_VERSION}")
set(LIBS ${LIBS} ${COIN_LIBRARIES})
if(NOT COIN_FOUND)
# no COIN, so no MILPs
set(DEFAULT_ALLOW_MILPS false)
endif()
#
# Some optional libraries to link in, as availble. Required for conda.
#
# pcre
FIND_LIBRARY(PCRE_LIBRARIES pcre ${DEPS_LIB_HINTS})
MESSAGE("-- Found PCRE Libraries (optional): ${PCRE_LIBRARIES}")
IF(PCRE_LIBRARIES)
set(LIBS ${LIBS} ${PCRE_LIBRARIES})
ENDIF(PCRE_LIBRARIES)
# gfortran
FIND_LIBRARY(GFORTRAN_LIBRARIES gfortran ${DEPS_LIB_HINTS})
MESSAGE("-- Found GFORTRAN Libraries (optional): ${GFORTRAN_LIBRARIES}")
IF(GFORTRAN_LIBRARIES)
set(LIBS ${LIBS} ${GFORTRAN_LIBRARIES})
ENDIF(GFORTRAN_LIBRARIES)
# openblas
FIND_LIBRARY(OPENBLAS_LIBRARIES openblas ${DEPS_LIB_HINTS})
MESSAGE("-- Found OPENBLAS Libraries (optional): ${OPENBLAS_LIBRARIES}")
IF(OPENBLAS_LIBRARIES)
set(LIBS ${LIBS} ${OPENBLAS_LIBRARIES})
ENDIF(OPENBLAS_LIBRARIES)
# ClpSolver
FIND_LIBRARY(CLPSOLVER_LIBRARIES ClpSolver ${DEPS_LIB_HINTS})
MESSAGE("-- Found CLPSOLVER Libraries (optional): ${CLPSOLVER_LIBRARIES}")
IF(CLPSOLVER_LIBRARIES)
set(LIBS ${LIBS} ${CLPSOLVER_LIBRARIES})
ENDIF(CLPSOLVER_LIBRARIES)
# iconv
FIND_LIBRARY(ICONV_LIBRARIES iconv ${DEPS_LIB_HINTS})
MESSAGE("-- Found ICONV Libraries (optional): ${ICONV_LIBRARIES}")
IF(ICONV_LIBRARIES)
set(LIBS ${LIBS} ${ICONV_LIBRARIES})
ENDIF(ICONV_LIBRARIES)
# icudata
FIND_LIBRARY(ICUDATA_LIBRARIES icudata ${DEPS_LIB_HINTS})
MESSAGE("-- Found ICUDATA Libraries (optional): ${ICUDATA_LIBRARIES}")
IF(ICUDATA_LIBRARIES)
set(LIBS ${LIBS} ${ICUDATA_LIBRARIES})
ENDIF(ICUDATA_LIBRARIES)
# icui18n
FIND_LIBRARY(ICUI18N_LIBRARIES icui18n ${DEPS_LIB_HINTS})
MESSAGE("-- Found ICUI18N Libraries (optional): ${ICUI18N_LIBRARIES}")
IF(ICUI18N_LIBRARIES)
set(LIBS ${LIBS} ${ICUI18N_LIBRARIES})
ENDIF(ICUI18N_LIBRARIES)
# icuuc
FIND_LIBRARY(ICUUC_LIBRARIES icuuc ${DEPS_LIB_HINTS})
MESSAGE("-- Found ICUUC Libraries (optional): ${ICUUC_LIBRARIES}")
IF(ICUUC_LIBRARIES)
set(LIBS ${LIBS} ${ICUUC_LIBRARIES})
ENDIF(ICUUC_LIBRARIES)
#
# Cython & Python Bindings
#
# Use new Python library finder
find_package(PythonInterp)
find_package(PythonLibs)
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
"import site; print(site.getsitepackages(['${CMAKE_INSTALL_PREFIX}'])[0])"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE)
message("-- PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
message("-- PYTHON_SITE_PACKAGES: ${PYTHON_SITE_PACKAGES}")
# Include the CMake script UseCython.cmake. This defines add_cython_module().
# Instruction for use can be found at the top of cmake/UseCython.cmake.
FIND_PACKAGE(Cython)
message("-- Found Cython: ${Cython_FOUND}")
if(Cython_FOUND)
message(STATUS "Cython Version: ${CYTHON_VERSION}")
if("${CYTHON_VERSION}" VERSION_LESS "0.25")
message(FATAL_ERROR "Cython version is too old, must be 0.25+.")
endif()
include(UseCython)
find_package(Numpy REQUIRED)
find_package(Jinja2 REQUIRED)
find_package(Pandas REQUIRED)
# With CMake, a clean separation can be made between the source tree and the
# build tree. When all source is compiled, as with pure C/C++, the source is
# no-longer needed in the build tree. However, with pure *.py source, the
# source is processed directly. To handle this, we reproduce the availability
# of the source files in the build tree.
add_custom_target(ReplicatePythonSourceTree ALL "${CMAKE_COMMAND}" -P
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ReplicatePythonSourceTree.cmake"
"${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
# make sure we know about having python
add_definitions(-DCYCLUS_WITH_PYTHON)
IF (NOT APPLE)
set(LIBS ${LIBS} ${PYTHON_LIBRARIES})
ENDIF (NOT APPLE)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/cyclus")
else(Cython_FOUND)
# If we don't have Python bindings, we may try to find tcmalloc.
# Python has to be specially compiled for tcmalloc support, which it
# normally isn't.
FIND_PACKAGE(Tcmalloc)
SET(LIBS ${LIBS} ${Tcmalloc_LIBRARIES})
endif(Cython_FOUND)
##############################################################################################
#################################### end find libraries ######################################
##############################################################################################
##############################################################################################
###################################### begin includes ########################################
##############################################################################################
# include all the directories we just found
# NOTE: for some reason, adding quotes around
# ${Glibmm_INCLUDE_DIRS} breaks Ubuntu 12.04
set(inc_dirs
"${LIBXML2_INCLUDE_DIR}"
"${LibXML++_INCLUDE_DIR}"
"${Glibmm_INCLUDE_DIRS}"
"${LibXML++Config_INCLUDE_DIR}"
"${SQLITE3_INCLUDE_DIR}"
"${HDF5_INCLUDE_DIRS}"
"${Boost_INCLUDE_DIR}"
"${COIN_INCLUDE_DIRS}")
IF(NOT inc_dirs STREQUAL "")
INCLUDE_DIRECTORIES(${inc_dirs})
ENDIF()
message("-- Include Directories: ${inc_dirs}")
if(Cython_FOUND)
INCLUDE_DIRECTORIES(AFTER "${PYTHON_INCLUDE_DIRS}"
"${NUMPY_INCLUDE_DIRS}")
endif(Cython_FOUND)
# set core version, one way or the other
IF(NOT "${CORE_VERSION}" STREQUAL "")
SET(core_version "${CORE_VERSION}")
ELSE(NOT "${CORE_VERSION}" STREQUAL "")
EXECUTE_PROCESS(COMMAND git describe --tags
OUTPUT_VARIABLE core_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF(NOT "${CORE_VERSION}" STREQUAL "")
IF("${core_version}" STREQUAL "")
MESSAGE(WARNING "Unable to read current core version, falling back to previous version. Core version will be set to -1")
SET(core_version "-1")
ENDIF()
SET(ENV{CYCLUS_CORE_VERSION} "${core_version}")
MESSAGE("-- core version ($CYCLUS_CORE_VERSION) set to: ${core_version}")
ADD_SUBDIRECTORY("${CYCLUS_SHARE_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_SOURCE_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_TEST_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_AGENTS_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_CLI_DIR}")
ADD_SUBDIRECTORY("${CYCLUS_CMAKE_DIR}")
if(Cython_FOUND)
ADD_SUBDIRECTORY("${CYCLUS_PYSOURCE_DIR}")
endif(Cython_FOUND)
##############################################################################################
####################################### end includes #########################################
##############################################################################################
################# custom install files #######################################################
INSTALL(
FILES
stubs/CMakeLists.txt
stubs/example_facility.xml
stubs/example_inst.xml
stubs/example_region.xml
stubs/install.py
stubs/README.rst
DESTINATION share/cyclus/stubs
COMPONENT stubs
)
INSTALL(
FILES
stubs/src/CMakeLists.txt
stubs/src/stub_facility.h
stubs/src/stub_facility.cc
stubs/src/stub_facility_tests.cc
stubs/src/stub_inst.h
stubs/src/stub_inst.cc
stubs/src/stub_inst_tests.cc
stubs/src/stub_region.h
stubs/src/stub_region.cc
stubs/src/stub_region_tests.cc
stubs/src/stub_unit_test_driver.cc
DESTINATION share/cyclus/stubs/src
COMPONENT stubs
)
if(Cython_FOUND)
set(pyinstallscript "${CMAKE_CURRENT_BINARY_DIR}/cmake/SetupPyInstall.cmake")
configure_file(cmake/SetupPyInstall.cmake.in ${pyinstallscript} @ONLY)
install(SCRIPT ${pyinstallscript})
endif(Cython_FOUND)
##############################################################################################
################################## begin uninstall target ####################################
##############################################################################################
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
ADD_CUSTOM_TARGET(uninstall
COMMAND "${CMAKE_COMMAND}" -P "\"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake\"")
##############################################################################################
################################### end uninstall target #####################################
##############################################################################################
##############################################################################################
####################################### begin cpack ##########################################
##############################################################################################
# Here's where we package it with CPack
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cyclus : A nuclear fuel cycle simulator from UW-Madison.")
# Here we set some components for installation with cpack
SET(CPACK_COMPONENTS_ALL cyclus testing libraries data core)
SET(CPACK_GENERATOR "DEB")
# Organisation
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "CNERG, UW-Madison") #required
SET(CPACK_PACKAGE_VENDOR "CNERG, UW-Madison")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.rst")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.rst")
# Version
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "4")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
# Dependencies
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libtcmalloc-minimal4 (>= 2.1)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libboost-filesystem-dev (>= 1.54.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libboost-program-options-dev (>= 1.54.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libboost-serialization-dev (>= 1.54.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libhdf5-dev (>= 1.8.11)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libxml++2.6-dev (>= 2.36.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, coinor-libcbc-dev (>= 2.8.7)")
MESSAGE("CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
# Names
SET(CPACK_PACKAGE_NAME "cyclus")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "cyclus_${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_HASH_NAME}")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_SYSTEM_NAME}")
# Configuration
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "1")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/cmake/CyclusCPackOptions.cmake.in"
"${CYCLUS_BINARY_DIR}/cmake/CyclusCPackOptions.cmake" @ONLY
)
SET(CPACK_PROJECT_CONFIG_FILE "${CYCLUS_BINARY_DIR}/cmake/CyclusCPackOptions.cmake")
SET(CPACK_PACKAGE_EXECUTABLES "cyclus" "CyclusUnitTestDriver")
INCLUDE(CPack)
##############################################################################################
######################################## end cpack ###########################################
##############################################################################################
ENDIF(NOT CYCLUS_DOC_ONLY)
##############################################################################################
###################################### begin doxygen #########################################
##############################################################################################
# This is the directory that holds the doxygen doxyfile template (doxy.conf.in)
SET(DOC_SOURCE_DIR "${CYCLUS_SOURCE_DIR}")
SET(DOC_INPUT_DIR "${CYCLUS_DOC_DIR}")
SET(DOC_OUTPUT_DIR "${CMAKE_BINARY_DIR}/doc")
# If doxygen exists, use the doc/CMakeLists.txt file for further instructions.
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_SUBDIRECTORY("${CYCLUS_DOC_DIR}")
ELSE(DOXYGEN_FOUND)
MESSAGE(STATUS "WARNING: Doxygen not found - doc won't be created")
ENDIF(DOXYGEN_FOUND)
##############################################################################################
####################################### end doxygen ##########################################
##############################################################################################