Salome HOME
CMake: splitting OmniORB and OmniORBPy detection
authorbruneton <bruneton>
Thu, 4 Jul 2013 09:00:24 +0000 (09:00 +0000)
committerbruneton <bruneton>
Thu, 4 Jul 2013 09:00:24 +0000 (09:00 +0000)
CMakeLists.txt
salome_adm/cmake_files/CMakeLists.txt
salome_adm/cmake_files/FindOmniORB.cmake
salome_adm/cmake_files/FindOmniORBPy.cmake [new file with mode: 0644]
salome_adm/cmake_files/FindSalomeOmniORB.cmake
salome_adm/cmake_files/FindSalomeOmniORBPy.cmake [new file with mode: 0644]
salome_adm/cmake_files/SalomeMacros.cmake

index 60ef2c2b4eee6d32cacb5ed460f2455a0aa61910..c0931b8697cf8d711bd87cea96d139977749aefc 100755 (executable)
@@ -90,6 +90,7 @@ FIND_PACKAGE(SalomeBoost REQUIRED)
 
 IF(NOT SALOME_LIGHT_ONLY)
   FIND_PACKAGE(SalomeOmniORB REQUIRED)
+  FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
 ENDIF() 
 IF(SALOME_USE_MPI)
   FIND_PACKAGE(SalomeMPI REQUIRED)
