Salome HOME
Copyright update 2021
[tools/libbatch.git] / src / CMakeLists.txt
1 # Copyright (C) 2007-2021  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, or (at your option) any later version.
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 MACRO(APPEND_CLASSES_TO_SRC_FILES)
24     FOREACH(CLASS ${ARGV})
25         LIST(APPEND SRC_FILES ${CLASS}.cxx)
26     ENDFOREACH(CLASS ${ARGV})
27     SET(SRC_FILES ${SRC_FILES} PARENT_SCOPE)
28 ENDMACRO(APPEND_CLASSES_TO_SRC_FILES)
29
30 MACRO(APPEND_CLASSES_TO_HDR_FILES)
31     FOREACH(CLASS ${ARGV})
32         LIST(APPEND HDR_FILES ${CLASS}.hxx)
33     ENDFOREACH(CLASS ${ARGV})
34     SET(HDR_FILES ${HDR_FILES} PARENT_SCOPE)
35 ENDMACRO(APPEND_CLASSES_TO_HDR_FILES)
36
37 IF (WIN32)
38   ADD_DEFINITIONS(/wd4251 /wd4290)  # Disable annoying Visual C++ warnings
39 ENDIF (WIN32)
40
41 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR} 
42      ${PTHREAD_INCLUDE_DIR})
43
44 ADD_SUBDIRECTORY (Core)
45
46 IF (LIBBATCH_LOCAL_SUBMISSION)
47     ADD_SUBDIRECTORY (Local)
48 ENDIF ()
49
50 ADD_SUBDIRECTORY (CCC)
51 ADD_SUBDIRECTORY (LSF)
52 ADD_SUBDIRECTORY (PBS)
53 ADD_SUBDIRECTORY (OAR)
54 ADD_SUBDIRECTORY (COORM)
55 ADD_SUBDIRECTORY (SGE)
56 ADD_SUBDIRECTORY (LoadLeveler)
57 ADD_SUBDIRECTORY (Slurm)
58
59 # Vishnu is not available for Windows
60 IF (NOT WIN32)
61     ADD_SUBDIRECTORY (Vishnu)
62 ENDIF (NOT WIN32)
63
64 ADD_LIBRARY (batch SHARED ${SRC_FILES})
65
66 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/Core)
67 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/Local)
68 TARGET_LINK_LIBRARIES(batch ${PTHREAD_LIBRARY})
69
70 IF (WIN32)
71     TARGET_LINK_LIBRARIES(batch ws2_32)
72 ENDIF (WIN32)
73
74 # If necessary, activate all warnings (useful for debugging and code cleaning)
75 # add_definitions(-Wall -Werror -ansi -pedantic)
76
77 INSTALL(TARGETS batch 
78         EXPORT LibBatchTargets 
79         DESTINATION lib)
80 INSTALL(FILES ${HDR_FILES} DESTINATION include/libbatch)
81
82 IF (LIBBATCH_PYTHON_WRAPPING AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
83     ADD_SUBDIRECTORY(Python)
84 ENDIF ()