1 # Find OmniORB4 cmake module and Pyhon backends
3 # sets the following variables:
4 # OMNIORB_FOUND - TRUE if OmniORB4 installation has been found
5 # OMNIORB_INCLUDE_DIR - OmniORB4 headers path
6 # OMNIORB_LIBRARIES - OmniORB4 libraries
7 # OMNIORB_VERSION - OmniORB4 version
8 # OMNIORB_IDL_COMPILER - OmniORB4 idl compiler command (omniidl)
9 # OMNIORB_NAMESERVER - OmniORB4 CORBA naming service (omniNames)
12 # OMNIORB_DIR - OmniORB4 local installation path
13 # OMNIORBPY_DIR - OmniORBpy local installation path
15 # This module could use OMNIORB_DIR environment variable if set
16 # WARNING: The precedence order is the following:
17 # 1. OMNIORB_DIR cmake variable
18 # 2. OMNIORB_DIR environment variable
19 # 3. default cmake search paths
21 # This module could use OMNIORBPY_DIR environment variable if set
22 # WARNING: The precedence order is the following:
23 # 1. OMNIORBPY_DIR cmake variable
24 # 2. OMNIORBPY_DIR environment variable
25 # 3. default cmake search paths
27 # NOTE: this goes against cmake default behavior for Find* macros,
29 # http://www.mail-archive.com/kde-buildsystem@kde.org/msg00589.html
32 # minimum OmniORB4 supported version
33 # 4.0.6 has known bug float/double marshalling using CORBA::Any
34 set(OMNIORB_MINIMUM_VERSION "4.1.2")
35 set(OMNIORB_DIR $ENV{OMNIORB_DIR} CACHE PATH "Path to OmniORB directory")
37 ##############################################################################
39 ##############################################################################
40 find_path(OMNIORB_INCLUDE_DIR omniORB4/CORBA.h
41 PATHS "${OMNIORB_DIR}/include" "$ENV{OMNIORB_DIR}/include"
44 find_path(OMNIORB_INCLUDE_DIR omniORB4/CORBA.h)
47 ##############################################################################
49 ##############################################################################
51 find_library(OMNIORB_LIBRARY_omniORB4
53 ${CMAKE_STATIC_LIBRARY_PREFIX}omniORB4${CMAKE_STATIC_LIBRARY_SUFFIX}
54 PATHS ${OMNIORB_DIR}/lib/x86_win32 $ENV{OMNIORB_DIR}/lib/x86_win32
57 find_library(OMNIORB_LIBRARY_omniORB4 NAMES
58 ${CMAKE_STATIC_LIBRARY_PREFIX}omniORB4${CMAKE_STATIC_LIBRARY_SUFFIX}
61 find_library(OMNIORB_LIBRARY_omniORB4
63 PATHS "${OMNIORB_DIR}/lib${LIB_SUFFIX}" "$ENV{OMNIORB_DIR}/lib${LIB_SUFFIX}"
66 find_library(OMNIORB_LIBRARY_omniORB4
71 FIND_LIBRARY( OMNIORB_LIBRARY_omnithread
73 ${CMAKE_STATIC_LIBRARY_PREFIX}omnithread${CMAKE_STATIC_LIBRARY_SUFFIX}
74 PATHS ${OMNIORB_DIR}/lib/x86_win32 $ENV{OMNIORB_DIR}/lib/x86_win32
78 FIND_LIBRARY( OMNIORB_LIBRARY_omnithread
80 ${CMAKE_STATIC_LIBRARY_PREFIX}omnithread${CMAKE_STATIC_LIBRARY_SUFFIX}
83 find_library(OMNIORB_LIBRARY_omnithread
85 PATHS "${OMNIORB_DIR}/lib${LIB_SUFFIX}" "$ENV{OMNIORB_DIR}/lib${LIB_SUFFIX}"
88 find_library(OMNIORB_LIBRARY_omnithread
94 FIND_LIBRARY( OMNIORB_LIBRARY_omniDynamic4
96 ${CMAKE_STATIC_LIBRARY_PREFIX}omniDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX}
97 PATHS ${OMNIORB_DIR}/lib/x86_win32 $ENV{OMNIORB_DIR}/lib/x86_win32
101 FIND_LIBRARY( OMNIORB_LIBRARY_omniDynamic4
103 ${CMAKE_STATIC_LIBRARY_PREFIX}omniDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX}
106 find_library(OMNIORB_LIBRARY_omniDynamic4
108 PATHS "${OMNIORB_DIR}/lib${LIB_SUFFIX}" "$ENV{OMNIORB_DIR}/lib${LIB_SUFFIX}"
111 find_library(OMNIORB_LIBRARY_omniDynamic4
118 FIND_LIBRARY( OMNIORB_LIBRARY_COS4
120 ${CMAKE_STATIC_LIBRARY_PREFIX}COS4${CMAKE_STATIC_LIBRARY_SUFFIX}
121 PATHS ${OMNIORB_DIR}/lib/x86_win32 $ENV{OMNIORB_DIR}/lib/x86_win32
125 FIND_LIBRARY( OMNIORB_LIBRARY_COS4
127 ${CMAKE_STATIC_LIBRARY_PREFIX}COS4${CMAKE_STATIC_LIBRARY_SUFFIX}
130 find_library(OMNIORB_LIBRARY_COS4
132 PATHS "${OMNIORB_DIR}/lib${LIB_SUFFIX}" "$ENV{OMNIORB_DIR}/lib${LIB_SUFFIX}"
135 find_library(OMNIORB_LIBRARY_COS4
140 FIND_LIBRARY( OMNIORB_LIBRARY_COSDynamic4
142 ${CMAKE_STATIC_LIBRARY_PREFIX}COSDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX}
143 PATHS ${OMNIORB_DIR}/lib/x86_win32 $ENV{OMNIORB_DIR}/lib/x86_win32
147 FIND_LIBRARY( OMNIORB_LIBRARY_COSDynamic4
149 ${CMAKE_STATIC_LIBRARY_PREFIX}COSDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX}
153 find_library(OMNIORB_LIBRARY_COSDynamic4
155 PATHS "${OMNIORB_DIR}/lib${LIB_SUFFIX}" "$ENV{OMNIORB_DIR}/lib${LIB_SUFFIX}"
158 find_library(OMNIORB_LIBRARY_COSDynamic4
161 ##############################################################################
162 # find command line tools
163 ##############################################################################
165 FIND_PROGRAM( OMNIORB_IDL_COMPILER
167 PATHS ${OMNIORB_DIR}/bin/x86_win32 $ENV{OMNIORB_DIR}/bin/x86_win32
168 DOC "What is the path where omniidl (the idl compiler) can be found"
171 FIND_PROGRAM( OMNIORB_IDL_COMPILER
173 DOC "What is the path where omniidl (the idl compiler) can be found"
176 FIND_PROGRAM( OMNIORB_OMNINAMES_COMMAND
178 PATHS ${OMNIORB_DIR}/bin/x86_win32 $ENV{OMNIORB_DIR}/bin/x86_win32
179 DOC "What is the path where omniNames (the ORB server) can be found"
182 FIND_PROGRAM( OMNIORB_OMNINAMES_COMMAND
184 DOC "What is the path where omniNames (the ORB server) can be found"
187 find_program(OMNIORB_IDL_COMPILER
189 PATHS "${OMNIORB_DIR}/bin" "$ENV{OMNIORB_DIR}/bin"
192 find_program(OMNIORB_IDL_COMPILER
195 find_program(OMNIORB_NAMESERVER
197 PATHS "${OMNIORB_DIR}/bin" "$ENV{OMNIORB_DIR}/bin"
200 find_program(OMNIORB_NAMESERVER
204 ##############################################################################
205 # find python back-end
206 ##############################################################################
207 FIND_PATH( OMNIORB_PYTHON_BACKEND
209 PATHS $ENV{OMNIORB_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/omniidl_be $ENV{OMNIORBPY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/omniidl_be
210 ${OMNIORB_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/omniidl_be ${OMNIORBPY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/omniidl_be
211 DOC "Path to python-backend directory (omniidl_be) including python.py file"
214 FIND_PATH( OMNIORB_PYTHON_BACKEND
216 PATHS /usr/lib/omniidl/omniidl_be
217 DOC "Path to python-backend directory (omniidl_be) including python.py file" )
218 ##############################################################################
220 ##############################################################################
221 set(OMNIORB_FOUND "FALSE")
223 if(OMNIORB_INCLUDE_DIR AND
224 OMNIORB_LIBRARY_omniORB4 AND
225 OMNIORB_LIBRARY_omnithread AND
226 OMNIORB_LIBRARY_omniDynamic4 AND
227 OMNIORB_IDL_COMPILER)
228 set(OMNIORB_FOUND "TRUE")
229 mark_as_advanced(OMNIORB_DIR)
230 mark_as_advanced(OMNIORB_INCLUDE_DIR)
231 mark_as_advanced(OMNIORB_LIBRARY_omniORB4)
232 mark_as_advanced(OMNIORB_LIBRARY_omnithread)
233 mark_as_advanced(OMNIORB_LIBRARY_omniDynamic4)
234 mark_as_advanced(OMNIORB_IDL_COMPILER)
235 mark_as_advanced(OMNIORB_NAMESERVER)
236 mark_as_advanced(OMNIORB_VERSION)
237 mark_as_advanced(OMNIORB_LIBRARY_COS4)
238 mark_as_advanced(OMNIORB_LIBRARY_COSDynamic4)
239 mark_as_advanced(OMNIORB_PYTHON_BACKEND)
241 set(OMNIORB_LIBRARIES
242 ${OMNIORB_LIBRARY_omniORB4}
243 ${OMNIORB_LIBRARY_omnithread}
244 ${OMNIORB_LIBRARY_omniDynamic4})
246 if(OMNIORB_LIBRARY_COS4)
247 set(OMNIORB_LIBRARIES ${OMNIORB_LIBRARIES} ${OMNIORB_LIBRARY_COS4})
249 if(OMNIORB_LIBRARY_COSDynamic4)
250 set(OMNIORB_LIBRARIES ${OMNIORB_LIBRARIES} ${OMNIORB_LIBRARY_COSDynamic4})
253 # Optionaly, extract the the version number from the acconfig.h file:
254 if( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
255 file( READ ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h OMNIORB_ACCONFIG_H )
256 string( REGEX MATCH "#define[\t ]+PACKAGE_VERSION[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" OMNIORB_ACCONFIG_H "${OMNIORB_ACCONFIG_H}" )
257 string( REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" OMNIORB_VERSION "${OMNIORB_ACCONFIG_H}" )
259 if( ${OMNIORB_VERSION} VERSION_LESS ${OMNIORB_MINIMUM_VERSION} )
260 message( "WARNING: your version of omniORB is older than the minimum required one (${OMNIORB_MINIMUM_VERSION}), using DIET with this version may result in undetermined behaviors." )
264 else( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
265 set( OMNIORB_VERSION "NOT-FOUND" )
266 endif( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
267 set( OMNIORB_VERSION ${OMNIORB_VERSION}
268 CACHE STRING "OmniORB version number." )
270 SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
271 SET(OMNIORB_IDLPYFLAGS -bpython)
272 IF (OMNIORB_PYTHON_BACKEND)
273 SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
274 ENDIF(OMNIORB_PYTHON_BACKEND)
275 SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
276 SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
279 SET(OMNIORB_DEFINITIONS "-D__x86__ -DCOMP_CORBA_DOUBLE -DCOMP_CORBA_LONG")
281 SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__WIN32__")
284 SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__macos__")#for omnithread.h to be checked...
289 message(FATAL_ERROR "OmniORB is required, please define OMNIORB_DIR as environment or cmake variable")