Salome HOME
Merge class BatchManager_eClient into class BatchManager
[tools/libbatch.git] / src / CMakeLists.txt
1 #  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 # These macros are used to create the lists of source files and header files in global variables.
24 # If we move to cmake 2.6, this can be done more cleanly with the PARENT_SCOPE option.
25 MACRO(APPEND_TO_GLOBAL_VAR VAR)
26     SET(${VAR} ${${VAR}} ${ARGN} CACHE INTERNAL "")
27 ENDMACRO(APPEND_TO_GLOBAL_VAR)
28
29 MACRO(APPEND_CLASSES_TO_SRC_FILES)
30     FOREACH(CLASS ${ARGV})
31         APPEND_TO_GLOBAL_VAR(SRC_FILES_BUILD ${CLASS}.cxx)
32     ENDFOREACH(CLASS ${ARGV})
33 ENDMACRO(APPEND_CLASSES_TO_SRC_FILES)
34
35 MACRO(APPEND_CLASSES_TO_HDR_FILES)
36     FOREACH(CLASS ${ARGV})
37         APPEND_TO_GLOBAL_VAR(HDR_FILES_BUILD ${CLASS}.hxx)
38     ENDFOREACH(CLASS ${ARGV})
39 ENDMACRO(APPEND_CLASSES_TO_HDR_FILES)
40
41 IF (MSVC)
42   add_definitions(/wd4251 /wd4290)  # Disable annoying Visual C++ warnings
43 ENDIF (MSVC)
44
45 include_directories(${PTHREAD_INCLUDE_DIR})
46
47 add_subdirectory (Core)
48
49 IF (BUILD_LOCAL_SUBMISSION)
50     add_subdirectory (Local)
51 ENDIF (BUILD_LOCAL_SUBMISSION)
52
53 add_subdirectory (CCC)
54 add_subdirectory (LSF)
55 add_subdirectory (PBS)
56 add_subdirectory (SGE)
57 #add_subdirectory (SSH)
58 add_subdirectory (LoadLeveler)
59 add_subdirectory (Slurm)
60
61 # Vishnu is not available for Windows
62 IF (NOT WIN32)
63     add_subdirectory (Vishnu)
64 ENDIF (NOT WIN32)
65
66 # Make a copy of the built value and clear the built value for the next run of cmake
67 SET(SRC_FILES ${SRC_FILES_BUILD} CACHE INTERNAL "")
68 SET(SRC_FILES_BUILD CACHE INTERNAL "")
69
70 SET(HDR_FILES ${HDR_FILES_BUILD} CACHE INTERNAL "")
71 SET(HDR_FILES_BUILD CACHE INTERNAL "")
72
73
74 add_library (Batch SHARED ${SRC_FILES})
75
76 include_directories(${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Core)
77 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Local)
78 target_link_libraries(Batch ${PTHREAD_LIBRARY})
79
80 IF (WIN32)
81     target_link_libraries(Batch ws2_32)
82 ENDIF (WIN32)
83
84 # If necessary, activate all warnings (useful for debugging and code cleaning)
85 # add_definitions(-Wall -Werror -ansi -pedantic)
86
87 IF (BUILD_LSF_INTERFACE AND LSF_FOUND)
88     include_directories(${LSF_INCLUDE_DIR})
89     target_link_libraries(Batch ${LSF_LIBRARY} ${LSF_BAT_LIBRARY})
90 ENDIF (BUILD_LSF_INTERFACE AND LSF_FOUND)
91
92 IF (BUILD_PBS_INTERFACE AND PBS_FOUND)
93     include_directories(${PBS_INCLUDE_DIR})
94     target_link_libraries(Batch ${PBS_LIBRARY})
95 ENDIF (BUILD_PBS_INTERFACE AND PBS_FOUND)
96
97 INSTALL(TARGETS Batch DESTINATION lib)
98 INSTALL(FILES ${HDR_FILES} DESTINATION include/Batch)
99
100 IF (BUILD_PYTHON_WRAPPING AND Python_FOUND AND SWIG_FOUND)
101     add_subdirectory (Python)
102 ENDIF (BUILD_PYTHON_WRAPPING AND Python_FOUND AND SWIG_FOUND)