ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/CMakeLists.txt
Revision: 1171
Committed: Wed Jul 31 15:43:57 2024 UTC (12 months, 4 weeks ago) by francois
Content type: text/plain
File size: 6507 byte(s)
Log Message:
correction de quelques bug de compilation + misea jour aide + gestion automatique des numéros de version

File Contents

# User Rev Content
1 francois 255 cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
2    
3 francois 547
4 francois 255 if(DEFINED CMAKE_BUILD_TYPE)
5     set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type")
6     else(DEFINED CMAKE_BUILD_TYPE)
7 francois 1061 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose build type")
8 francois 255 endif(DEFINED CMAKE_BUILD_TYPE)
9    
10     project(MAGIC)
11    
12 francois 294 option(ENABLE_OCC "Magic Enable Occ" ON)
13 couturad 906 option(ENABLE_OCC_COMPLET "Magic Enable Occ BREP+Operation" ON)
14 francois 294 option(ENABLE_SAT "Magic Enable Sat" ON)
15     option(ENABLE_STEP "Magic Enable Step" ON)
16 francois 660 option(ENABLE_CAD4FE "Magic Enable CAD4FE" ON)
17 francois 1061 #option(ENABLE_IBREP "Magic Enable IBREP" OFF)
18 francois 490 option(ENABLE_TOIBREP "Magic Enable TOIBREP" ON)
19 francois 1061 option(ENABLE_VTKDISPLAY "Magic Enable VTKDISPLAY (pour la visu)" ON)
20 francois 294 option(ENABLE_TEST "Magic Enable test" OFF)
21 francois 366 option(ENABLE_ENGLISH "Magic Use English" OFF)
22 cuillier 415 option(ENABLE_TUTORIEL "Magic turorial" OFF)
23 francois 726 option(ENABLE_CHOIX_TERMINAL_ASTER "Magic Choix d'un terminal pour executer Code Aster" ON)
24 couturad 951 option(ENABLE_PROJECT_CHRONO "Magic Enable Project_chrono" OFF)
25 francois 987 option(ENABLE_PROJECT_POLYCRISTAUX "Magic Enable Project_polycristaux" OFF)
26 francois 255
27 francois 757 message(STATUS "The compiler is ${CMAKE_CXX_COMPILER}.")
28    
29 francois 1171 set(MAGIC_MAJOR_VERSION 4)
30     set(MAGIC_MINOR_VERSION 3)
31     set(MAGIC_MAJOR_VERSION_FICHIER 2)
32     set(MAGIC_MINOR_VERSION_FICHIER 3)
33    
34 francois 757 include(CheckCXXCompilerFlag)
35     CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
36     CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
37     if(COMPILER_SUPPORTS_CXX11)
38     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
39     elseif(COMPILER_SUPPORTS_CXX0X)
40     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
41     else()
42     message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
43     endif()
44    
45 francois 1061 #set(CADXFEM_PATH "../cadxfem" CACHE STRING "CADXFEM Path")
46 francois 1171 set(ASTER_VERSION_FLAG "15.6" CACHE STRING "Version par défaut de Code ASTER dans la compilation")
47     #add_definitions(-DASTER_VERSION_DEFAUT="${ASTER_VERSION_FLAG}")
48 couturad 906 if(ENABLE_OCC_COMPLET)
49     set (ENABLE_OCC ON)
50     endif(ENABLE_OCC_COMPLET)
51 francois 1171
52 francois 255 if(ENABLE_OCC)
53 francois 547 set(OCC_SYS_NAME ${CMAKE_SYSTEM_NAME})
54 francois 255 set(OCC_LIBS_REQUIRED
55     # subset of DataExchange
56 couturad 687 TKSTEP TKSTEP209 TKSTEPAttr TKSTEPBase TKIGES TKXSBase TKXCAF TKXDESTEP
57 couturad 906
58     TKBinXCAF TKSTL TKVRML TKXDEIGES TKXmlXCAF
59    
60 francois 255 # ModelingAlgorithms
61     TKOffset TKFeat TKFillet TKBool TKShHealing TKMesh TKHLR TKBO TKPrim
62     TKTopAlgo TKGeomAlgo
63     # ModelingData
64     TKBRep TKGeomBase TKG3d TKG2d
65     # FoundationClasses
66 francois 865 #TKAdvTools
67     TKMath TKernel)
68 francois 255 list(LENGTH OCC_LIBS_REQUIRED NUM_OCC_LIBS_REQUIRED)
69     set(OCC_LIBS)
70     foreach(OCC ${OCC_LIBS_REQUIRED})
71 francois 547 find_library(OCC_LIB ${OCC} PATHS HINTS ENV CASROOT PATH_SUFFIXES lib
72     ${OCC_SYS_NAME}/lib ${OCC_SYS_NAME}/vc8/lib )
73 francois 255 if(OCC_LIB)
74     list(APPEND OCC_LIBS ${OCC_LIB})
75     endif(OCC_LIB)
76 francois 547 #set(OCC_LIB OCC_LIB-NOTFOUND CACHE INTERNAL "")
77     unset(OCC_LIB CACHE) # cleaner, but only available in cmake >= 2.6.4
78 francois 255 endforeach(OCC)
79     list(LENGTH OCC_LIBS NUM_OCC_LIBS)
80     if(NUM_OCC_LIBS EQUAL NUM_OCC_LIBS_REQUIRED)
81 francois 547 unset(OCC_INC CACHE)
82 francois 255 find_path(OCC_INC "BRep_Tool.hxx" PATHS ENV CASROOT PATH_SUFFIXES inc
83 francois 547 include opencascade include/oce)
84    
85 francois 255 if(OCC_INC)
86 francois 1171
87     file(STRINGS ${OCC_INC}/Standard_Version.hxx
88     OCC_MAJOR REGEX "#define OCC_VERSION_MAJOR.*")
89     file(STRINGS ${OCC_INC}/Standard_Version.hxx
90     OCC_MINOR REGEX "#define OCC_VERSION_MINOR.*")
91     file(STRINGS ${OCC_INC}/Standard_Version.hxx
92     OCC_MAINT REGEX "#define OCC_VERSION_MAINTENANCE.*")
93     if(OCC_MAJOR AND OCC_MINOR AND OCC_MAINT)
94     string(REGEX MATCH "[0-9]+" OCC_MAJOR "${OCC_MAJOR}")
95     string(REGEX MATCH "[0-9]+" OCC_MINOR "${OCC_MINOR}")
96     string(REGEX MATCH "[0-9]+" OCC_MAINT "${OCC_MAINT}")
97     set(OCC_VERSION "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
98     message(STATUS "Found OpenCASCADE version ${OCC_VERSION} in ${OCC_INC}")
99     endif()
100    
101    
102    
103    
104 francois 255 add_definitions(-DBREP_OCC)
105 couturad 906 if(ENABLE_OCC_COMPLET)
106     add_definitions(-DALL_OCC)
107     endif(ENABLE_OCC_COMPLET)
108 francois 255 list(APPEND EXTERNAL_LIBRARIES ${OCC_LIBS})
109     list(APPEND EXTERNAL_INCLUDES ${OCC_INC})
110     if(HAVE_64BIT_SIZE_T)
111     add_definitions(-D_OCC64)
112     endif(HAVE_64BIT_SIZE_T)
113     if(CYGWIN)
114     list(APPEND EXTERNAL_LIBRARIES "winspool")
115     elseif(MSVC)
116     add_definitions(-DWNT)
117     endif(CYGWIN)
118     find_path(OCC_CONFIG_H "config.h" PATHS ${OCC_INC} ${OCC_CONFIG_H_PATH}
119     NO_DEFAULT_PATH)
120     if(NOT OCC_CONFIG_H)
121     add_definitions(-DHAVE_NO_OCC_CONFIG_H)
122     endif(NOT OCC_CONFIG_H)
123     endif(OCC_INC)
124     endif(NUM_OCC_LIBS EQUAL NUM_OCC_LIBS_REQUIRED)
125     endif(ENABLE_OCC)
126    
127 couturad 951 if(ENABLE_PROJECT_CHRONO)
128     find_package(Chrono REQUIRED
129     COMPONENTS Irrlicht
130     CONFIG
131 francois 957 HINTS /usr/local/lib64
132     )
133 couturad 951 add_definitions(-DPROJECT_CHRONO)
134     endif(ENABLE_PROJECT_CHRONO)
135    
136 francois 381 execute_process(COMMAND "date" "+%Y" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE annee)
137     execute_process(COMMAND "date" "+%Y" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE dateannee)
138    
139    
140 francois 255 if(ENABLE_SAT)
141     add_definitions(-DBREP_SAT)
142     endif(ENABLE_SAT)
143    
144 francois 314 if(ENABLE_OCC)
145     add_definitions(-DBREP_OCC)
146 francois 686 add_definitions(-DCSG_OCC)
147 francois 314 endif(ENABLE_OCC)
148 francois 255 if(ENABLE_STEP)
149     add_definitions(-DBREP_STEP)
150     endif(ENABLE_STEP)
151    
152 francois 366 if (ENABLE_ENGLISH)
153     add_definitions(-DUSE_ENGLISH)
154     endif(ENABLE_ENGLISH)
155 francois 295
156 francois 1061 #if(ENABLE_NUTIL)
157     #add_subdirectory(${CADXFEM_PATH}/nutil "${CMAKE_CURRENT_BINARY_DIR}/nutil")
158     #add_definitions(-DVTK_INTERFACE)
159     #endif(ENABLE_NUTIL)
160 francois 255
161 francois 1061 #if(ENABLE_IBREP)
162     #add_subdirectory(${CADXFEM_PATH}/IBrep "${CMAKE_CURRENT_BINARY_DIR}/IBrep")
163     #add_definitions(-DIBREP)
164     #endif(ENABLE_IBREP)
165 francois 989
166 francois 984 if (ENABLE_PROJECT_POLYCRISTAUX)
167 francois 987 add_definitions(-DPROJECT_POLYCRISTAUX)
168 francois 984 endif (ENABLE_PROJECT_POLYCRISTAUX)
169    
170    
171    
172 francois 660 if (ENABLE_CAD4FE)
173     add_definitions(-DUSECAD4FE)
174     endif(ENABLE_CAD4FE)
175    
176 francois 726 if (ENABLE_CHOIX_TERMINAL_ASTER)
177     add_definitions(-DCHOIXTERMASTER)
178 sattarpa 728 endif(ENABLE_CHOIX_TERMINAL_ASTER)
179 francois 660
180 francois 726
181 francois 381 message(STATUS "Configuration de MAGiC${annee}:1999-${dateannee}")
182 francois 867 message(STATUS "Version de code ASTER integree ${ASTER_VERSION_FLAG}")
183 francois 1171 message(STATUS "Version de OCC ${OCC_VERSION}")
184 francois 381
185 francois 1061
186    
187    
188 francois 1171 configure_file (version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/constante/src/version.h @ONLY)
189     configure_file (${CMAKE_CURRENT_SOURCE_DIR}/documentation/docmagic.in ${CMAKE_CURRENT_SOURCE_DIR}/documentation/docmagic @ONLY)
190 francois 1061
191    
192    
193    
194    
195    
196    
197     add_subdirectory(addin)
198 francois 258 add_subdirectory(lib)
199     add_subdirectory(app)
200 francois 255
201 francois 258
202