1 # NEL_DIR can be specified as root directory
\r
4 # NELDRIVER_XXX_BINARY_DEBUG
\r
5 # NELDRIVER_XXX_BINARY_RELEASE
\r
6 # NELDRIVER_XXX_LIBRARY_DEBUG
\r
7 # NELDRIVER_XXX_LIBRARY_RELEASE
\r
8 # NELDRIVER_XXX_FOUND
\r
16 INCLUDE(FindHelpers)
\r
18 # Init all variables we'll set
\r
20 SET(NEL_INCLUDE_DIR)
\r
21 SET(NEL_INCLUDE_DIRS)
\r
24 SET(NEL_STATIC_DRIVERS)
\r
25 SET(NEL_VERSION_MAJOR)
\r
26 SET(NEL_VERSION_MINOR)
\r
27 SET(NEL_VERSION_PATCH)
\r
31 SET(NEL_MODULES_FOUND)
\r
32 SET(NEL_MODULES_AVAILABLE 3d georges gui ligo logic net pacs sound) # cegui pipeline
\r
34 SET(NEL_DRIVERS_FOUND)
\r
35 SET(NEL_DRIVERS_AVAILABLE opengl opengles direct3d dsound fmod openal xaudio2)
\r
37 SET(NELMISC_FIND_REQUIRED ${NeL_FIND_REQUIRED})
\r
39 # Force search of NELMISC
\r
40 FIND_PACKAGE_HELPER(nelmisc nel/misc/types_nl.h RELEASE nelmisc_r nelmisc DEBUG nelmisc_d DIR ${NEL_DIR} VERBOSE QUIET)
\r
43 # define NEL_DIR if not specified
\r
45 GET_FILENAME_COMPONENT(NEL_DIR ${NELMISC_INCLUDE_DIR}/.. ABSOLUTE)
\r
48 # Aliases for include directory
\r
49 SET(NEL_INCLUDE_DIR ${NELMISC_INCLUDE_DIR})
\r
50 SET(NEL_INCLUDE_DIRS ${NEL_INCLUDE_DIR})
\r
52 MESSAGE(STATUS "Found NeL headers in ${NEL_INCLUDE_DIR}")
\r
54 GET_FILENAME_COMPONENT(NEL_LIBRARY_DIR ${NELMISC_LIBRARY} DIRECTORY)
\r
56 MESSAGE(STATUS "Found NeL library in ${NEL_LIBRARY_DIR}")
\r
58 # TODO: implement static version checks for Windows
\r
62 GET_FILENAME_COMPONENT(_LIBEXT ${NELMISC_LIBRARY} EXT)
\r
64 IF(_LIBEXT STREQUAL ".a")
\r
66 MESSAGE(STATUS "NeL is using static libraries")
\r
71 SET(NELDRIVER_DIRS_TO_CHECK
\r
72 ${NEL_DIR}/bin${LIB_SUFFIX}
\r
76 SET(NELDRIVER_DIRS_TO_CHECK
\r
77 /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel
\r
78 /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
\r
79 /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel
\r
80 /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
\r
86 # check for static drivers
\r
87 FOREACH(_DRIVER ${NEL_DRIVERS_AVAILABLE})
\r
89 SET(_DRIVER_RELASE_FILE "nel_drv_${_DRIVER}_win_r")
\r
90 SET(_DRIVER_DEBUG_FILE "nel_drv_${_DRIVER}_win_d")
\r
91 SET(_DRIVER_SHARED_EXT dll)
\r
92 SET(_DRIVER_STATIC_EXT lib)
\r
94 SET(_DRIVER_RELEASE_FILE "nel_drv_${_DRIVER}")
\r
95 SET(_DRIVER_DEBUG_FILE)
\r
96 SET(_DRIVER_SHARED_EXT so)
\r
97 SET(_DRIVER_STATIC_EXT a)
\r
100 STRING(TOUPPER ${_DRIVER} _UPDRIVER)
\r
102 FOREACH(_DIR ${NELDRIVER_DIRS_TO_CHECK})
\r
105 IF(_DRIVER_RELASE_FILE)
\r
106 SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}")
\r
107 IF(EXISTS ${_FILE})
\r
108 SET(NELDRIVER_${_UPDRIVER}_BINARY_RELEASE ${_FILE})
\r
110 MESSAGE(STATUS "Found NeL release shared driver ${_DRIVER}: ${_FILE}")
\r
112 SET(NEL_STATIC_DRIVERS OFF)
\r
114 IF(NOT NEL_DRIVER_DIR)
\r
115 SET(NEL_DRIVER_DIR ${_DIR})
\r
119 SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}")
\r
120 IF(EXISTS ${_FILE})
\r
121 SET(NELDRIVER_${_UPDRIVER}_LIBRARY_RELEASE ${_FILE})
\r
123 MESSAGE(STATUS "Found NeL release static driver ${_DRIVER}: ${_FILE}")
\r
125 SET(NEL_STATIC_DRIVERS ON)
\r
127 IF(NOT NEL_DRIVER_DIR)
\r
128 SET(NEL_DRIVER_DIR ${_DIR})
\r
133 IF(_DRIVER_DEBUG_FILE)
\r
134 SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}")
\r
135 IF(EXISTS ${_FILE})
\r
136 SET(NELDRIVER_${_UPDRIVER}_BINARY_DEBUG ${_FILE})
\r
138 MESSAGE(STATUS "Found NeL debug shared driver ${_DRIVER}: ${_FILE}")
\r
140 SET(NEL_STATIC_DRIVERS OFF)
\r
142 IF(NOT NEL_DRIVER_DIR)
\r
143 SET(NEL_DRIVER_DIR ${_DIR})
\r
147 SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}")
\r
148 IF(EXISTS ${_FILE})
\r
149 SET(NELDRIVER_${_UPDRIVER}_LIBRARY_DEBUG ${_FILE})
\r
151 MESSAGE(STATUS "Found NeL debug static driver ${_DRIVER}: ${_FILE}")
\r
153 SET(NEL_STATIC_DRIVERS ON)
\r
155 IF(NOT NEL_DRIVER_DIR)
\r
156 SET(NEL_DRIVER_DIR ${_DIR})
\r
161 SET(NELDRIVER_${_UPDRIVER}_FOUND ON)
\r
162 LIST(APPEND NEL_DRIVERS_FOUND ${_DRIVER})
\r
168 MESSAGE(STATUS "Found NeL driver in ${NEL_DRIVER_DIR}")
\r
170 PARSE_VERSION_OTHER(${NEL_INCLUDE_DIR}/nel/misc/version_nl.h NL_VERSION_MAJOR NL_VERSION_MINOR NL_VERSION_PATCH NL_REVISION)
\r
172 SET(NEL_VERSION_MAJOR ${NL_VERSION_MAJOR})
\r
173 SET(NEL_VERSION_MINOR ${NL_VERSION_MINOR})
\r
174 SET(NEL_VERSION_PATCH ${NL_VERSION_PATCH})
\r
175 SET(NEL_REVISION ${NL_REVISION})
\r
177 IF(NOT NEL_VERSION)
\r
178 IF(NEL_VERSION_MAJOR OR NEL_VERSION_MINOR} OR NEL_VERSION_PATCH)
\r
179 SET(NEL_VERSION "${NEL_VERSION_MAJOR}.${NEL_VERSION_MINOR}.${NEL_VERSION_PATCH}")
\r
181 SET(NEL_VERSION "0.5.0")
\r
185 SET(NEL_VERSION "${NEL_VERSION}.${NEL_REVISION}")
\r
189 FIND_PACKAGE(PNG REQUIRED)
\r
191 LIST(APPEND NELMISC_LIBRARIES ${PNG_LIBRARIES})
\r
194 FIND_PACKAGE(Jpeg REQUIRED)
\r
196 LIST(APPEND NELMISC_LIBRARIES ${JPEG_LIBRARY})
\r
202 LIST(APPEND NELMISC_LIBRARIES ${GIF_LIBRARY})
\r
208 LIST(APPEND NELMISC_LIBRARIES ${LIBXML2_LIBRARIES})
\r
212 LIST(APPEND NELMISC_LIBRARIES ${CMAKE_DL_LIBS})
\r
215 FIND_PACKAGE(Threads)
\r
218 LIST(APPEND NELMISC_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
\r
221 IF(UNIX AND NOT APPLE)
\r
222 LIST(APPEND NELMISC_LIBRARIES rt)
\r
225 LIST(REMOVE_ITEM NeL_FIND_COMPONENTS misc)
\r
227 LIST(APPEND NEL_MODULES_FOUND misc)
\r
228 LIST(APPEND NEL_LIBRARIES ${NELMISC_LIBRARIES})
\r
231 IF(NOT NeL_FIND_COMPONENTS)
\r
232 SET(NeL_FIND_COMPONENTS ${NEL_MODULES_AVAILABLE})
\r
234 # We can skip not installed modules
\r
235 SET(NeL_FIND_REQUIRED OFF)
\r
238 FOREACH(COMPONENT ${NeL_FIND_COMPONENTS})
\r
239 SET(_NAME NeL${COMPONENT})
\r
240 STRING(TOUPPER ${_NAME} _UPNAME)
\r
242 # module is required
\r
243 SET(${_NAME}_FIND_REQUIRED ${NeL_FIND_REQUIRED})
\r
245 IF(COMPONENT STREQUAL "3d")
\r
246 SET(HEADER_FILE shape.h)
\r
247 # ELSEIF(COMPONENT STREQUAL "cegui")
\r
248 # SET(HEADER_FILE shape.h)
\r
249 ELSEIF(COMPONENT STREQUAL "georges")
\r
250 SET(HEADER_FILE form.h)
\r
251 ELSEIF(COMPONENT STREQUAL "gui")
\r
252 SET(HEADER_FILE reflect.h)
\r
253 ELSEIF(COMPONENT STREQUAL "ligo")
\r
254 SET(HEADER_FILE primitive.h)
\r
255 ELSEIF(COMPONENT STREQUAL "logic")
\r
256 SET(HEADER_FILE logic_state.h)
\r
257 ELSEIF(COMPONENT STREQUAL "net")
\r
258 SET(HEADER_FILE sock.h)
\r
259 ELSEIF(COMPONENT STREQUAL "pacs")
\r
260 SET(HEADER_FILE primitive_block.h)
\r
261 # ELSEIF(COMPONENT STREQUAL "pipeline")
\r
262 # SET(HEADER_FILE shape.h)
\r
263 ELSEIF(COMPONENT STREQUAL "sound")
\r
264 SET(HEADER_FILE shape.h)
\r
269 # display if a component has a wrong name
\r
270 IF(NOT HEADER_FILE)
\r
271 MESSAGE(STATUS "NeL module ${COMPONENT} not supported, ignoring it...")
\r
275 FIND_PACKAGE_HELPER(${_NAME} nel/${COMPONENT}/${HEADER_FILE}
\r
276 RELEASE nel${COMPONENT}_r nel${COMPONENT}
\r
277 DEBUG nel${COMPONENT}_d
\r
281 IF(${_UPNAME}_FOUND)
\r
282 LIST(APPEND NEL_MODULES_FOUND ${COMPONENT})
\r
284 # all NeL libraries depend on nelmisc in static
\r
286 LIST(APPEND ${_UPNAME}_LIBRARIES ${NELMISC_LIBRARIES})
\r
289 IF(COMPONENT STREQUAL "3d")
\r
291 # 3rd party dependencies
\r
292 FIND_PACKAGE(Freetype REQUIRED)
\r
294 LIST(APPEND ${_UPNAME}_LIBRARIES ${FREETYPE_LIBRARIES})
\r
297 # Append static 3D drivers
\r
298 IF(NEL_STATIC_DRIVERS)
\r
299 # Direct3D driver (only under Windows)
\r
301 IF(NELDRIVER_DIRECT3D_LIBRARY_DEBUG)
\r
302 LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_DIRECT3D_LIBRARY_DEBUG})
\r
305 IF(NELDRIVER_DIRECT3D_LIBRARY_RELEASE)
\r
306 LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_DIRECT3D_LIBRARY_RELEASE})
\r
311 IF(NELDRIVER_OPENGL_LIBRARY_DEBUG)
\r
312 LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_OPENGL_LIBRARY_DEBUG})
\r
315 IF(NELDRIVER_OPENGL_LIBRARY_RELEASE)
\r
316 LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_OPENGL_LIBRARY_RELEASE})
\r
320 ELSEIF(COMPONENT STREQUAL "gui")
\r
321 FIND_PACKAGE(Luabind REQUIRED)
\r
324 LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES})
\r
330 LIST(APPEND ${_UPNAME}_LIBRARIES ${CURL_LIBRARIES})
\r
331 LIST(APPEND ${_UPNAME}_DEFINITIONS ${CURL_DEFINITIONS})
\r
334 # TODO: remove complately OpenSSL requirement on Windows
\r
336 # Only used by libcurl under Linux
\r
337 FIND_PACKAGE(OpenSSL REQUIRED)
\r
340 LIST(APPEND OPENSSL_LIBRARIES Crypt32.lib)
\r
343 # Only Linux version of libcurl depends on OpenSSL
\r
344 LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
\r
345 LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
\r
347 LIST(APPEND NEL_DEFINITIONS ${${_UPNAME}_DEFINITIONS})
\r
348 ELSEIF(COMPONENT STREQUAL "sound")
\r
349 FIND_PACKAGE(Ogg REQUIRED)
\r
352 LIST(APPEND ${_UPNAME}_LIBRARIES ${OGG_LIBRARY})
\r
355 FIND_PACKAGE(Vorbis REQUIRED)
\r
358 LIST(APPEND ${_UPNAME}_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
\r
362 # Link to snd_lowlevel
\r
363 FIND_LIBRARY_HELPER(nelsnd_lowlevel RELEASE nelsnd_lowlevel_r DEBUG nelsnd_lowlevel_d DIR ${NEL_DIR} REQUIRED)
\r
365 IF(NELSND_LOWLEVEL_LIBRARIES)
\r
366 MESSAGE(STATUS "Found NeL sound lowlevel ${NELSND_LOWLEVEL_LIBRARIES}")
\r
368 LIST(APPEND NELSOUND_LIBRARIES ${NELSND_LOWLEVEL_LIBRARIES})
\r
370 IF(NEL_STATIC_DRIVERS)
\r
371 # DirectSound, XAudio2 and FMod drivers (only under Windows)
\r
374 IF(NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG)
\r
375 LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG})
\r
378 IF(NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE)
\r
379 LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE})
\r
383 IF(NELDRIVER_FMOD_LIBRARY_DEBUG)
\r
384 LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_FMOD_LIBRARY_DEBUG})
\r
387 IF(NELDRIVER_FMOD_LIBRARY_RELEASE)
\r
388 LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_FMOD_LIBRARY_RELEASE})
\r
392 IF(NELDRIVER_XAUDIO2_LIBRARY_DEBUG)
\r
393 LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_XAUDIO2_LIBRARY_DEBUG})
\r
396 IF(NELDRIVER_XAUDIO2_LIBRARY_RELEASE)
\r
397 LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_XAUDIO2_LIBRARY_RELEASE})
\r
402 IF(NELDRIVER_OPENAL_LIBRARY_DEBUG)
\r
403 LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_OPENAL_LIBRARY_DEBUG})
\r
406 IF(NELDRIVER_OPENAL_LIBRARY_RELEASE)
\r
407 LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_OPENAL_LIBRARY_RELEASE})
\r
414 LIST(APPEND NEL_LIBRARIES ${${_UPNAME}_LIBRARIES})
\r
418 MESSAGE_VERSION_PACKAGE_HELPER(NeL ${NEL_VERSION} ${NEL_MODULES_FOUND})
\r