Salome HOME
CMake: splitting OmniORB and OmniORBPy detection
[modules/kernel.git] / salome_adm / cmake_files / FindOmniORBPy.cmake
1 # - Find OmniORB4 Python backend
2 #
3 # Sets the following variables:
4 # OMNIORB_PYTHON_BACKEND - path to the Python backend
5 #
6 # Detection is made by looking for  
7 #    lib/python${_py_version}/site-packages/omniidl_be/python.py
8 #
9
10 ################################################################
11 # Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
12 #
13 # This library is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU Lesser General Public
15 # License as published by the Free Software Foundation; either
16 # version 2.1 of the License.
17 #
18 # This library is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # Lesser General Public License for more details.
22 #
23 # You should have received a copy of the GNU Lesser General Public
24 # License along with this library; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
26 #
27 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
28 #
29 ################################################################
30
31 ##############################################################################
32 # find python back-end
33 ##############################################################################
34
35 SET(_py_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
36 SET(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
37 SET(_doc "Path to python-backend directory (omniidl_be) including python.py file")
38 IF(WIN32)
39   FIND_PATH(OMNIORB_PYTHON_BACKEND
40      NAMES python.py PATHS "/lib/python/omniidl_be" DOC ${_doc}) 
41 ELSE()
42   FIND_PATH(OMNIORB_PYTHON_BACKEND
43      NAMES python.py
44      PATHS "/lib/python${_py_version}/site-packages/omniidl_be" "/usr/lib/omniidl/omniidl_be" 
45      DOC ${_doc})
46 ENDIF()
47
48 ##############################################################################
49 # Cook our stuff
50 ##############################################################################
51 MARK_AS_ADVANCED(OMNIORB_PYTHON_BACKEND)
52   
53 #SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
54 SET(OMNIORB_IDLPYFLAGS -bpython)
55 IF (OMNIORB_PYTHON_BACKEND) 
56   SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
57 ENDIF()
58 #SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
59 SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
60 #SET(IDL_CLN_H .hh)
61 #SET(IDL_SRV_H .hh)
62 #SET(OMNIORB_DEFINITIONS "-D__x86__ -DCOMP_CORBA_DOUBLE -DCOMP_CORBA_LONG")
63 #IF(WIN32)
64 #  SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__WIN32__")
65 #ENDIF()
66 #IF(APPLE)
67   #SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__macos__")#for omnithread.h to be checked...
68 #ENDIF()
69
70 # Handle standard arguments:
71 INCLUDE(FindPackageHandleStandardArgs)
72 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORBPy REQUIRED_VARS OMNIORB_PYTHON_BACKEND)