]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix libbatch detection and usage with CMake
authorbarate <barate>
Mon, 18 Feb 2013 10:17:34 +0000 (10:17 +0000)
committerbarate <barate>
Mon, 18 Feb 2013 10:17:34 +0000 (10:17 +0000)
CMakeLists.txt
salome_adm/cmake_files/CMakeLists.txt
salome_adm/cmake_files/FindLIBBATCH.cmake [deleted file]
salome_adm/cmake_files/FindSalomeLIBBATCH.cmake [new file with mode: 0644]
salome_adm/cmake_files/Makefile.am
src/Launcher/CMakeLists.txt

index 5c15c2f943a2b1a86a50c501d4ce550c699b44ed..cfafaae1131b905445c8e901311257482f4b0963 100755 (executable)
@@ -60,7 +60,7 @@ option(SALOME_USE_MPI "Use MPI containers" OFF)
 option(SALOME_USE_CORBA "Use distribute application with components" ON)
 option(SALOME_USE_DOC "Generate documentation" ON)
 option(SALOME_USE_TEST "Generate test" OFF)
-option(SALOME_USE_LIBBATCH "Generate Launcher" OFF)
+option(SALOME_USE_LIBBATCH "Generate Launcher" ON)
 
 # Threads
 SET(CMAKE_THREAD_PREFER_PTHREAD)
@@ -94,7 +94,7 @@ if(SALOME_USE_DOC)
 endif(SALOME_USE_DOC)
 
 if(SALOME_USE_LIBBATCH)
-  find_package(LIBBATCH)
+  find_package(SalomeLIBBATCH)
 endif(SALOME_USE_LIBBATCH)
 
 INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
