diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f8f10fe3..aa863f64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,10 @@ include(GNUInstallDirs) SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) +IF(WIN32) + OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF) +ENDIF() + OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON) OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF) @@ -1275,8 +1279,36 @@ IF(TARGET build_version) ADD_DEPENDENCIES(OpenAL build_version) ENDIF() +SET(EX_TARGET OpenAL) + +if(WIN32 AND ALSOFT_BUILD_ROUTER) + SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME soft_oal) + + ADD_LIBRARY(Router SHARED router/router.c router/alc.c router/al.c) + SET_PROPERTY(TARGET Router APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS}) + IF(MSVC) + SET_PROPERTY(TARGET Router APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS") + ELSEIF(CMAKE_COMPILER_IS_GNUCC) + SET_PROPERTY(TARGET Router APPEND_STRING PROPERTY LINK_FLAGS " -mwindows") + ENDIF() + SET_TARGET_PROPERTIES(Router PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(Router PROPERTIES OUTPUT_NAME ${LIBNAME}) + IF(TARGET build_version) + ADD_DEPENDENCIES(Router build_version) + ENDIF() + SET(EX_TARGET Router) + + IF(ALSOFT_INSTALL) + INSTALL(TARGETS Router + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + ENDIF() +ENDIF() + IF(ALSOFT_INSTALL) - # Add an install target here INSTALL(TARGETS OpenAL EXPORT OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -1324,6 +1356,11 @@ if(ALSOFT_EMBED_HRTF_DATA) message(STATUS "") endif() +if(TARGET Router) + message(STATUS "Building DLL router") + message(STATUS "") +endif() + # Install alsoft.conf configuration file IF(ALSOFT_CONFIG) INSTALL(FILES alsoftrc.sample @@ -1360,7 +1397,7 @@ ENDIF() IF(ALSOFT_UTILS) ADD_EXECUTABLE(openal-info utils/openal-info.c) SET_PROPERTY(TARGET openal-info APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - TARGET_LINK_LIBRARIES(openal-info OpenAL) + TARGET_LINK_LIBRARIES(openal-info ${EX_TARGET}) ADD_EXECUTABLE(makehrtf utils/makehrtf.c) SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) @@ -1393,7 +1430,7 @@ IF(ALSOFT_TESTS) SET(TEST_COMMON_OBJS examples/common/alhelpers.c) ADD_EXECUTABLE(altonegen examples/altonegen.c ${COMMON_OBJS} ${TEST_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(altonegen OpenAL) + TARGET_LINK_LIBRARIES(altonegen ${EX_TARGET}) SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) IF(ALSOFT_INSTALL) @@ -1410,7 +1447,7 @@ ENDIF() IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alrecord examples/alrecord.c ${COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alrecord OpenAL) + TARGET_LINK_LIBRARIES(alrecord ${EX_TARGET}) SET_PROPERTY(TARGET alrecord APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) IF(ALSOFT_INSTALL) @@ -1428,35 +1465,35 @@ IF(ALSOFT_EXAMPLES) SET(EX_COMMON_OBJS examples/common/alhelpers.c) ADD_EXECUTABLE(alstream examples/alstream.c ${COMMON_OBJS} ${EX_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alstream ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL) + TARGET_LINK_LIBRARIES(alstream ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${EX_TARGET}) SET_PROPERTY(TARGET alstream APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} ) ADD_EXECUTABLE(alreverb examples/alreverb.c ${COMMON_OBJS} ${EX_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alreverb ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL) + TARGET_LINK_LIBRARIES(alreverb ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${EX_TARGET}) SET_PROPERTY(TARGET alreverb APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} ) ADD_EXECUTABLE(allatency examples/allatency.c ${COMMON_OBJS} ${EX_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(allatency ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL) + TARGET_LINK_LIBRARIES(allatency ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${EX_TARGET}) SET_PROPERTY(TARGET allatency APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} ) ADD_EXECUTABLE(alloopback examples/alloopback.c ${COMMON_OBJS} ${EX_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alloopback ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL) + TARGET_LINK_LIBRARIES(alloopback ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${EX_TARGET}) SET_PROPERTY(TARGET alloopback APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} ) ADD_EXECUTABLE(alhrtf examples/alhrtf.c ${COMMON_OBJS} ${EX_COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alhrtf ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL) + TARGET_LINK_LIBRARIES(alhrtf ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${EX_TARGET}) SET_PROPERTY(TARGET alhrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} @@ -1499,7 +1536,7 @@ IF(ALSOFT_EXAMPLES) ENDIF() IF(FFVER_OK) ADD_EXECUTABLE(alffplay examples/alffplay.cpp ${COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} OpenAL ${FFMPEG_LIBRARIES}) + TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ${EX_TARGET}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} |