mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-27 02:50:53 +00:00
Fixed: #1080 Under Linux, load NeL drivers from a specific directory
This commit is contained in:
parent
9ce81d57e3
commit
aa0e5be06b
11 changed files with 141 additions and 66 deletions
|
@ -189,6 +189,11 @@ IF(FINAL_VERSION)
|
|||
ADD_DEFINITIONS(-DFINAL_VERSION=1)
|
||||
ENDIF(FINAL_VERSION)
|
||||
|
||||
# config.h configuration and use by projects
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(include)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ MACRO(NL_TARGET_DRIVER name)
|
|||
IF(WITH_STATIC_DRIVERS)
|
||||
ADD_LIBRARY(${name} STATIC ${ARGN})
|
||||
ELSE(WITH_STATIC_DRIVERS)
|
||||
ADD_LIBRARY(${name} SHARED ${ARGN})
|
||||
ADD_LIBRARY(${name} MODULE ${ARGN})
|
||||
ENDIF(WITH_STATIC_DRIVERS)
|
||||
ENDMACRO(NL_TARGET_DRIVER)
|
||||
|
||||
|
@ -38,13 +38,15 @@ ENDMACRO(NL_TARGET_DRIVER)
|
|||
###
|
||||
MACRO(NL_DEFAULT_PROPS name label)
|
||||
GET_TARGET_PROPERTY(type ${name} TYPE)
|
||||
IF((${type} STREQUAL SHARED_LIBRARY) OR (${type} STREQUAL MODULE_LIBRARY))
|
||||
# Set versions only if target is a shared library or a module
|
||||
SET(versions VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
|
||||
ENDIF((${type} STREQUAL SHARED_LIBRARY) OR (${type} STREQUAL MODULE_LIBRARY))
|
||||
IF(${type} STREQUAL SHARED_LIBRARY)
|
||||
# Set versions only if target is a shared library
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
||||
${versions}
|
||||
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}
|
||||
PROJECT_LABEL ${label})
|
||||
ELSE(${type} STREQUAL SHARED_LIBRARY)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
||||
PROJECT_LABEL ${label})
|
||||
ENDIF(${type} STREQUAL SHARED_LIBRARY)
|
||||
ENDMACRO(NL_DEFAULT_PROPS)
|
||||
|
||||
###
|
||||
|
@ -331,4 +333,22 @@ MACRO(NL_SETUP_PREFIX_PATHS)
|
|||
ENDIF(WIN32)
|
||||
ENDIF(NOT NL_BIN_PREFIX)
|
||||
|
||||
## Allow override of install_prefix/lib path.
|
||||
IF(NOT NL_LIB_PREFIX)
|
||||
IF(WIN32)
|
||||
SET(NL_LIB_PREFIX "../lib" CACHE PATH "Installation path for libraries.")
|
||||
ELSE(WIN32)
|
||||
SET(NL_LIB_PREFIX "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation path for libraries.")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT NL_LIB_PREFIX)
|
||||
|
||||
## Allow override of install_prefix/lib path.
|
||||
IF(NOT NL_DRIVER_PREFIX)
|
||||
IF(WIN32)
|
||||
SET(NL_DRIVER_PREFIX "../lib" CACHE PATH "Installation path for drivers.")
|
||||
ELSE(WIN32)
|
||||
SET(NL_DRIVER_PREFIX "${CMAKE_INSTALL_PREFIX}/lib/nel" CACHE PATH "Installation path for drivers.")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT NL_DRIVER_PREFIX)
|
||||
|
||||
ENDMACRO(NL_SETUP_PREFIX_PATHS)
|
||||
|
|
43
code/nel/config.h.cmake
Normal file
43
code/nel/config.h.cmake
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#cmakedefine HAVE_DL_H 1
|
||||
#cmakedefine HAVE_EXECINFO_H 1
|
||||
#cmakedefine HAVE_ICONV 1
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
#cmakedefine HAVE_LANGINFO_CODESET 1
|
||||
#cmakedefine HAVE_LIMITS_H 1
|
||||
#cmakedefine HAVE_MALLOC_H 1
|
||||
#cmakedefine HAVE_PAM_MISC_H 1
|
||||
#cmakedefine HAVE_PAM_PAM_APPL_H 1
|
||||
#cmakedefine HAVE_PTHREAD 1
|
||||
#cmakedefine HAVE_SECURITY_PAM_APPL_H 1
|
||||
#cmakedefine HAVE_SECURITY_PAM_MISC_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_SYS_MOUNT_H 1
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
#cmakedefine HAVE_SYS_STATVFS_H 1
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
#cmakedefine HAVE_UTIME_H 1
|
||||
#cmakedefine HAVE_WCHAR_H 1
|
||||
|
||||
#cmakedefine HAVE_BACKTRACE 1
|
||||
#cmakedefine HAVE_INET_NTOA 1
|
||||
#cmakedefine HAVE_INET_NTOP 1
|
||||
#cmakedefine HAVE_INET_PTON 1
|
||||
#cmakedefine HAVE_STRERROR 1
|
||||
#cmakedefine HAVE_STRLCAT 1
|
||||
#cmakedefine HAVE_STRPTIME 1
|
||||
#cmakedefine HAVE_STRTOK_R 1
|
||||
#cmakedefine HAVE_STRTOULL 1
|
||||
#cmakedefine HAVE_STATVFS 1
|
||||
#cmakedefine HAVE_STAT64 1
|
||||
|
||||
#cmakedefine NL_BIN_PREFIX "${NL_BIN_PREFIX}"
|
||||
#cmakedefine NL_ETC_PREFIX "${NL_ETC_PREFIX}"
|
||||
#cmakedefine NL_SHARE_PREFIX "${NL_SHARE_PREFIX}"
|
||||
#cmakedefine NL_LIB_PREFIX "${NL_LIB_PREFIX}"
|
||||
#cmakedefine NL_DRIVER_PREFIX "${NL_DRIVER_PREFIX}"
|
||||
|
||||
#endif // CONFIG_H
|
|
@ -2,9 +2,9 @@ FILE(GLOB SRC *.cpp *.h *.def)
|
|||
|
||||
NL_TARGET_DRIVER(nel_drv_direct3d_win ${SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INC} ${DXSDK_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(nel_drv_direct3d_win nel3d ${LIBXML2_LIBRARIES} ${FREETYPE_LIB} ${DXSDK_D3DX9_LIBRARY} ${DXSDK_D3D9_LIBRARY} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(nel_drv_direct3d_win nel3d ${DXSDK_D3DX9_LIBRARY} ${DXSDK_D3D9_LIBRARY} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
|
||||
NL_DEFAULT_PROPS(nel_drv_direct3d_win "Driver, Video: Direct3D")
|
||||
NL_ADD_RUNTIME_FLAGS(nel_drv_direct3d_win)
|
||||
|
@ -12,13 +12,11 @@ NL_ADD_LIB_SUFFIX(nel_drv_direct3d_win)
|
|||
|
||||
ADD_DEFINITIONS(/Ddriver_direct3d_EXPORTS)
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||
|
||||
IF(WITH_PCH)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||
INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
|
@ -12,8 +12,9 @@ ENDIF(WIN32)
|
|||
|
||||
NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "Driver, Video: OpenGL")
|
||||
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
||||
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
|
||||
|
@ -27,7 +28,7 @@ ELSE(WIN32)
|
|||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
|
||||
ELSE(APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_LIB})
|
||||
IF(XF86VidMode_FOUND)
|
||||
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
|
||||
|
@ -41,13 +42,11 @@ ELSE(WIN32)
|
|||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||
|
||||
IF(NOT APPLE AND WITH_PCH)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
|
||||
ENDIF(NOT APPLE AND WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include "nel/3d/vertex_buffer.h"
|
||||
#include "nel/3d/index_buffer.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# define NOMINMAX
|
||||
|
@ -75,6 +78,10 @@ IDriver *CDRU::createGlDriver() throw (EDru)
|
|||
// hInst=LoadLibrary(NL3D_GL_DLL_NAME);
|
||||
CLibrary driverLib;
|
||||
|
||||
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
|
||||
driverLib.addLibPath(NL_DRIVER_PREFIX);
|
||||
#endif
|
||||
|
||||
// if (!hInst)
|
||||
if (!driverLib.loadLibrary(NL3D_GL_DLL_NAME, true, true, false))
|
||||
{
|
||||
|
|
|
@ -2,20 +2,18 @@ FILE(GLOB SRC *.cpp *.h)
|
|||
|
||||
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})
|
||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(nel_drv_dsound nelmisc nelsnd_lowlevel ${DXSDK_DSOUND_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
|
||||
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)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_dsound ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.cpp)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nel_drv_dsound RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
INSTALL(TARGETS nel_drv_dsound RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS nel_drv_dsound RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
|
@ -2,20 +2,18 @@ FILE(GLOB SRC *.cpp *.h)
|
|||
|
||||
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)
|
||||
INCLUDE_DIRECTORIES(${FMOD_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(nel_drv_fmod ${FMOD_LIBRARY} nelmisc nelsnd_lowlevel)
|
||||
|
||||
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)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nel_drv_fmod RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
INSTALL(TARGETS nel_drv_fmod RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS nel_drv_fmod RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
|
@ -37,7 +37,7 @@ IF(WITH_PCH)
|
|||
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_openal ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.cpp)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nel_drv_openal RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
INSTALL(TARGETS nel_drv_openal RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS nel_drv_openal RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#include "nel/sound/driver/sound_driver.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# define NOMINMAX
|
||||
# include <windows.h>
|
||||
|
@ -201,6 +205,11 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
|
|||
}
|
||||
|
||||
CLibrary driverLib;
|
||||
|
||||
#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX)
|
||||
driverLib.addLibPath(NL_DRIVER_PREFIX);
|
||||
#endif
|
||||
|
||||
// Load it (adding standard nel pre/suffix, looking in library path and not taking ownership)
|
||||
if (!driverLib.loadLibrary(dllName, true, true, false))
|
||||
{
|
||||
|
|
|
@ -28,20 +28,18 @@ SOURCE_GROUP(efx FILES
|
|||
|
||||
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})
|
||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(nel_drv_xaudio2 nelmisc nelsnd_lowlevel ${DXSDK_XAUDIO_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
|
||||
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)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nel_drv_xaudio2 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
INSTALL(TARGETS nel_drv_xaudio2 RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS nel_drv_xaudio2 RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
|
|
Loading…
Reference in a new issue