index 1f05af1279ccd9e586e570122515e40a5c470436..b41dadd74682ee561dce3672a3f5d29bc0bad92f 100755 (executable)
@@ -27,7 +27,6 @@ ADD_SUBDIRECTORY(deprecated)
 SET(DATA
   FindCPPUNIT.cmake
   FindKERNEL.cmake
-  FindLIBBATCH.cmake
   FindOMNIORB.cmake
   UseOMNIORB.cmake
   FindPLATFORM.cmake
@@ -36,6 +35,7 @@ SET(DATA
   FindSalomeCPPUNIT.cmake
   FindSalomeDOXYGEN.cmake
   FindSalomeHDF5.cmake
+  FindSalomeLIBBATCH.cmake
   FindSalomeLIBXML2.cmake
   FindSalomeMPI.cmake
   FindSalomePYTHON.cmake
diff --git a/salome_adm/cmake_files/FindLIBBATCH.cmake b/salome_adm/cmake_files/FindLIBBATCH.cmake
deleted file mode 100644 (file)
index aee305d..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# ------
-
-MESSAGE(STATUS "Check for libbatch ...")
-
-# ------
-
-IF(LIBBATCH_IS_MANDATORY STREQUAL 0)
-  SET(LIBBATCH_IS_MANDATORY 0)
-  SET(LIBBATCH_IS_OPTIONAL 1)
-ENDIF(LIBBATCH_IS_MANDATORY STREQUAL 0)
-IF(LIBBATCH_IS_OPTIONAL STREQUAL 0)
-  SET(LIBBATCH_IS_MANDATORY 1)
-  SET(LIBBATCH_IS_OPTIONAL 0)
-ENDIF(LIBBATCH_IS_OPTIONAL STREQUAL 0)
-IF(NOT LIBBATCH_IS_MANDATORY AND NOT LIBBATCH_IS_OPTIONAL)
-  SET(LIBBATCH_IS_MANDATORY 0)
-  SET(LIBBATCH_IS_OPTIONAL 1)
-ENDIF(NOT LIBBATCH_IS_MANDATORY AND NOT LIBBATCH_IS_OPTIONAL)
-
-# ------
-
-SET(LIBBATCH_STATUS 1)
-IF(WITHOUT_LIBBATCH OR WITH_LIBBATCH STREQUAL 0)
-  SET(LIBBATCH_STATUS 0)
-  MESSAGE(STATUS "libbatch disabled from command line.")
-ENDIF(WITHOUT_LIBBATCH OR WITH_LIBBATCH STREQUAL 0)
-
-# ------
-
-IF(LIBBATCH_STATUS)
-  IF(WITH_LIBBATCH)
-    SET(LIBBATCH_ROOT_USER ${WITH_LIBBATCH})
-  ELSE(WITH_LIBBATCH)
-    SET(LIBBATCH_ROOT_USER $ENV{LIBBATCH_ROOT_DIR})
-  ENDIF(WITH_LIBBATCH)
-ENDIF(LIBBATCH_STATUS)
-
-# -----
-
-IF(LIBBATCH_STATUS)
-  IF(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_FIND_PATHS_OPTION NO_DEFAULT_PATH)
-  ELSE(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_FIND_PATHS_OPTION)
-  ENDIF(LIBBATCH_ROOT_USER)
-ENDIF(LIBBATCH_STATUS)
-
-# -----
-
-IF(LIBBATCH_STATUS)
-  IF(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_INCLUDE_PATHS ${LIBBATCH_ROOT_USER} ${LIBBATCH_ROOT_USER}/include)
-  ELSE(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_INCLUDE_PATHS)
-  ENDIF(LIBBATCH_ROOT_USER)
-  SET(LIBBATCH_INCLUDE_TO_FIND Batch/Batch_BatchManager.hxx)
-  FIND_PATH(LIBBATCH_INCLUDE_DIR ${LIBBATCH_INCLUDE_TO_FIND} PATHS ${LIBBATCH_INCLUDE_PATHS} ${LIBBATCH_FIND_PATHS_OPTION})
-  IF(LIBBATCH_INCLUDE_DIR)
-    IF(LIBBATCH_ROOT_USER)
-      SET(LIBBATCH_INCLUDES -I${LIBBATCH_INCLUDE_DIR}) # to be removed
-      SET(LIBBATCH_INCLUDE_DIRS ${LIBBATCH_INCLUDE_DIR})       
-    ENDIF(LIBBATCH_ROOT_USER)
-    MESSAGE(STATUS "${LIBBATCH_INCLUDE_TO_FIND} found in ${LIBBATCH_INCLUDE_DIR}")
-  ELSE(LIBBATCH_INCLUDE_DIR)
-    SET(LIBBATCH_STATUS 0)
-    IF(LIBBATCH_ROOT_USER)
-      MESSAGE(STATUS "${LIBBATCH_INCLUDE_TO_FIND} not found in ${LIBBATCH_INCLUDE_PATHS}, check your LIBBATCH installation.")
-    ELSE(LIBBATCH_ROOT_USER)
-      MESSAGE(STATUS "${LIBBATCH_INCLUDE_TO_FIND} not found on system, try to use WITH_LIBBATCH option or LIBBATCH_ROOT environment variable.")
-    ENDIF(LIBBATCH_ROOT_USER)
-  ENDIF(LIBBATCH_INCLUDE_DIR)
-ENDIF(LIBBATCH_STATUS)
-
-# ----
-
-IF(LIBBATCH_STATUS)
-  IF(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_LIB_PATHS ${LIBBATCH_ROOT_USER}/lib)
-  ELSE(LIBBATCH_ROOT_USER)
-    SET(LIBBATCH_LIB_PATHS)
-  ENDIF(LIBBATCH_ROOT_USER)
-ENDIF(LIBBATCH_STATUS)
-
-IF(LIBBATCH_STATUS)
-  IF(WINDOWS)
-    FIND_LIBRARY(LIBBATCH_LIB Batch PATHS ${LIBBATCH_LIB_PATHS} ${LIBBATCH_FIND_PATHS_OPTION})
-  ELSE(WINDOWS)
-    FIND_LIBRARY(LIBBATCH_LIB Batch PATHS ${LIBBATCH_LIB_PATHS} ${LIBBATCH_FIND_PATHS_OPTION})
-  ENDIF(WINDOWS)
-  SET(LIBBATCH_LIBS)
-  IF(LIBBATCH_LIB)
-    SET(LIBBATCH_LIBS ${LIBBATCH_LIBS} ${LIBBATCH_LIB})
-    MESSAGE(STATUS "libbatch lib found: ${LIBBATCH_LIB}")
-  ELSE(LIBBATCH_LIB)
-    SET(LIBBATCH_STATUS 0)
-    IF(LIBBATCH_ROOT_USER)
-      MESSAGE(STATUS "libbatch lib not found in ${LIBBATCH_LIB_PATHS}, check your LIBBATCH installation.")
-    ELSE(LIBBATCH_ROOT_USER)
-      MESSAGE(STATUS "libbatch lib not found on system, try to use WITH_LIBBATCH option or LIBBATCH_ROOT environment variable.")
-    ENDIF(LIBBATCH_ROOT_USER)
-  ENDIF(LIBBATCH_LIB)
-ENDIF(LIBBATCH_STATUS)
-
-# ----
-
-IF(LIBBATCH_STATUS)
-  SET(WITH_LIBBATCH 1)
-ELSE(LIBBATCH_STATUS)
-  IF(LIBBATCH_IS_MANDATORY)
-    MESSAGE(FATAL_ERROR "libbatch not found ... mandatory ... abort")
-  ELSE(LIBBATCH_IS_MANDATORY)
-    MESSAGE(STATUS "libbatch not found ... optional ... disabled")
-  ENDIF(LIBBATCH_IS_MANDATORY)
-ENDIF(LIBBATCH_STATUS)
-
-# ------
diff --git a/salome_adm/cmake_files/FindSalomeLIBBATCH.cmake b/salome_adm/cmake_files/FindSalomeLIBBATCH.cmake
new file mode 100644 (file)
index 0000000..f775617
--- /dev/null
@@ -0,0 +1,16 @@
+
+# LIBBATCH detection for Salome
+
+set(LIBBATCH_ROOT_DIR $ENV{LIBBATCH_ROOT_DIR} CACHE PATH "Path to libbatch directory")
+if(EXISTS ${LIBBATCH_ROOT_DIR})
+  find_package(libBatch QUIET CONFIG PATHS ${LIBBATCH_ROOT_DIR}/lib NO_DEFAULT_PATH)
+endif(EXISTS ${LIBBATCH_ROOT_DIR})
+find_package(libBatch QUIET CONFIG)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(libBatch DEFAULT_MSG
+  LIBBATCH_ROOT_DIR LIBBATCH_INCLUDE_DIRS LIBBATCH_LIBRARIES
+  LIBBATCH_RUNTIME_LIBRARY_DIRS LIBBATCH_PYTHONPATH)
+
+# Artefact for compatibility with Libbatch 1.6.0, to be removed in Salome 7
+IF(LIBBATCH_FOUND)
+  get_filename_component(LIBBATCH_INCLUDE_DIR "${LIBBATCH_INCLUDE_DIRS}/.." ABSOLUTE)
+ENDIF(LIBBATCH_FOUND)
index 13c08121f71a34cfbfb874ef57a4f5400fdd94e6..d43c5e1e8a8841a420ec6c01e2b23d6f5ee7d446 100644 (file)
@@ -27,7 +27,6 @@ SUBDIRS = deprecated
 dist_salome_cmake_DATA = \
 FindCPPUNIT.cmake \
 FindKERNEL.cmake \
-FindLIBBATCH.cmake \
 FindOMNIORB.cmake \
 UseOMNIORB.cmake \
 FindPLATFORM.cmake \
@@ -37,6 +36,7 @@ FindSalomeBOOST.cmake \
 FindSalomeCPPUNIT.cmake \
 FindSalomeDOXYGEN.cmake \
 FindSalomeHDF5.cmake \
+FindSalomeLIBBATCH.cmake \
 FindSalomeLIBXML2.cmake \
 FindSalomeMPI.cmake \
 FindSalomePYTHON.cmake \
index ed4bba9921e68f006541ca1f2156e087b51181d3..47bdcf83f8cfbe7de9631de4871594c247d2f8f7 100755 (executable)
@@ -37,9 +37,9 @@ INCLUDE_DIRECTORIES(
 )
 
 ADD_DEFINITIONS(${MPI_CXX_COMPILE_FLAGS} ${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS})
-IF(SALOME_USE_LIBBATCH)
+IF(SALOME_USE_LIBBATCH AND LIBBATCH_FOUND)
   ADD_DEFINITIONS(-DWITH_LIBBATCH)
-ENDIF(SALOME_USE_LIBBATCH)
+ENDIF(SALOME_USE_LIBBATCH AND LIBBATCH_FOUND)
 
 # This local variable defines the list of dependant libraries common to all target in this package.
 SET(COMMON_LIBS
@@ -52,7 +52,7 @@ SET(COMMON_LIBS
   SALOMELocalTrace
   SALOMEBasics
   SalomeIDLKernel
-  ${LIBBATCH_LIBS}
+  ${LIBBATCH_LIBRARIES}
   ${MPI_CXX_LIBRARIES}
   ${OMNIORB_LIBRARIES}
   ${LIBXML2_LIBRARIES}
@@ -71,7 +71,7 @@ SET(Launcher_SOURCES
 )
 
 ADD_LIBRARY(Launcher ${Launcher_SOURCES})
-TARGET_LINK_LIBRARIES(Launcher ResourcesManager ${LIBBATCH_LIBS} ${MPI_CXX_LIBRARIES} ${LIBXML2_LIBS})
+TARGET_LINK_LIBRARIES(Launcher ResourcesManager ${LIBBATCH_LIBRARIES} ${MPI_CXX_LIBRARIES} ${LIBXML2_LIBS})
 INSTALL(TARGETS Launcher DESTINATION ${KERNEL_salomelib_LIBS})
 
 SET(TestLauncher_LIBS
@@ -79,7 +79,7 @@ SET(TestLauncher_LIBS
   ResourcesManager
   Launcher
   OpUtil
-  ${LIBBATCH_LIBS}
+  ${LIBBATCH_LIBRARIES}
 )
 
 ADD_EXECUTABLE(TestLauncher TestLauncher.cxx)
@@ -96,7 +96,7 @@ IF(NOT WITHONLYLAUNCHER)
     SalomeLauncher
     SALOMEBasics
     SALOMELocalTrace
-    ${LIBBATCH_LIBS}
+    ${LIBBATCH_LIBRARIES}
     ${MPI_CXX_LIBRARIES}
     ${OMNIORB_LIBRARIES}
     ${LIBXML2_LIBRARIES}