Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / CMakeLists.txt
1 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
21
22 IF(COMMAND cmake_policy)
23   cmake_policy(SET CMP0003 NEW)
24 ENDIF(COMMAND cmake_policy)
25
26 ENABLE_TESTING()
27 SET(VERSION "6.5.0")
28 SET(VERSION_DEV "1")
29
30 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
31 FILE(TO_CMAKE_PATH $ENV{KERNEL_ROOT_DIR} KERNEL_ROOT_DIR)
32
33 IF(KERNEL_ROOT_DIR)
34   SET(MED_ENABLE_KERNEL ON)
35   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
36   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
37   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
38   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
39   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
40   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
41   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
42   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
43   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
44   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
45   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
46   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
47   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
48 ELSE(KERNEL_ROOT_DIR)
49   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)
50   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
51 ENDIF(KERNEL_ROOT_DIR)
52
53 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
54 FILE(TO_CMAKE_PATH $ENV{GUI_ROOT_DIR} GUI_ROOT_DIR)
55
56 IF(GUI_ROOT_DIR)
57   SET(MED_ENABLE_GUI ON)
58   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)
59   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)
60   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
61   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)
62   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)
63   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
64   INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)
65 ENDIF(GUI_ROOT_DIR)
66
67 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)
68 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)
69 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)
70 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)
71 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)
72 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
73 IF(WIN32)
74   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
75 ENDIF(WIN32)
76
77 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${VERSION}
78   OUTPUT_VARIABLE XVERSION)
79
80 SET(MED_salomebin_BINS bin/salome)
81
82 SET(MED_salomelib_LIBS lib/salome)
83
84 SET(MED_salomeidl_IDLS idl/salome)
85 SET(KERNEL_salomeidl_IDLS ${MED_salomeidl_IDLS})
86
87 SET(MED_salomeinclude_HEADERS include/salome)
88
89 SET(MED_salomeres_DATA share/salome/resources/med)
90
91 SET(MED_salomeres_SCRIPTS share/salome/resources/med)
92
93 SET(MED_salomescript_SCRIPTS bin/salome)
94
95 SET(MED_salomescript_DATA bin/salome)
96
97 SET(MED_salomescript_PYTHON bin/salome)
98 SET(KERNEL_salomescript_PYTHON ${MED_salomescript_PYTHON})
99
100 SET(MED_appliskel_SCRIPTS bin/salome/appliskel)
101
102 SET(MED_appliskel_PYTHON bin/salome/appliskel)
103
104 SET(MED_pythondir lib/python${PYTHON_VERSION}/site-packages)
105
106 SET(MED_salomepythondir ${MED_pythondir}/salome)
107 SET(KERNEL_salomepythondir ${MED_salomepythondir})
108
109 SET(MED_sharedpkgpython_PYTHON ${MED_salomepythondir}/shared_modules)
110
111 SET(MED_admlocalcmake adm_local/cmake_files)
112
113 IF(MED_ENABLE_KERNEL)
114   ADD_SUBDIRECTORY(idl)
115 ENDIF(MED_ENABLE_KERNEL)
116 ADD_SUBDIRECTORY(adm_local)
117 ADD_SUBDIRECTORY(src)
118 ADD_SUBDIRECTORY(doc)
119 ADD_SUBDIRECTORY(resources)
120 ADD_SUBDIRECTORY(bin)
121
122 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/MED_version.h.in)
123 SET(output ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h)
124 MESSAGE(STATUS "Creation of ${output}")
125 CONFIGURE_FILE(${input} ${output} @ONLY)
126 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h DESTINATION ${MED_salomeinclude_HEADERS})