Salome HOME
Tested mesh fast equivalence when giving an input field
[tools/solverlab.git] / CoreFlows / CMakeLists.txt
1 cmake_minimum_required (VERSION 3.1)
2 set(CMAKE_CXX_STANDARD 11)
3 set(CMAKE_CXX_STANDARD_REQUIRED ON)
4
5 # Project name
6 project (CoreFlows C CXX)
7 set (COREFLOWS_VERSION_MAJOR 0)
8 set (COREFLOWS_VERSION_MINOR 1)
9
10 option (COREFLOWS_WITH_DOCUMENTATION "Generate documentation for CoreFlows use." ON)
11 option (COREFLOWS_WITH_PYTHON "Compile Python interface for COREFLOWS." ON)
12 option (COREFLOWS_WITH_GUI "Compile Graphic user Interface for COREFLOWS." OFF)
13 option (COREFLOWS_WITH_PACKAGE "Generate RPM, Debian and tarball packages." OFF)
14 option (COREFLOWS_WITH_TESTS "Compile with testing and examples." ON)
15
16 #Path to installed libraries
17 set (PETSC_DIR            OFF CACHE STRING "PETSc library path" )
18 set (SLEPC_DIR            OFF CACHE STRING "SLEPc library path" )
19
20 # Debug mode activates testing and profiling --------------------------------------------------------------#
21 if   (CMAKE_BUILD_TYPE STREQUAL Debug)                                                                     #
22                                                                                                            #
23  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg --coverage")                                                  #
24  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg --coverage")                                    #
25  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg --coverage")                              #
26                                                                                                            #
27 endif(CMAKE_BUILD_TYPE STREQUAL Debug)                                                                                             #
28                                                                                                            #
29 #----------------------------------------------------------------------------------------------------------#
30
31 # Swig interface -------------------------------------------------------------------------------------------#
32                                                                                                             #
33 if   (COREFLOWS_WITH_PYTHON)                                                                                  #
34    set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, python-dev, python-numpy, swig")     #
35    set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, python-devel, numpy, swig")              #
36    set (CoreFlows_SWIG_DIR ${CoreFlows_SOURCE_DIR}/swig)                                                    #
37 endif(COREFLOWS_WITH_PYTHON)                                                                                                    #
38                                                                                                             #
39 #-----------------------------------------------------------------------------------------------------------#
40
41 # Base directories
42 set (CoreFlows_MODELS ${CoreFlows_SOURCE_DIR}/Models ) 
43 set (CoreFlows_EXAMPLES ${CoreFlows_SOURCE_DIR}/examples)
44
45 set( CoreFlows_INCLUDES 
46   ${CDMATH_INCLUDES}                                                                                        #
47   ${PETSC_INCLUDES}                                                                                         #
48   ${CoreFlows_MODELS}/inc                                                                                           #    
49   ${CoreFlows_MODELS}/inc/EOS                                                                                       #    
50   )                                                                                                         #
51
52 add_subdirectory (${CoreFlows_MODELS})
53
54 # Tests
55 if   (COREFLOWS_WITH_TESTS)
56   enable_testing ()
57   add_subdirectory (${CoreFlows_EXAMPLES})#contains c++ and python tests
58 endif(COREFLOWS_WITH_TESTS)
59
60 if   (COREFLOWS_WITH_PYTHON)                                                                                  #
61    add_subdirectory (${CoreFlows_SWIG_DIR})                                                                 #
62 endif(COREFLOWS_WITH_PYTHON)                                                                                                    #
63
64 # Documentation --------------------------------------------------------------------------------------------#
65                                                                                                             #
66 if   (COREFLOWS_WITH_DOCUMENTATION)                                                                           #
67   configure_file (Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile  @ONLY IMMEDIATE)                              #
68   FILE(GLOB_RECURSE CoreFlows_Documentation ${CoreFlows_SOURCE_DIR}/Documentation *.dox)                    #
69   SET(Documentation_SRC                                                                                     #
70     ${PROJECT_BINARY_DIR}/Doxyfile                                                                          #
71     ${CoreFlows_Documentation}                                                                              #
72       )                                                                                                     #
73   add_custom_target (docCoreFlows COMMAND ${DOXYGEN_EXECUTABLE}                                                  #
74   SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)                                                                   #
75   install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION share/doc/coreflows-dev-doc OPTIONAL)                  #
76   INSTALL(FILES ${CoreFlows_SOURCE_DIR}/Documentation/CoreFlows.pdf DESTINATION share/doc OPTIONAL)         #
77 endif(COREFLOWS_WITH_DOCUMENTATION)                                                                                                    #
78                                                                                                             #
79 # ------------- --------------------------------------------------------------------------------------------#
80
81 # Standalone graphic interface-----------------------------------------------------------------------------------------#
82                                                                                                             #
83 if   (COREFLOWS_WITH_GUI)                                                                                                                   #
84   set (CoreFlows_GUI_DIR ${CoreFlows_SOURCE_DIR}/gui)                                                        #
85   add_subdirectory(${CoreFlows_GUI_DIR})
86 endif(COREFLOWS_WITH_GUI)                                                                                                    #
87                                                                                                             #
88 # ------------- --------------------------------------------------------------------------------------------#
89
90 #--------------------- COMPILATION MAIN --------------------------------------------------------------------#
91                                                                                                             #
92 INCLUDE_DIRECTORIES(                                                                                        #
93   ${CoreFlows_INCLUDES}                                                                                     #
94   ${PETSC_INCLUDES}
95   ${SLEPC_INCLUDES}
96   )                                                                                                         #
97                                                                                                             #
98 SET(MAIN_SOURCES                                                                                            #
99   mainCoreFlows.cxx                                                                                                 #
100   )                                                                                                         #
101
102 ADD_EXECUTABLE(CoreFlowsMainExe ${MAIN_SOURCES})                                                            #
103 SET_TARGET_PROPERTIES(CoreFlowsMainExe PROPERTIES COMPILE_FLAGS "")                                         #
104 TARGET_LINK_LIBRARIES(CoreFlowsMainExe CoreFlowsLibs  ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES} )                                   #
105 INSTALL(TARGETS CoreFlowsMainExe DESTINATION bin)                                                   #
106                                                                                                             #
107 configure_file(
108     ${PROJECT_SOURCE_DIR}/env_CoreFlows.sh
109     @ONLY
110 )
111                                                                                                             
112                                                                                                             
113 # ------------- --------------------------------------------------------------------------------------------#
114
115
116 # Packaging
117 if   (COREFLOWS_WITH_PACKAGE)
118   include (${CoreFlows_SOURCE_DIR}/CPackLists.txt)
119 endif(COREFLOWS_WITH_PACKAGE)