From 5d34a6148e1a5f6fc67fdc85c071c4df228ea825 Mon Sep 17 00:00:00 2001 From: mattraykowski Date: Fri, 23 Jul 2010 13:05:21 -0600 Subject: [PATCH] Change: #842 Setting WITH_STATIC_DRIVERS links GL/D3D and FMOD/AL/DS/XA to 3D and sound respectively. --- code/nel/CMakeLists.txt | 24 ++++---- code/nel/CMakeModules/nel.cmake | 57 +++++++++++++++++++ code/nel/src/3d/CMakeLists.txt | 2 +- code/nel/src/sound/driver/CMakeLists.txt | 2 +- .../src/sound/driver/dsound/CMakeLists.txt | 15 ++--- code/nel/src/sound/driver/fmod/CMakeLists.txt | 19 ++----- .../src/sound/driver/xaudio2/CMakeLists.txt | 19 ++----- 7 files changed, 89 insertions(+), 49 deletions(-) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 289de6689..d4d860438 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -19,6 +19,18 @@ #----------------------------------------------------------------------------- # Load some macros. SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") +#----------------------------------------------------------------------------- +# Set CMake 2.6 Policies. +IF(COMMAND cmake_policy) + # Works around warnings libraries linked against that don't + # have absolute paths (e.g. -lpthreads) + cmake_policy(SET CMP0003 NEW) + + # Works around warnings about escaped quotes in ADD_DEFINITIONS + # statements + cmake_policy(SET CMP0005 OLD) +ENDIF(COMMAND cmake_policy) + INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/nel.cmake) INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) @@ -47,18 +59,6 @@ SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) -#----------------------------------------------------------------------------- -# Set CMake 2.6 Policies. -IF(COMMAND cmake_policy) - # Works around warnings libraries linked against that don't - # have absolute paths (e.g. -lpthreads) - cmake_policy(SET CMP0003 NEW) - - # Works around warnings about escaped quotes in ADD_DEFINITIONS - # statements - cmake_policy(SET CMP0005 OLD) -ENDIF(COMMAND cmake_policy) - #----------------------------------------------------------------------------- # Set default config options # diff --git a/code/nel/CMakeModules/nel.cmake b/code/nel/CMakeModules/nel.cmake index 3c1ccdf9a..3b705fc13 100644 --- a/code/nel/CMakeModules/nel.cmake +++ b/code/nel/CMakeModules/nel.cmake @@ -68,6 +68,63 @@ MACRO(NL_ADD_RUNTIME_FLAGS name) ENDIF(WITH_STLPORT) ENDMACRO(NL_ADD_RUNTIME_FLAGS) +MACRO(NL_ADD_STATIC_VID_DRIVERS name) + IF(WITH_STATIC_DRIVERS) + IF(WIN32) + IF(WITH_DRIVER_DIRECT3D) + TARGET_LINK_LIBRARIES(${name} nel_drv_direct3d_win) + ENDIF(WITH_DRIVER_DIRECT3D) + + IF(WITH_DRIVER_DSOUND) + TARGET_LINK_LIBRARIES(${name} nel_drv_dsound) + ENDIF(WITH_DRIVER_DSOUND) + + IF(WITH_DRIVER_XAUDIO2) + TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2) + ENDIF(WITH_DRIVER_XAUDIO2) + ENDIF(WIN32) + + IF(WITH_DRIVER_OPENAL) + TARGET_LINK_LIBRARIES(${name} nel_drv_openal) + ENDIF(WITH_DRIVER_OPENAL) + + IF(WITH_DRIVER_FMOD) + TARGET_LINK_LIBRARIES(${name} nel_drv_fmod) + ENDIF(WITH_DRIVER_FMOD) + + IF(WITH_DRIVER_OPENGL) + IF(WIN32) + TARGET_LINK_LIBRARIES(${name} nel_drv_opengl_win) + ELSE(WIN32) + TARGET_LINK_LIBRARIES(${name} nel_drv_opengl) + ENDIF(WIN32) + ENDIF(WITH_DRIVER_OPENGL) + ENDIF(WITH_STATIC_DRIVERS) +ENDMACRO(NL_ADD_STATIC_VID_DRIVERS) + +MACRO(NL_ADD_STATIC_SND_DRIVERS name) + IF(WITH_STATIC_DRIVERS) + IF(WIN32) + IF(WITH_DRIVER_DSOUND) + TARGET_LINK_LIBRARIES(${name} nel_drv_dsound) + ENDIF(WITH_DRIVER_DSOUND) + + IF(WITH_DRIVER_XAUDIO2) + TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2) + ENDIF(WITH_DRIVER_XAUDIO2) + ENDIF(WIN32) + + IF(WITH_DRIVER_OPENAL) + TARGET_LINK_LIBRARIES(${name} nel_drv_openal) + ENDIF(WITH_DRIVER_OPENAL) + + IF(WITH_DRIVER_FMOD) + TARGET_LINK_LIBRARIES(${name} nel_drv_fmod) + ENDIF(WITH_DRIVER_FMOD) + + ENDIF(WITH_STATIC_DRIVERS) +ENDMACRO(NL_ADD_STATIC_SND_DRIVERS) + ### # Checks build vs. source location. Prevents In-Source builds. ### diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index 82acc0f91..71e6ad17b 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -667,7 +667,7 @@ NL_TARGET_LIB(nel3d ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY} ${JPEG_LIBRARY}) NL_DEFAULT_PROPS(nel3d "Library: NeL 3D") - +NL_ADD_STATIC_VID_DRIVERS(nel3d) NL_ADD_LIB_SUFFIX(nel3d) IF(WIN32) diff --git a/code/nel/src/sound/driver/CMakeLists.txt b/code/nel/src/sound/driver/CMakeLists.txt index 3c504a20f..283d1a5a7 100644 --- a/code/nel/src/sound/driver/CMakeLists.txt +++ b/code/nel/src/sound/driver/CMakeLists.txt @@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${LIBXML2_LIBRARIES} nelsound) nl_default_props(nelsnd_lowlevel "Library: NeL Sound Lowlevel") ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - +NL_ADD_STATIC_VID_DRIVERS(nelsnd_lowlevel) nl_add_lib_suffix(nelsnd_lowlevel) INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/sound/driver/dsound/CMakeLists.txt b/code/nel/src/sound/driver/dsound/CMakeLists.txt index fa5166d5a..acf3376f3 100644 --- a/code/nel/src/sound/driver/dsound/CMakeLists.txt +++ b/code/nel/src/sound/driver/dsound/CMakeLists.txt @@ -1,17 +1,14 @@ FILE(GLOB SRC *.cpp *.h) -ADD_LIBRARY(nel_drv_dsound SHARED ${SRC}) +NL_TARGET_DRIVER(nel_drv_dsound ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${DXSDK_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_dsound ${LIBXML2_LIBRARIES} nelsnd_lowlevel ${DXSDK_DSOUND_LIBRARY} ${DXSDK_GUID_LIBRARY}) -SET_TARGET_PROPERTIES(nel_drv_dsound PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r" - PROJECT_LABEL "Driver, Sound: DirectSound") + +NL_DEFAULT_PROPS(nel_drv_dsound "Driver, Sound: DirectSound") +NL_ADD_LIB_SUFFIX(nel_drv_dsound) +NL_ADD_RUNTIME_FLAGS(nel_drv_dsound) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WITH_PCH) diff --git a/code/nel/src/sound/driver/fmod/CMakeLists.txt b/code/nel/src/sound/driver/fmod/CMakeLists.txt index 976b727cf..ec5427ebd 100644 --- a/code/nel/src/sound/driver/fmod/CMakeLists.txt +++ b/code/nel/src/sound/driver/fmod/CMakeLists.txt @@ -1,22 +1,15 @@ FILE(GLOB SRC *.cpp *.h) -ADD_LIBRARY(nel_drv_fmod SHARED ${SRC}) +NL_TARGET_DRIVER(nel_drv_fmod ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FMOD_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_fmod ${LIBXML2_LIBRARIES} ${FMOD_LIBRARY} nelsnd_lowlevel) -SET_TARGET_PROPERTIES(nel_drv_fmod PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Driver, Sound: FMOD") -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -IF(WIN32) - SET_TARGET_PROPERTIES(nel_drv_fmod PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nel_drv_fmod "Driver, Sound: FMOD") +NL_ADD_LIB_SUFFIX(nel_drv_fmod) +NL_ADD_RUNTIME_FLAGS(nel_drv_fmod) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_fmod ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.h ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.cpp) diff --git a/code/nel/src/sound/driver/xaudio2/CMakeLists.txt b/code/nel/src/sound/driver/xaudio2/CMakeLists.txt index 57a2ebe68..68c6881ce 100644 --- a/code/nel/src/sound/driver/xaudio2/CMakeLists.txt +++ b/code/nel/src/sound/driver/xaudio2/CMakeLists.txt @@ -1,22 +1,15 @@ FILE(GLOB SRC *.cpp *.h) -ADD_LIBRARY(nel_drv_xaudio2 SHARED ${SRC}) +NL_TARGET_DRIVER(nel_drv_xaudio2 ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${DXSDK_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_xaudio2 ${LIBXML2_LIBRARIES} nelsnd_lowlevel ${DXSDK_XAUDIO_LIBRARY} ${DXSDK_GUID_LIBRARY} ${VORBIS_LIBRARIES} ${OGG_LIBRARY}) -SET_TARGET_PROPERTIES(nel_drv_xaudio2 PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR}) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -IF(WIN32) - SET_TARGET_PROPERTIES(nel_drv_xaudio2 PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r" - PROJECT_LABEL "Driver, Sound: XAudio2") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nel_drv_xaudio2 "Driver, Sound: XAudio2") +NL_ADD_LIB_SUFFIX(nel_drv_xaudio2) +NL_ADD_RUNTIME_FLAGS(nel_drv_xaudio2) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_xaudio2 ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.h ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.cpp)