Change Encyclo button name and macros icon
[ryzomcore.git] / nel / src / 3d / driver / opengl / CMakeLists.txt
blob1d5d3cf416b1280495fb1f8662e913df39416094
1 IF(NOT WIN32)
2   IF(APPLE)
3     FIND_LIBRARY(CARBON NAMES Carbon)
4     FIND_LIBRARY(COCOA NAMES Cocoa)
5     FIND_PACKAGE(OpenGL REQUIRED)
6   ELSE()
7     SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
8     SET(CMAKE_FIND_LIBRARY_SUFFIXES .so)
9     FIND_PACKAGE(X11)
10     IF(WITH_XRANDR AND NOT X11_Xrandr_FOUND)
11       MESSAGE(FATAL_ERROR "Required XRandR extension not found")
12     ENDIF()
13     FIND_PACKAGE(XF86VidMode)
14     FIND_PACKAGE(OpenGL REQUIRED)
15     SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
16   ENDIF()
17 ELSE()
18   FIND_PACKAGE(OpenGL REQUIRED)
19 ENDIF()
21 FILE(GLOB SRC *.cpp *.h *.def *.rc)
23 IF(APPLE)
24   FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp)
25   SET(SRC ${SRC} ${MAC_SRC})
26   SET_SOURCE_FILES_PROPERTIES(${SRC}
27     PROPERTIES COMPILE_FLAGS "-x objective-c++")
28 ENDIF()
30 IF(WIN32)
31   SET(NLDRV_OGL_LIB "nel_drv_opengl_win")
32 ELSE()
33   SET(NLDRV_OGL_LIB "nel_drv_opengl")
34 ENDIF()
36 # This helps to debug issue 310
37 IF(DEBUG_OGL_SPECULAR_FALLBACK)
38   ADD_DEFINITIONS(-DDEBUG_OGL_SPECULAR_FALLBACK)
39 ENDIF()
40 IF(DEBUG_OGL_COMBINE43_DISABLE)
41   ADD_DEFINITIONS(-DDEBUG_OGL_COMBINE43_DISABLE)
42 ENDIF()
44 NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
46 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
48 TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
49 NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
50 NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
51 NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
53 IF(WIN32)
54   ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS)
55 ENDIF()
57 IF(APPLE)
58   TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
59   TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
60 ENDIF()
62 IF(UNIX AND NOT APPLE)
63   TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB})
64   IF(XF86VidMode_FOUND)
65     INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
66     ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
67     TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY})
68   ENDIF()
69   IF(WITH_XRANDR AND X11_Xrandr_FOUND)
70     INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH})
71     ADD_DEFINITIONS(-DHAVE_XRANDR)
72     TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrandr_LIB})
73   ENDIF()
74   IF(X11_Xrender_FOUND)
75     INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH})
76     ADD_DEFINITIONS(-DHAVE_XRENDER)
77     TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrender_LIB})
78   ENDIF()
79   IF(X11_Xcursor_FOUND)
80     INCLUDE_DIRECTORIES(${X11_Xcursor_INCLUDE_PATH})
81     ADD_DEFINITIONS(-DHAVE_XCURSOR)
82     TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xcursor_LIB})
83   ENDIF()
84   IF(X11_Xext_FOUND)
85     TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xext_LIB})
86   ENDIF()
87   # libraries needed to be linked while linking to static X11 libraries
88 #  FIND_LIBRARY(XCB_LIBRARY
89 #    NAMES xcb
90 #    HINTS ${X11_LIB_SEARCH_PATH})
91 #  IF(XCB_LIBRARY)
92 #    TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XCB_LIBRARY})
93 #  ENDIF()
94 ENDIF()
96 IF(WITH_PCH)
97   ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
98 ENDIF()
100 IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
101   INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} COMPONENT drivers3d)
102   IF(WITH_MAXPLUGIN)
103     INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
104   ENDIF()
105 ENDIF()