From d75b0dd5843020567a496bf8876eda0931aea836 Mon Sep 17 00:00:00 2001 From: rti Date: Sat, 29 May 2010 18:27:27 +0200 Subject: [PATCH] Fixed: #872 NEL: build on Mac OS X --- code/nel/CMakeLists.txt | 5 +++++ code/nel/CMakeModules/nel.cmake | 5 ++++- code/nel/src/3d/driver/opengl/CMakeLists.txt | 8 ++++++++ code/nel/src/sound/CMakeLists.txt | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 46c351c1d..95553c4f4 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -92,8 +92,13 @@ IF(WITH_3D) IF(WITH_DRIVER_OPENGL) FIND_PACKAGE(OpenGL) IF(NOT WIN32) + FIND_PACKAGE(X11) FIND_PACKAGE(XF86VidMode) ENDIF(NOT WIN32) + IF(APPLE) + # TODO: remove Carbon as soon as Cocoa Support is stable on Mac + FIND_LIBRARY(CARBON NAMES Carbon) + ENDIF(APPLE) ENDIF(WITH_DRIVER_OPENGL) IF(WITH_CEGUI) diff --git a/code/nel/CMakeModules/nel.cmake b/code/nel/CMakeModules/nel.cmake index 47c9017c2..e0138a880 100644 --- a/code/nel/CMakeModules/nel.cmake +++ b/code/nel/CMakeModules/nel.cmake @@ -120,7 +120,10 @@ MACRO(NL_SETUP_BUILD) IF(WITH_COVERAGE) SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") ENDIF(WITH_COVERAGE) - SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++ -lrt") + SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++") + IF(NOT APPLE) + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lrt") + ENDIF(NOT APPLE) SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6") SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ") diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index f2ea8a6e3..29c1f9571 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -25,6 +25,14 @@ IF(WIN32) LINK_FLAGS "/NODEFAULTLIB:libcmt") ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS) ELSE(WIN32) + # NOTE: I know, those hardcoded things are evil. But FindOpenGL on Mac simply + # does not look for X11's OpenGL, just for the native one. + # TODO: FIXME remove as soon as Cocoa Support is stable on Mac + IF(APPLE) + INCLUDE_DIRECTORIES("/usr/X11/include") + TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON} "-L/usr/X11/lib" "-lGL") + ENDIF(APPLE) + TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_LIBRARIES}) IF(XF86VidMode_FOUND) INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR}) ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS}) diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 08826dea6..63f21b127 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -1,5 +1,11 @@ FILE(GLOB SRC *.cpp *.h) +# TODO: fixes a linking problem for libnelsound.dylib, but does not look like +# the cleanest way to solve the issue. FIXME! +IF(APPLE) + SET(SRC ${SRC} driver/sound_driver.cpp driver/buffer.cpp) +ENDIF(APPLE) + IF(NOT WIN32) ADD_LIBRARY(nelsound SHARED ${SRC}) ELSE(NOT WIN32)