index f94ae3b90e681dd4155091924af814fd706e642f..1aa932743761446062f9a12218e8b0ea8284f654 100755 (executable)
@@ -29,6 +29,7 @@ SET(DATA
   FindGraphviz.cmake
   FindSalomeKERNEL.cmake
   FindOmniORB.cmake
+  FindOmniORBPy.cmake
   FindPThread.cmake
   FindSalomeBoost.cmake
   FindSalomeCppUnit.cmake
@@ -40,6 +41,7 @@ SET(DATA
   FindSalomeMedfile.cmake
   FindSalomeMPI.cmake
   FindSalomeOmniORB.cmake
+  FindSalomeOmniORBPy.cmake
   FindSalomePThread.cmake
   FindSalomePython.cmake
   FindSalomeSphinx.cmake
index a264362cc2863849e00db9a909ab25842343f099..501ca5e96858be699c08016c566ce586e5d34f7d 100644 (file)
@@ -95,23 +95,6 @@ ELSE(WIN32)
   FIND_PROGRAM(OMNIORB_NAMESERVER NAMES omniNames)
 ENDIF (WIN32)
 
-##############################################################################
-# find python back-end
-##############################################################################
-
-SET(_py_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-SET(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
-SET(_doc "Path to python-backend directory (omniidl_be) including python.py file")
-IF(WIN32)
-  FIND_PATH(OMNIORB_PYTHON_BACKEND
-     NAMES python.py PATHS "/lib/python/omniidl_be" DOC ${_doc}) 
-ELSE()
-  FIND_PATH(OMNIORB_PYTHON_BACKEND
-     NAMES python.py
-     PATHS "/lib/python${_py_version}/site-packages/omniidl_be" "/usr/lib/omniidl/omniidl_be" 
-     DOC ${_doc})
-ENDIF()
-
 ##############################################################################
 # Cook our stuff
 ##############################################################################
@@ -119,7 +102,7 @@ ENDIF()
 MARK_AS_ADVANCED(OMNIORB_DIR OMNIORB_INCLUDE_DIR)
 MARK_AS_ADVANCED(OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread OMNIORB_LIBRARY_omniDynamic4)
 MARK_AS_ADVANCED(OMNIORB_IDL_COMPILER OMNIORB_NAMESERVER OMNIORB_VERSION)
-MARK_AS_ADVANCED(OMNIORB_LIBRARY_COS4 OMNIORB_LIBRARY_COSDynamic4 OMNIORB_PYTHON_BACKEND)
+MARK_AS_ADVANCED(OMNIORB_LIBRARY_COS4 OMNIORB_LIBRARY_COSDynamic4)
 
 SET(OMNIORB_LIBRARIES
     ${OMNIORB_LIBRARY_omniORB4}
@@ -144,12 +127,12 @@ ELSE()
 ENDIF( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
   
 SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
-SET(OMNIORB_IDLPYFLAGS -bpython)
-IF (OMNIORB_PYTHON_BACKEND) 
-  SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
-ENDIF()
+#SET(OMNIORB_IDLPYFLAGS -bpython)
+#IF (OMNIORB_PYTHON_BACKEND) 
+  #SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
+#ENDIF()
 SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
-SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
+#SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
 SET(IDL_CLN_H .hh)
 SET(IDL_SRV_H .hh)
 SET(OMNIORB_DEFINITIONS "-D__x86__ -DCOMP_CORBA_DOUBLE -DCOMP_CORBA_LONG")
@@ -165,10 +148,10 @@ INCLUDE(FindPackageHandleStandardArgs)
 IF(OMNIORB_VERSION)
   FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORB  
         REQUIRED_VARS OMNIORB_INCLUDE_DIR OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread 
-                      OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER OMNIORB_PYTHON_BACKEND
+                      OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER 
         VERSION_VAR OMNIORB_VERSION )
 ELSE()
   FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORB  
         REQUIRED_VARS OMNIORB_INCLUDE_DIR OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread 
-                      OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER OMNIORB_PYTHON_BACKEND)
+                      OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER)
 ENDIF()
diff --git a/salome_adm/cmake_files/FindOmniORBPy.cmake b/salome_adm/cmake_files/FindOmniORBPy.cmake
new file mode 100644 (file)
index 0000000..7a1c728
--- /dev/null
@@ -0,0 +1,72 @@
+# - Find OmniORB4 Python backend
+#
+# Sets the following variables:
+# OMNIORB_PYTHON_BACKEND - path to the Python backend
+#
+# Detection is made by looking for  
+#    lib/python${_py_version}/site-packages/omniidl_be/python.py
+#
+
+################################################################
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+################################################################
+
+##############################################################################
+# find python back-end
+##############################################################################
+
+SET(_py_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+SET(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
+SET(_doc "Path to python-backend directory (omniidl_be) including python.py file")
+IF(WIN32)
+  FIND_PATH(OMNIORB_PYTHON_BACKEND
+     NAMES python.py PATHS "/lib/python/omniidl_be" DOC ${_doc}) 
+ELSE()
+  FIND_PATH(OMNIORB_PYTHON_BACKEND
+     NAMES python.py
+     PATHS "/lib/python${_py_version}/site-packages/omniidl_be" "/usr/lib/omniidl/omniidl_be" 
+     DOC ${_doc})
+ENDIF()
+
+##############################################################################
+# Cook our stuff
+##############################################################################
+MARK_AS_ADVANCED(OMNIORB_PYTHON_BACKEND)
+  
+#SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
+SET(OMNIORB_IDLPYFLAGS -bpython)
+IF (OMNIORB_PYTHON_BACKEND) 
+  SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
+ENDIF()
+#SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
+SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
+#SET(IDL_CLN_H .hh)
+#SET(IDL_SRV_H .hh)
+#SET(OMNIORB_DEFINITIONS "-D__x86__ -DCOMP_CORBA_DOUBLE -DCOMP_CORBA_LONG")
+#IF(WIN32)
+#  SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__WIN32__")
+#ENDIF()
+#IF(APPLE)
+  #SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__macos__")#for omnithread.h to be checked...
+#ENDIF()
+
+# Handle standard arguments:
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORBPy REQUIRED_VARS OMNIORB_PYTHON_BACKEND)
index 3b7d582181a5366be03dc750fb71ec0ff9d93a01..9d8b0661d02882589299846cace54371d078131b 100644 (file)
@@ -19,7 +19,7 @@
 # Author: Adrien Bruneton
 #
 
-# omniORB detection for SALOME
+# omniORB and detection for SALOME
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
diff --git a/salome_adm/cmake_files/FindSalomeOmniORBPy.cmake b/salome_adm/cmake_files/FindSalomeOmniORBPy.cmake
new file mode 100644 (file)
index 0000000..9a6006a
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# Author: Adrien Bruneton
+#
+
+# omniORB Python backend detection for SALOME
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+IF(SalomeOmniORB_FOUND)
+  # If no OMNIORBPY_ROOT_DIR is given, then try with OMNIORB_ROOT_DIR:
+  SET(OMNIORBPY_ROOT_DIR "$ENV{OMNIORBPY_ROOT_DIR}" CACHE PATH "Path to the OmniORB Python backend")
+  IF(EXISTS "${OMNIORB_ROOT_DIR}" AND (NOT OMNIORBPY_ROOT_DIR))
+    MESSAGE(STATUS "Looking for OmniORB Python backend in the OmniORB installation (OMNIORB_ROOT_DIR exists and OMNIORBPY_ROOT_DIR_ROOT_DIR is not defined) ...")  
+    SET(OMNIORBPY_ROOT_DIR "${OMNIORB_ROOT_DIR}") 
+  ENDIF()
+
+  SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(OmniORBPy OMNIORB_PYTHON_BACKEND 4)
+  #MARK_AS_ADVANCED()
+ELSE()
+  IF(NOT SalomeOmniORBPy_FIND_QUIETLY)
+    MESSAGE(STATUS "OmniORB Python backend needs OmniORB, and OmniORB was not found!")
+  ENDIF()
+ENDIF()
index 78afda0a84720bdb91942cd78382965d2e9ceb72..34730369cbd675b516818aceaea54689aa6da52d 100755 (executable)
@@ -421,5 +421,7 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
   ELSE()
     MESSAGE(STATUS "${pkg} was not found.")  
   ENDIF()
+  
+  SET(Salome${pkg}_FOUND "${pkg}_FOUND")
 ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS)