forked from ComputationalRadiationPhysics/parataxis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
517 lines (425 loc) · 20.6 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
# Copyright 2015-2016 Alexander Grund
#
# This file is part of ParaTAXIS.
#
# ParaTAXIS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ParaTAXIS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ParaTAXIS. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 2.8.12.2)
################################################################################
# Project
################################################################################
project (XRayTracing)
set(PICONGPU_ROOT ~/picongpu CACHE PATH "Path to picongpu base directory")
#set helper pathes to find libraries and packages
set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" "$ENV{MPI_ROOT}" "$ENV{CUDA_ROOT}" "$ENV{BOOST_ROOT}")
# own modules for find_packages
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICONGPU_ROOT}/thirdParty/cmake-modules/)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "install prefix" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
################################################################################
# Find CUDA
################################################################################
find_package(CUDA 5.0 REQUIRED)
set(CUDA_ARCH sm_20 CACHE STRING "set GPU architecture" )
option(CUDA_FAST_MATH "use intrinsic GPU math functions" ON)
option(CUDA_FTZ "Set flush to zero for GPU" OFF)
option(CUDA_SHOW_CODELINES "Show kernel lines in cuda-gdb and cuda-memcheck" OFF)
option(CUDA_SHOW_REGISTER "show kernel register and create PTX" OFF)
option(CUDA_KEEP_FILES "Keep all intermediate files that are generated during internal compilation steps. (folder: nvcc_tmp)" OFF)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -arch=${CUDA_ARCH})
if(CUDA_FAST_MATH)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --use_fast_math)
endif()
if(NOT CUDA_FTZ)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --ftz=false)
endif()
if(CUDA_SHOW_REGISTER)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -Xptxas=-v)
endif()
if(CUDA_SHOW_CODELINES)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --source-in-ptx -Xcompiler -rdynamic -lineinfo)
set(CUDA_KEEP_FILES ON CACHE BOOL "activate keep files" FORCE)
endif()
if(CUDA_SHOW_REGISTER)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -Xptxas=-v)
endif()
if(CUDA_KEEP_FILES)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/nvcc_tmp")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --keep --keep-dir "${PROJECT_BINARY_DIR}/nvcc_tmp")
endif()
if(NOT CUDA_VERSION VERSION_LESS "7.5")
set(CUDA_RELAXED_CONSTEXPR "--expt-relaxed-constexpr")
elseif(NOT CUDA_VERSION VERSION_LESS "7.0")
set(CUDA_RELAXED_CONSTEXPR "--relaxed-constexpr")
else()
set(CUDA_RELAXED_CONSTEXPR "")
endif()
# Does not work with -G (bug in nvcc with std::map, -G and --relaxed-constexpr: #1690424)
if(NOT "${CUDA_NVCC_FLAGS}" MATCHES "-G")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${CUDA_RELAXED_CONSTEXPR}")
else()
message(WARNING "-G flag found for CUDA. Cannot use --relaxed-constexpr. Expect compiletime warnings!")
endif()
################################################################################
# VampirTrace
################################################################################
option(VAMPIR_ENABLE "Create with VampirTrace support" OFF)
# set filters: please do NOT use line breaks WITHIN the string!
set(VT_INST_FILE_FILTER
"stl,usr/include,libgpugrid,vector_types.h,Vector.hpp,DeviceBuffer.hpp,DeviceBufferIntern.hpp,Buffer.hpp,StrideMapping.hpp,StrideMappingMethods.hpp,MappingDescription.hpp,AreaMapping.hpp,AreaMappingMethods.hpp,ExchangeMapping.hpp,ExchangeMappingMethods.hpp,DataSpace.hpp,Manager.hpp,Manager.tpp,Transaction.hpp,Transaction.tpp,TransactionManager.hpp,TransactionManager.tpp,Vector.tpp,Mask.hpp,ITask.hpp,EventTask.hpp,EventTask.tpp,StandardAccessor.hpp,StandardNavigator.hpp,HostBuffer.hpp,HostBufferIntern.hpp"
CACHE STRING "VampirTrace: Files to exclude from instrumentation")
set(VT_INST_FUNC_FILTER
"vector,Vector,dim3,GPUGrid,execute,allocator,Task,Manager,Transaction,Mask,operator,DataSpace,PitchedBox,Event,new,getGridDim,GetCurrentDataSpaces,MappingDescription,getOffset,getParticlesBuffer,getDataSpace,getInstance"
CACHE STRING "VampirTrace: Functions to exclude from instrumentation")
if(VAMPIR_ENABLE)
message(STATUS "Building with VampirTrace support")
set(VAMPIR_ROOT "$ENV{VT_ROOT}")
if(NOT VAMPIR_ROOT)
message(FATAL_ERROR "Environment variable VT_ROOT not set!")
endif(NOT VAMPIR_ROOT)
# compile flags
execute_process(COMMAND $ENV{VT_ROOT}/bin/vtc++ -vt:hyb -vt:showme-compile
OUTPUT_VARIABLE VT_COMPILEFLAGS
RESULT_VARIABLE VT_CONFIG_RETURN
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT VT_CONFIG_RETURN EQUAL 0)
message(FATAL_ERROR "Can NOT execute 'vtc++' at $ENV{VT_ROOT}/bin/vtc++ - check file permissions")
endif()
# link flags
execute_process(COMMAND $ENV{VT_ROOT}/bin/vtc++ -vt:hyb -vt:showme-link
OUTPUT_VARIABLE VT_LINKFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# bugfix showme
string(REPLACE "--as-needed" "--no-as-needed" VT_LINKFLAGS "${VT_LINKFLAGS}")
# modify our flags
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${VT_LINKFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VT_COMPILEFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -finstrument-functions-exclude-file-list=${VT_INST_FILE_FILTER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -finstrument-functions-exclude-function-list=${VT_INST_FUNC_FILTER}")
# nvcc flags (rly necessary?)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-Xcompiler=-finstrument-functions,-finstrument-functions-exclude-file-list=\\\"${VT_INST_FILE_FILTER}\\\"
-Xcompiler=-finstrument-functions-exclude-function-list=\\\"${VT_INST_FUNC_FILTER}\\\"
-Xcompiler=-DVTRACE -Xcompiler=-I\\\"${VT_ROOT}/include/vampirtrace\\\"
-v)
# for manual instrumentation and hints that vampir is enabled in our code
add_definitions(-DVTRACE)
# titan work around: currently (5.14.4) the -D defines are not provided by -vt:showme-compile
add_definitions(-DMPICH_IGNORE_CXX_SEEK)
endif(VAMPIR_ENABLE)
################################################################################
# Score-P
################################################################################
option(SCOREP_ENABLE "Create with Score-P support" OFF)
if(SCOREP_ENABLE)
message(STATUS "Building with Score-P support")
set(SCOREP_ROOT "$ENV{SCOREP_ROOT}")
if(NOT SCOREP_ROOT)
message(FATAL_ERROR "Environment variable SCOREP_ROOT not set!")
endif(NOT SCOREP_ROOT)
# compile flags
execute_process(COMMAND $ENV{SCOREP_ROOT}/bin/scorep-config --nocompiler --cflags
OUTPUT_VARIABLE SCOREP_COMPILEFLAGS
RESULT_VARIABLE SCOREP_CONFIG_RETURN
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT SCOREP_CONFIG_RETURN EQUAL 0)
message(FATAL_ERROR "Can NOT execute 'scorep-config' at $ENV{SCOREP_ROOT}/bin/scorep-config - check file permissions")
endif()
# link flags
execute_process(COMMAND $ENV{SCOREP_ROOT}/bin/scorep-config --cuda --mpp=mpi --ldflags
OUTPUT_VARIABLE SCOREP_LINKFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# libraries
execute_process(COMMAND $ENV{SCOREP_ROOT}/bin/scorep-config --cuda --mpp=mpi --libs
OUTPUT_VARIABLE SCOREP_LIBFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP "${SCOREP_LIBFLAGS}" SCOREP_LIBFLAGS)
# subsystem iniialization file
execute_process(COMMAND $ENV{SCOREP_ROOT}/bin/scorep-config --cuda --mpp=mpi --adapter-init
OUTPUT_VARIABLE SCOREP_INIT_FILE
OUTPUT_STRIP_TRAILING_WHITESPACE)
file(WRITE ${CMAKE_BINARY_DIR}/scorep_init.c "${SCOREP_INIT_FILE}")
if(SCOREP_ENABLE)
set(SCOREP_SRCFILES "${CMAKE_BINARY_DIR}/scorep_init.c")
endif(SCOREP_ENABLE)
# modify our flags
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${SCOREP_LINKFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCOREP_COMPILEFLAGS}")
endif(SCOREP_ENABLE)
################################################################################
# Build type (debug, release)
################################################################################
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "Release version")
add_definitions(-DNDEBUG)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" "-Xcompiler=-pthread")
else()
message(STATUS "Debug version")
set(CMAKE_BUILD_TYPE Debug)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -g "-Xcompiler=-g,-pthread")
endif()
################################################################################
# Find MPI
################################################################################
find_package(MPI REQUIRED)
include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
list(APPEND LIBS ${MPI_CXX_LIBRARIES})
################################################################################
# Find Boost
################################################################################
find_package(Boost 1.49 REQUIRED COMPONENTS program_options regex system filesystem)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
list(APPEND LIBS ${Boost_LIBRARIES})
add_definitions(-DBOOST_RESULT_OF_USE_TR1)
################################################################################
# Find OpenMP
################################################################################
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
################################################################################
# Find mallocMC
################################################################################
find_package(mallocMC 2.1.0 QUIET)
if(NOT mallocMC_FOUND)
message(STATUS "Using mallocMC from ${PICONGPU_ROOT}/thirdParty/ directory")
set(MALLOCMC_ROOT "${PICONGPU_ROOT}/thirdParty/mallocMC" CACHE PATH "Path to MallocMC")
find_package(mallocMC 2.1.0 REQUIRED)
endif(NOT mallocMC_FOUND)
include_directories(SYSTEM ${mallocMC_INCLUDE_DIRS})
add_definitions(${mallocMC_DEFINITIONS})
list(APPEND LIBS ${mallocMC_LIBRARIES})
################################################################################
# PMacc options
################################################################################
find_path(PMACC_ROOT_DIR
NAMES include/pmacc_types.hpp
PATHS "${PICONGPU_ROOT}/src/libPMacc"
DOC "libPMacc root location."
)
include_directories(${PMACC_ROOT_DIR}/include)
option(PMACC_BLOCKING_KERNEL "Activate checks for every kernel call and synchronize after every kernel call" OFF)
if(PMACC_BLOCKING_KERNEL)
add_definitions(-DPMACC_SYNC_KERNEL=1)
endif(PMACC_BLOCKING_KERNEL)
set(PMACC_VERBOSE "0" CACHE STRING "Set verbosity level for libPMacc")
add_definitions(-DPMACC_VERBOSE_LVL=${PMACC_VERBOSE})
################################################################################
# PARAM (overwrite) defines
################################################################################
if(PARAM_OVERWRITES)
foreach(param ${PARAM_OVERWRITES})
add_definitions(${param})
endforeach(param)
endif(PARAM_OVERWRITES)
################################################################################
# PARATAXIS
################################################################################
set(PARATAXIS_VERBOSE "1" CACHE STRING "Set verbosity level for PARATAXIS")
add_definitions(-DPARATAXIS_VERBOSE_LVL=${PARATAXIS_VERBOSE})
option(PARATAXIS_CHECK_PHOTON_CT "Checks if the number of photons generated can fit into the memory" ON)
option(PARATAXIS_FORCE_SINGLE_SCATTERING "Make particles scatter only once" OFF)
set(PARATAXIS_NVPROF_START_TS 200 CACHE STRING "Start profiling at this timestep")
set(PARATAXIS_NVPROF_NUM_TS 0 CACHE STRING "Number of timesteps to profile. 0 = Disabled")
if(PARATAXIS_CHECK_PHOTON_CT)
add_definitions(-DPARATAXIS_CHECK_PHOTON_CT=1)
else()
add_definitions(-DPARATAXIS_CHECK_PHOTON_CT=0)
endif()
if(PARATAXIS_FORCE_SINGLE_SCATTERING)
add_definitions(-DPARATAXIS_FORCE_SINGLE_SCATTERING=1)
else()
add_definitions(-DPARATAXIS_FORCE_SINGLE_SCATTERING=0)
endif()
add_definitions(-DPARATAXIS_NVPROF_START_TS=${PARATAXIS_NVPROF_START_TS} -DPARATAXIS_NVPROF_NUM_TS=${PARATAXIS_NVPROF_NUM_TS})
################################################################################
# Warnings
################################################################################
# GNU
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
# new warning in gcc 4.8 (flag ignored in previous version)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
# ICC
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_VARIADIC_TEMPLATES")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_CXX11_VARIADIC_TEMPLATES")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_FENV_H")
# PGI
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform")
endif()
################################################################################
# libSplash (+ hdf5 due to required headers)
################################################################################
# find libSplash installation
# prefer static libraries over shared ones (but do not force them)
set(Splash_USE_STATIC_LIBS ON)
find_package(Splash 1.4.0 COMPONENTS PARALLEL)
if(Splash_FOUND)
include_directories(SYSTEM ${Splash_INCLUDE_DIRS})
list(APPEND Splash_DEFINITIONS "-DPARATAXIS_ENABLE_HDF5=1")
add_definitions(${Splash_DEFINITIONS})
list(APPEND LIBS ${Splash_LIBRARIES})
message(STATUS "HDF5 support activated")
else()
add_definitions("-DPARATAXIS_ENABLE_HDF5=0")
endif(Splash_FOUND)
################################################################################
# PNGwriter
################################################################################
# find PNGwriter installation
find_package(PNGwriter 0.5.5)
if(PNGwriter_FOUND)
include_directories(SYSTEM ${PNGwriter_INCLUDE_DIRS})
list(APPEND PNGwriter_DEFINITIONS "-DPARATAXIS_ENABLE_PNG=1")
add_definitions(${PNGwriter_DEFINITIONS})
list(APPEND LIBS ${PNGwriter_LIBRARIES})
message(STATUS "PNG output support activated")
else()
add_definitions("-DPARATAXIS_ENABLE_PNG=0")
endif()
################################################################################
# TiffWriter
################################################################################
find_package(TiffWriter 0.2.0)
if(TiffWriter_FOUND)
include_directories(${TiffWriter_INCLUDE_DIRS})
list(APPEND TiffWriter_DEFINITIONS "-DPARATAXIS_ENABLE_TIFF=1")
add_definitions(${TiffWriter_DEFINITIONS})
list(APPEND LIBS ${TiffWriter_LIBRARIES})
message(STATUS "TIFF output support activated")
else()
add_definitions("-DPARATAXIS_ENABLE_TIFF=0")
endif()
################################################################################
# C++11 Support
################################################################################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11")
################################################################################
# Check for PARATAXIS_EXTENSION_PATH
################################################################################
find_path(PARATAXIS_EXTENSION_PATH
NAMES include/simulation_defines/param/precision.param include/simulation_defines/param/speciesDefinition.param
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
DOC "search PATH to extension folder"
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)
include_directories(include)
if(PARATAXIS_EXTENSION_PATH)
include_directories(BEFORE ${PARATAXIS_EXTENSION_PATH}/include)
message(STATUS "Using extension path: ${PARATAXIS_EXTENSION_PATH}")
endif()
################################################################################
# IDE support
################################################################################
if(${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
# The indexer gets confused, if PARAM_PRECISION is undefined
get_directory_property(CurDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
if(NOT "${CurDefs}" MATCHES "PARAM_PRECISION")
add_definitions(-DPARAM_PRECISION=precision64Bit)
endif()
endif()
################################################################################
# Compile & Link
################################################################################
set(CUDASRCFILES "main.cu")
set(SRCFILES "include/plugins/common/stringHelpers.cpp")
cuda_add_executable(${PROJECT_NAME}
${CUDASRCFILES}
${SRCFILES}
${SCOREP_SRCFILES}
)
if(VAMPIR_ENABLE)
set(LIBS vt-hyb ${LIBS} )
endif(VAMPIR_ENABLE)
target_link_libraries(${PROJECT_NAME} ${LIBS} m)
if(SCOREP_ENABLE)
# Score-P libraries must be linked after the object to prevent symbols
# from being stripped on Titan
target_link_libraries(${PROJECT_NAME} ${SCOREP_LIBFLAGS})
endif(SCOREP_ENABLE)
################################################################################
# Configure
################################################################################
set(PARATAXIS_BASE_CFG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/submit")
file(GLOB CFG_Files RELATIVE "${PARATAXIS_BASE_CFG_PATH}" "${PARATAXIS_BASE_CFG_PATH}/*.cfg.in")
if(PARATAXIS_EXTENSION_PATH)
set(PARATAXIS_EXTENSION_CFG_PATH "${PARATAXIS_EXTENSION_PATH}/submit")
file(GLOB CFG_Files_Ext RELATIVE "${PARATAXIS_EXTENSION_CFG_PATH}" "${PARATAXIS_EXTENSION_CFG_PATH}/*.cfg.in")
list(APPEND CFG_Files ${CFG_Files_Ext})
list(REMOVE_DUPLICATES CFG_Files)
endif()
foreach(fileName ${CFG_Files})
get_filename_component(fileNoExt ${fileName} NAME_WE)
if(PARATAXIS_EXTENSION_PATH AND EXISTS "${PARATAXIS_EXTENSION_CFG_PATH}/${fileName}")
set(file "${PARATAXIS_EXTENSION_CFG_PATH}/${fileName}")
else()
set(file "${PARATAXIS_BASE_CFG_PATH}/${fileName}")
endif()
configure_file(${file} "submit/${fileNoExt}.cfg" @ONLY)
endforeach()
################################################################################
# Install
################################################################################
function(ForceCopyOnInstall BASE_SRC_PATH SUB_DIR)
file(GLOB_RECURSE _FILES "${BASE_SRC_PATH}/${SUB_DIR}/*")
foreach(file ${_FILES})
string(REPLACE "${BASE_SRC_PATH}/" "" destFile "${file}")
# Remove existing file
install(CODE "file(REMOVE \"${CMAKE_INSTALL_PREFIX}/${destFile}\")")
install(FILES "${file}" DESTINATION "${CMAKE_INSTALL_PREFIX}" RENAME "${destFile}")
endforeach()
endfunction()
# Binaries
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/buildSystem"
DESTINATION ${CMAKE_INSTALL_PREFIX}
PATTERN *.pyc EXCLUDE
PATTERN __pycache__ EXCLUDE)
# Submit files
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/submit"
DESTINATION ${CMAKE_INSTALL_PREFIX}
USE_SOURCE_PERMISSIONS
PATTERN *.in EXCLUDE)
# Configured submit files (cfgs)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/submit"
DESTINATION "${CMAKE_INSTALL_PREFIX}")
# Config files for reference what was compiled (might be changed after compile)
# Base simulation config
install(DIRECTORY "include/simulation_defines"
DESTINATION ${CMAKE_INSTALL_PREFIX})
# Extension simulation config (overwrite base)
if(PARATAXIS_EXTENSION_PATH)
# Overwrite with extension files
ForceCopyOnInstall("${PARATAXIS_EXTENSION_PATH}/include" "simulation_defines")
if(EXISTS "${PARATAXIS_EXTENSION_PATH}/testData")
install(DIRECTORY "${PARATAXIS_EXTENSION_PATH}/testData"
DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
endif()