-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
545 lines (504 loc) · 21.7 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
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
#
# Project name
project(EOS VERSION 2.0.0 LANGUAGES CXX C Fortran)
#
# Include CMAKE
# - path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Tools")
# - include
include(func_def)
# Initialisation
# --------------
# - set EOS version
set(EOSFILES Tools/eos.in Readme/en/Changelog.txt Readme/fr/Changelog.txt index.html Modules/index.html Modules/EOS/API/EOS.cxx)
file(GLOB_RECURSE DOXYFILES RELATIVE ${CMAKE_SOURCE_DIR} Doxyfile)
set(EOSFILES ${EOSFILES} ${DOXYFILES})
foreach(EOSFILE ${EOSFILES} )
configure_file(${CMAKE_SOURCE_DIR}/${EOSFILE} ${CMAKE_BINARY_DIR}/${EOSFILE} @ONLY)
endforeach(EOSFILE)
# - subdirectories
set(EOS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
set(EOS_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(EOS_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
set(EOS_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
set(EOS_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data)
set(EOS_DOC_DIR ${CMAKE_INSTALL_PREFIX}/doc)
set(EOS_DOC_TM_DIR ${EOS_DOC_DIR}/Thermo_Models)
#
# Test with CTest
enable_testing()
#
#
message ("")
message (STATUS " --- EOS version : ${EOS_VERSION}")
message (STATUS " > Source directory : ${CMAKE_SOURCE_DIR}")
message (STATUS " > Execution directory : ${CMAKE_BINARY_DIR}")
message (STATUS " > Installation directory : ${EOS_INSTALL_DIR}")
message ("")
#
# Some CMAKE information
message (STATUS " --- CMAKE version : ${CMAKE_VERSION}")
message (STATUS " > O.S. version : ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}")
message (STATUS " > C++ compiler : ${CMAKE_CXX_COMPILER}")
message (STATUS " > C compiler : ${CMAKE_C_COMPILER}")
message (STATUS " > Fortran compiler : ${CMAKE_Fortran_COMPILER}")
message ("")
#
# Plugins
set(WITH_PLUGIN_CATHARE "" CACHE PATH "Defines the root of Cathare plugin sources")
set(WITH_PLUGIN_CATHARE2 "" CACHE PATH "Defines the root of Cathare2 plugin sources")
set(WITH_PLUGIN_HITEC "" CACHE PATH "Defines the root of Hitec plugin sources")
set(WITH_PLUGIN_NAK "" CACHE PATH "Defines the root of Nak plugin sources")
set(WITH_PLUGIN_THETIS "" CACHE PATH "Defines the root of Thetis plugin sources")
set(WITH_PLUGIN_REFPROP_9 "" CACHE PATH "Defines the root of Refprop9 plugin sources")
set(WITH_PLUGIN_REFPROP_10 "" CACHE PATH "Defines the root of Refprop10 plugin sources")
set(WITH_PLUGIN_FLICA4 "" CACHE PATH "Defines the root of Flica4 plugin sources")
# Prerequisites
# -------------
set(pc_libs_private "")
set(pc_req_private_list "")
#
# MPI
if (USER_MPI_PATH)
message(STATUS "mpi path specified by user : ${USER_MPI_PATH}")
set (MPI_INC ${USER_MPI_PATH}/include)
set (MPI_LIB_DIR ${USER_MPI_PATH}/lib)
set(ENV{LD_LIBRARY_PATH} ${USER_MPI_PATH}/lib/:$ENV{LD_LIBRARY_PATH} )
message(STATUS "option --with-mpi=<path> adds ${USER_MPI_PATH}/lib to LD_LIBRARY_PATH")
endif (USER_MPI_PATH)
if (USER_MPI_INCLUDE_PATH)
message(STATUS "mpi include path specified by user : ${USER_MPI_INCLUDE_PATH}")
set (MPI_INC ${USER_MPI_INCLUDE_PATH})
endif (USER_MPI_INCLUDE_PATH)
if (USER_MPI_LIB_PATH)
message(STATUS "mpi library path specified by user : ${USER_MPI_LIB_PATH}")
set (MPI_LIB_DIR ${USER_MPI_LIB_PATH})
endif (USER_MPI_LIB_PATH)
if (MPI_LIB_DIR)
find_library(MPI_LIB1 NAMES mpi PATHS ${MPI_LIB_DIR} NO_DEFAULT_PATH)
find_library(MPI_LIB2 NAMES mpi_cxx PATHS ${MPI_LIB_DIR} NO_DEFAULT_PATH)
set (MPI_LIB ${MPI_LIB1} ${MPI_LIB2})
if (NOT MPI_LIB)
message(FATAL_ERROR "Not found MPI libraries after MPI user request")
endif (NOT MPI_LIB)
list(APPEND pc_req_private_list "ompi ompi-cxx")
endif (MPI_LIB_DIR)
#
# HDF5
if (USER_HDF5_PATH)
message(STATUS "hdf5 path specified by user : ${USER_HDF5_PATH}")
set (HDF5_INC ${USER_HDF5_PATH}/include)
set (HDF5_LIB_DIR ${USER_HDF5_PATH}/lib)
set(ENV{LD_LIBRARY_PATH} ${USER_HDF5_PATH}/lib/:$ENV{LD_LIBRARY_PATH} )
message(STATUS "option --with-hdf5=<path> adds ${USER_HDF5_PATH}/lib to LD_LIBRARY_PATH")
endif (USER_HDF5_PATH)
if (USER_HDF5_LIB_PATH)
message(STATUS "hdf5 library path specified by user : ${USER_HDF5_LIB_PATH}")
set (HDF5_LIB_DIR ${USER_HDF5_LIB_PATH})
endif (USER_HDF5_LIB_PATH)
if (HDF5_LIB_DIR)
set (CMAKE_FIND_LIBRARY_SUFFIXES .so)
find_library(HDF5_SHAREDLIB NAMES hdf5 PATHS ${HDF5_LIB_DIR} NO_DEFAULT_PATH)
set (HDF5_SHAREDLIB ${HDF5_SHAREDLIB} -L${HDF5_LIB_DIR} -lhdf5)
if (NOT HDF5_SHAREDLIB)
message(FATAL_ERROR "Not found HDF5 shared library after HDF5 user request")
endif (NOT HDF5_SHAREDLIB)
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
find_library(HDF5_STATICLIB NAMES hdf5 PATHS ${HDF5_LIB_DIR} NO_DEFAULT_PATH)
if (NOT HDF5_STATICLIB)
# message(FATAL_ERROR "Not found HDF5 static library after HDF5 user request")
set(HDF5_STATICLIB ${HDF5_SHAREDLIB})
endif (NOT HDF5_STATICLIB)
set (CMAKE_FIND_LIBRARY_SUFFIXES .so)
list(APPEND pc_req_private_list "hdf5")
endif (HDF5_LIB_DIR)
#
# MED
if (USER_MED_PATH)
message(STATUS "med path specified by user : ${USER_MED_PATH}")
set (MED_INC ${USER_MED_PATH}/include)
set (MED_LIB_DIR ${USER_MED_PATH}/lib)
set(ENV{LD_LIBRARY_PATH} ${USER_MED_PATH}/lib/:$ENV{LD_LIBRARY_PATH} )
message(STATUS "option --with-med=<path> adds ${USER_MED_PATH}/lib to LD_LIBRARY_PATH")
endif(USER_MED_PATH)
if (USER_MED_INCLUDE_PATH)
message(STATUS "med include path specified by user : ${USER_MED_INCLUDE_PATH}")
set (MED_INC ${USER_MED_INCLUDE_PATH})
endif (USER_MED_INCLUDE_PATH)
if (USER_MED_LIB_PATH)
message(STATUS "med library path specified by user : ${USER_MED_LIB_PATH}")
set (MED_LIB_DIR ${USER_MED_LIB_PATH})
endif (USER_MED_LIB_PATH)
if (MED_LIB_DIR)
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
find_library(MED_STATICLIB1 NAMES med PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
find_library(MED_STATICLIB2 NAMES medC PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
find_library(MED_STATICLIB3 NAMES medimport PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
set (MED_STATICLIB ${MED_STATICLIB1} ${MED_STATICLIB2} ${MED_STATICLIB3})
if (NOT MED_STATICLIB)
message(FATAL_ERROR "Not found MED static library after MED user request")
endif (NOT MED_STATICLIB)
set (CMAKE_FIND_LIBRARY_SUFFIXES .so)
find_library(MED_SHAREDLIB1 NAMES med PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
find_library(MED_SHAREDLIB2 NAMES medC PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
find_library(MED_SHAREDLIB3 NAMES medimport PATHS ${MED_LIB_DIR} NO_DEFAULT_PATH)
set (MED_SHAREDLIB ${MED_SHAREDLIB1} ${MED_SHAREDLIB2} ${MED_SHAREDLIB3})
if (NOT MED_SHAREDLIB)
message(FATAL_ERROR "Not found MED shared library after MED user request")
endif (NOT MED_SHAREDLIB)
list(APPEND pc_libs_private "-L${MED_LIB_DIR} -lmedimport -lmedC -lmed")
endif (MED_LIB_DIR)
#
# RPC
option(FORCE_GLIBC_RPC "Do not try to search tirpc, will only use rpc provided by glibc" OFF)
option(INSTALL_TIRPC "Install Ti-RPC before compiling EOS" OFF)
set(USER_TIRPC_PATH "" CACHE PATH "Path to tirpc root directory")
set(USER_TIRPC_LIB_PATH "" CACHE PATH "Path to tirpc lib directory")
set(USER_TIRPC_INCLUDE_PATH "" CACHE PATH "Path to tirpc include directory")
if(WITH_PLUGIN_FLICA4)
include(EOS_RPC)
endif()
#
# Error messages
if (WITH_IPP)
if (NOT EXISTS ${MED_INC})
message(FATAL_ERROR "MED include files are required for Interpolator. You must choose one option among : --with-med=<path> --with-med-include=<path>")
endif (NOT EXISTS ${MED_INC})
if (NOT EXISTS ${MED_LIB_DIR})
message(FATAL_ERROR "MED library file is required for Interpolator. You must choose one option among : --with-med=<path> --with-med-lib=<path>")
endif (NOT EXISTS ${MED_LIB_DIR})
if (NOT EXISTS ${HDF5_LIB_DIR})
message(FATAL_ERROR "HDF5 library file is required for Interpolator. You must choose one option among : --with-hdf5=<path> --with-hdf5-lib=<path>")
endif (NOT EXISTS ${HDF5_LIB_DIR})
endif (WITH_IPP)
#
# Exterior include directories : GLOBALEXT_INC variable
set (GLOBALEXT_INC ${MPI_INC} ${HDF5_INC} ${MED_INC} ${RPC_INC})
#
# Exterior library files : GLOBALEXT_LIB variable
set (GLOBALEXT_LIB ${MPI_LIB} ${HDF5_SHAREDLIB} ${MED_SHAREDLIB} ${RPC_LIB})
set (GLOBALEXT_STATICLIB ${MPI_LIB} ${HDF5_STATICLIB} ${MED_STATICLIB} ${RPC_STATIC_LIB})
# Configure parameters
# --------------------
#
# WITH_DOC_DOXYGEN
option (WITH_DOC_DOXYGEN "Build documentation with Doxygen" OFF)
message(STATUS "Option WITH_DOC_DOXYGEN : ${WITH_DOC_DOXYGEN}")
if (WITH_DOC_DOXYGEN)
if (USER_DOXYGEN_EXECUTABLE)
message(STATUS "Doxygen executable specified by user : ${USER_DOXYGEN_EXECUTABLE}")
set (DOXYGEN_EXECUTABLE ${USER_DOXYGEN_EXECUTABLE})
else (USER_DOXYGEN_EXECUTABLE)
find_package(Doxygen)
if (NOT DOXYGEN_FOUND)
message(STATUS "Not found Doxygen")
message(FATAL_ERROR "Doxygen is required to build documentation. You must choose one option among :--without-doc-doxygen, --with-doxygen=<path>, --with-doxygen-exec=<path>/doxygen")
endif (NOT DOXYGEN_FOUND)
endif (USER_DOXYGEN_EXECUTABLE)
if (NOT EXISTS ${DOXYGEN_EXECUTABLE})
message(FATAL_ERROR "File not found : ${DOXYGEN_EXECUTABLE}")
endif (NOT EXISTS ${DOXYGEN_EXECUTABLE})
endif (WITH_DOC_DOXYGEN)
#
# WITH_DOC_LATEX
option (WITH_DOC_LATEX "Build documentation with Latex" OFF)
message(STATUS "Option WITH_DOC_LATEX : ${WITH_DOC_LATEX}")
message(STATUS "Info_global with-doc-latex ${WITH_DOC_LATEX}")
if (WITH_DOC_LATEX)
find_package(LATEX)
if (NOT LATEX_COMPILER)
message(FATAL_ERROR "Latex compiler is required to build documentation. You must use the option --without-doc-latex")
endif (NOT LATEX_COMPILER)
endif (WITH_DOC_LATEX)
#
# WITH_PYTHON_API
option (WITH_PYTHON_API "Build EOS python API" OFF)
message(STATUS "Option WITH_PYTHON_API : ${WITH_PYTHON_API}")
if (WITH_PYTHON_API)
message(FATAL_ERROR "Build EOS python API is not yet implemented. You must use the option --without-python-api")
endif (WITH_PYTHON_API)
# Compilation and Linking Definition
# ----------------------------------
#
#
# Initialisation Objects libraries targets lists
set(LCOMM_TGT_OBJ "" CACHE STRING LCOMM_TGT_OBJ FORCE) # Common
set(LLANG_TGT_OBJ "" CACHE STRING LLANG_TGT_OBJ FORCE) # EOS Language
set(LFUNC_TGT_OBJ "" CACHE STRING LFUNC_TGT_OBJ FORCE) # EOS Functions
set(LTM_TGT_OBJ "" CACHE STRING LTM_TGT_OBJ FORCE) # Thermodynamic Models
set(LIPP_TGT_OBJ "" CACHE STRING LIPP_TGT_OBJ FORCE) # Interpolator
mark_as_advanced(LCOMM_TGT_OBJ LLANG_TGT_OBJ LFUNC_TGT_OBJ LTM_TGT_OBJ LIPP_TGT_OBJ)
#
# Temporary shared libraries
set(NLIB_LANG "CCLanguageAPI") # EOS Language
set(NLIB_FUNC "CCFunctions") # EOS Functions
set(NLIB_TM "CCEOSAPI") # Thermodynamic Models
set(NLIB_IHM "eosihmcmodule") # IHM
if (WITH_IPP)
set(NLIB_IPP "CCEOSIGenAPI") # Interpolator
endif (WITH_IPP)
#
# EOS library name
set(EOS_LIB_NAME "eos")
option(BUILD_STATIC_LIB "Option to build static EOS library libeos.a" ON)
option(BUILD_SHARED_LIB "Option to build dynamic EOS library libeos.so" ON)
if(NOT BUILD_SHARED_LIB AND NOT BUILD_STATIC_LIB)
message(FATAL_ERROR "Error, you can't de-activate the build of both shared and static libraries")
endif()
#
# General compilation options
set(COMP_FLAGS -DNO_PVM_ -DCN_RSIZE=8 -DCN_ISIZE=4 -D_COMPILE_AVEC_GCC_ -DF77CALLWITH_ -fPIC)
if (USER_MED_PATH OR USER_MED_INCLUDE_PATH)
set(COMP_FLAGS "${COMP_FLAGS} -DMED_API_23")
endif (USER_MED_PATH OR USER_MED_INCLUDE_PATH)
if (ADD_COMP_FLAGS)
string(REGEX REPLACE "," " " ADD_COMP_FLAGS "${ADD_COMP_FLAGS}")
set(COMP_FLAGS "${COMP_FLAGS} ${ADD_COMP_FLAGS}")
endif (ADD_COMP_FLAGS)
#
add_definitions(${COMP_FLAGS})
# Options EOS de compilation C++, C, Fortran
set(EOS_CXX_FLAGS "-std=c++11 -Wall -Wextra")
#
set(EOS_C_FLAGS "-Wall -Wextra -Werror")
#
set(EOS_F_FLAGS "-Wall")
set(EOS_F_FLAGS "${EOS_F_FLAGS} ${EOS_F_FLAGS}")
if (NCOMP_F STREQUAL "ifort") # ifort
set(EOS_F_FLAGS "${EOS_F_FLAGS} -extend-source 132")
else (NCOMP_F STREQUAL "ifort") # gfortra, g77 ou autres
set(EOS_F_FLAGS "${EOS_F_FLAGS} -ffixed-line-length-132")
endif (NCOMP_F STREQUAL "ifort")
SET(CMAKE_Fortran_FLAGS_RELEASE " -O2 -fPIC " CACHE STRING "to ..." FORCE)
# Options globales de compilation C++, C, Fortran
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EOS_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EOS_C_FLAGS}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${EOS_F_FLAGS}")
#
# Include files
include_directories(BEFORE ${EOS_SOURCE_DIR}/Modules)
#
# use RPATH
set (CMAKE_INSTALL_RPATH ${EOS_LIB_DIR})
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Documentation, tests
# --------------------
#
add_subdirectory(Doc)
add_subdirectory(Modules)
#
# Define target doc-latex if not done before
if(NOT TARGET doc-latex)
message(STATUS "Add target doc-latex")
add_custom_target(doc-latex ALL
COMMENT "Nothing to do for doc-latex")
endif(NOT TARGET doc-latex)
# Code generation
# ---------------
#
# Configure EOS_Config.hxx
configure_file(Tools/EOS_Config.hxx.in
Modules/EOS/API/EOS_Config.hxx)
# objects list
set(LSO "")
foreach(TGT_OBJ ${LCOMM_TGT_OBJ} ${LLANG_TGT_OBJ}
${LFUNC_TGT_OBJ} ${LTM_TGT_OBJ}
${LIPP_TGT_OBJ})
set(LSO ${LSO} $<TARGET_OBJECTS:${TGT_OBJ}>)
endforeach(TGT_OBJ)
#
# EOS static library definition
if(BUILD_STATIC_LIB)
set(EOS_LIB_STAT "static_${EOS_LIB_NAME}")
add_library(${EOS_LIB_STAT} STATIC ${LSO})
target_link_libraries(${EOS_LIB_STAT} PUBLIC ${GLOBALEXT_STATICLIB})
target_include_directories(${EOS_LIB_STAT} PUBLIC $<INSTALL_INTERFACE:include/>)
set_target_properties(${EOS_LIB_STAT} PROPERTIES OUTPUT_NAME ${EOS_LIB_NAME}
IMPORTED_LOCATION_RELEASE ${EOS_LIB_DIR})
endif(BUILD_STATIC_LIB)
#
# EOS shared library definition
if(BUILD_SHARED_LIB)
set(EOS_LIB_SHAR "shared_${EOS_LIB_NAME}")
add_library(${EOS_LIB_SHAR} SHARED ${LSO})
target_link_libraries(${EOS_LIB_SHAR} PUBLIC ${GLOBALEXT_LIB})
target_include_directories(${EOS_LIB_SHAR} PUBLIC $<INSTALL_INTERFACE:include/>)
set_target_properties(${EOS_LIB_SHAR} PROPERTIES OUTPUT_NAME ${EOS_LIB_NAME}
VERSION ${EOS_VERSION}
SOVERSION ${EOS_VERSION}
IMPORTED_LOCATION_RELEASE ${EOS_LIB_DIR})
endif(BUILD_SHARED_LIB)
# Installation Definition
# -----------------------
#
# Libraries
if(BUILD_STATIC_LIB)
install(TARGETS ${EOS_LIB_STAT}
EXPORT EOSTargets
ARCHIVE DESTINATION ${EOS_LIB_DIR})
endif(BUILD_STATIC_LIB)
if(BUILD_SHARED_LIB)
install(TARGETS ${EOS_LIB_SHAR}
EXPORT EOSTargets
LIBRARY DESTINATION ${EOS_LIB_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif(BUILD_SHARED_LIB)
#
# Executable files
install(PROGRAMS ${CMAKE_BINARY_DIR}/Tools/eos_gui DESTINATION ${EOS_BIN_DIR})
install(PROGRAMS ${CMAKE_BINARY_DIR}/Tools/eos.in DESTINATION ${EOS_BIN_DIR} RENAME eos)
install(PROGRAMS ${CMAKE_SOURCE_DIR}/Tools/eos_data DESTINATION ${EOS_BIN_DIR})
install(PROGRAMS ${CMAKE_SOURCE_DIR}/Tools/eos_mec DESTINATION ${EOS_BIN_DIR})
#
# Include files
set(HEADERS_TO_INSTALL ${CMAKE_SOURCE_DIR}/Modules/Common
${CMAKE_BINARY_DIR}/Modules/Common
${CMAKE_SOURCE_DIR}/Modules/Language
${CMAKE_BINARY_DIR}/Modules/Language
${CMAKE_SOURCE_DIR}/Modules/Functions
${CMAKE_BINARY_DIR}/Modules/Functions
${CMAKE_SOURCE_DIR}/Modules/EOS
${CMAKE_BINARY_DIR}/Modules/EOS
${CMAKE_SOURCE_DIR}/Modules/system
${CMAKE_BINARY_DIR}/Modules/system
)
if (WITH_IPP)
list(APPEND HEADERS_TO_INSTALL ${CMAKE_SOURCE_DIR}/Modules/EOS_IGen ${CMAKE_BINARY_DIR}/Modules/EOS_IGen)
endif (WITH_IPP)
if(WITH_PLUGIN_FLICA4)
foreach(dir ${HEADERS_TO_INSTALL})
install(DIRECTORY ${dir}
DESTINATION ${EOS_INCLUDE_DIR}
FILES_MATCHING PATTERN "*.hxx" PATTERN "*.h" PATTERN "*.H"
PATTERN "CMake*" EXCLUDE PATTERN "Tests" EXCLUDE PATTERN "Doc" EXCLUDE
PATTERN "Data" EXCLUDE PATTERN "PyAPI" EXCLUDE)
endforeach()
else(WITH_PLUGIN_FLICA4)
foreach(dir ${HEADERS_TO_INSTALL})
install(DIRECTORY ${dir}
DESTINATION ${EOS_INCLUDE_DIR}
FILES_MATCHING PATTERN "*.hxx" PATTERN "*.h" PATTERN "*.H"
PATTERN "CMake*" EXCLUDE PATTERN "Tests" EXCLUDE PATTERN "Doc" EXCLUDE
PATTERN "Data" EXCLUDE PATTERN "PyAPI" EXCLUDE PATTERN "*FLICA4*" EXCLUDE
PATTERN "*ubicSpline*" EXCLUDE)
endforeach()
endif(WITH_PLUGIN_FLICA4)
#
# Data and documentation
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/EOS/Data/ DESTINATION ${EOS_DATA_DIR}
PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE PATTERN "Makefile" EXCLUDE)
if (WITH_DOC_DOXYGEN)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/Doc
DESTINATION ${EOS_DOC_DIR}/Modules)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/Language/Doc
DESTINATION ${EOS_DOC_DIR}/Modules/Language)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/Functions/Doc
DESTINATION ${EOS_DOC_DIR}/Modules/Functions)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/EOS/Doc
DESTINATION ${EOS_DOC_DIR}/Modules/EOS)
if (WITH_IPP)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Modules/EOS_IGen/Doc
DESTINATION ${EOS_DOC_DIR}/Modules/EOS_IGen)
endif (WITH_IPP)
endif (WITH_DOC_DOXYGEN)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Readme ${CMAKE_BINARY_DIR}/Readme DESTINATION ${EOS_DOC_DIR})
install(FILES ${CMAKE_BINARY_DIR}/Modules/index.html DESTINATION ${EOS_DOC_DIR}/Modules)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Doc ${CMAKE_BINARY_DIR}/Doc
DESTINATION ${EOS_DOC_DIR}
PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE PATTERN "Makefile" EXCLUDE)
#
# Tests files
set(EOS_TESTS_DIR ${CMAKE_INSTALL_PREFIX}/share/tests)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Modules/EOS/Tests/ ${CMAKE_BINARY_DIR}/Modules/EOS/Tests/
DESTINATION ${EOS_TESTS_DIR}/EOS
FILES_MATCHING PATTERN "*.cxx" PATTERN "*.f" PATTERN "*Test*"
PATTERN "output*" PATTERN "*.val" PATTERN "*.valeos*"
PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Modules/Language/Tests/ ${CMAKE_BINARY_DIR}/Modules/Language/Tests/
DESTINATION ${EOS_TESTS_DIR}/Language
FILES_MATCHING PATTERN "*.cxx" PATTERN "*.f" PATTERN "*Test*"
PATTERN "output*" PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Modules/Functions/Tests/ ${CMAKE_BINARY_DIR}/Modules/Functions/Tests/
DESTINATION ${EOS_TESTS_DIR}/Functions
FILES_MATCHING PATTERN "*.cxx" PATTERN "*Test*" PATTERN "output*"
PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE)
if (WITH_IPP)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Modules/EOS_IGen/Tests/ ${CMAKE_BINARY_DIR}/Modules/EOS_IGen/Tests/
DESTINATION ${EOS_TESTS_DIR}/EOS_IGen
FILES_MATCHING PATTERN "*.cxx" PATTERN "*Test*" PATTERN "output*"
PATTERN "CMake*" EXCLUDE PATTERN "*.cmake" EXCLUDE)
endif (WITH_IPP)
#
# GUI files
set(EOS_GUI_SRC ${CMAKE_SOURCE_DIR}/Modules/EOS_IHM/qt)
set(EOS_GUI_BINARY_DIR ${CMAKE_BINARY_DIR}/Modules/EOS_IHM)
if (WITH_GUI)
set(EOS_GUI_SR2 ${CMAKE_SOURCE_DIR}/Modules/EOS_IHM/cpp)
file(GLOB files_py ${EOS_GUI_SRC}/*.py
${EOS_GUI_BINARY_DIR}/qt/*.py)
list(APPEND files_py ${EOS_GUI_BINARY_DIR}/cpp/eosihm.py)
set(LIB_IHM $<TARGET_FILE:${NLIB_IHM}>)
install(FILES ${LIB_IHM} DESTINATION ${EOS_LIB_DIR} RENAME _eosihm${CMAKE_SHARED_LIBRARY_SUFFIX}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
install(PROGRAMS ${files_py} DESTINATION ${EOS_PYTHON_SITE_PACKAGES_DIR})
file(GLOB files_txt ${EOS_GUI_SRC}/*.txt ${EOS_GUI_SRC}/*.png ${EOS_GUI_SR2}/../README)
set(EOS_DOC_GUI_DIR ${EOS_DOC_DIR}/Modules/EOS_IHM)
install(DIRECTORY DESTINATION ${EOS_DOC_GUI_DIR})
install(FILES ${files_txt} DESTINATION ${EOS_DOC_GUI_DIR})
endif(WITH_GUI)
#
# Create refprop_key.txt for NIST-Refprop
if (WITH_PLUGIN_REFPROP_9 OR WITH_PLUGIN_REFPROP_10)
set(RPKEY_FILE ${CMAKE_SOURCE_DIR}/Tools/refprop_key.sh)
install(CODE "execute_process(COMMAND sh ${RPKEY_FILE} ${EOS_LIB_DIR})")
endif (WITH_PLUGIN_REFPROP_9 OR WITH_PLUGIN_REFPROP_10)
###############
## PACKAGING ##
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
string(REPLACE ";" " " pc_req_private "${pc_req_private_list}")
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/Tools/EOSConfig.cmake.in"
"${PROJECT_BINARY_DIR}/Tools/EOSConfig.cmake"
INSTALL_DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib/cmake/EOS-${EOS_VERSION}"
)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/Tools/EOSConfigVersion.cmake"
VERSION ${EOS_VERSION}
COMPATIBILITY ExactVersion
)
configure_file(
"${PROJECT_SOURCE_DIR}/Tools/eos.pc.in"
"${PROJECT_BINARY_DIR}/Tools/eos.pc"
@ONLY
)
install(
FILES
"${PROJECT_BINARY_DIR}/Tools/eos.pc"
DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig"
)
export(EXPORT EOSTargets
FILE "${CMAKE_BINARY_DIR}/Tools/EOSTargets.cmake"
NAMESPACE NEPTUNE::
)
install(EXPORT EOSTargets
FILE "EOSTargets.cmake"
NAMESPACE NEPTUNE::
DESTINATION ${EOS_LIB_DIR}/cmake/EOS-${EOS_VERSION}
)
install(
FILES
"${PROJECT_BINARY_DIR}/Tools/EOSConfig.cmake"
"${PROJECT_BINARY_DIR}/Tools/EOSConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/Tools/EOSTargets.cmake"
"${PROJECT_SOURCE_DIR}/Tools/FindTIRPC.cmake"
DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib/cmake/EOS-${EOS_VERSION}"
)