Salome HOME
Win32 compatibility
[tools/libbatch.git] / src / CMakeLists.txt
1 #  Copyright (C) 2007-2013  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 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 (MSVC)
38   add_definitions(/wd4251 /wd4290)  # Disable annoying Visual C++ warnings
39 ENDIF (MSVC)
40
41 # !!! to avoid using wrong config.h file on win32 platform add include directories only in following order
42 include_directories(${CMAKE_BINARY_DIR} ${PTHREAD_INCLUDE_DIR})
43
44 add_subdirectory (Core)
45
46 IF (BUILD_LOCAL_SUBMISSION)
47     add_subdirectory (Local)
48 ENDIF (BUILD_LOCAL_SUBMISSION)
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 DESTINATION lib)
78 INSTALL(FILES ${HDR_FILES} DESTINATION include/libbatch)
79
80 IF (BUILD_PYTHON_WRAPPING AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
81     add_subdirectory (Python)
82 ENDIF (BUILD_PYTHON_WRAPPING AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)