aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-07-10 01:57:22 -0700
committerChris Robinson <[email protected]>2017-07-10 01:57:22 -0700
commitf313f9c117846b11b2e88198be9af0174e57b577 (patch)
treea1006253329d422da4d8b3c4b0e1e33bc95b5207
parentd6326c1791d6a5b3280ad6dd4e25d1c1f42c2724 (diff)
Rename the OpenAL target if also building the router
This is rather ugly, but it's necessary to get a proper export configuration. The issue was that the main OpenAL target library name is set to soft_oal when the router is being built, which is incorrect for the exported config library. Exporting the router would have the incorrect name of OpenAL::Router. So this change has the router use the OpenAL target name when it's built, which is good since it will have the standard OpenAL lib name for apps to link to and get the OpenAL::OpenAL export name. The main library's target name is changed in this case to avoid conflicts.
-rw-r--r--CMakeLists.txt138
1 files changed, 70 insertions, 68 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca69bdf9..c2762a8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1201,79 +1201,76 @@ MACRO(ADD_INCLUDE_DIRS TRGT TESTVAR INCVAR)
ENDIF()
ENDMACRO()
+UNSET(HAS_ROUTER)
+SET(IMPL_TARGET OpenAL)
+
# Build main library
IF(LIBTYPE STREQUAL "STATIC")
ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
ELSE()
- ADD_LIBRARY(OpenAL SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
- IF(WIN32)
+ IF(WIN32 AND ALSOFT_BUILD_ROUTER)
+ ADD_LIBRARY(OpenAL SHARED router/router.c router/alc.c router/al.c ${COMMON_OBJS})
+ SET_PROPERTY(TARGET OpenAL APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+ SET_PROPERTY(TARGET OpenAL APPEND PROPERTY
+ COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES
+ )
+ SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS})
+ IF(MSVC)
+ SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS")
+ ELSEIF(CMAKE_COMPILER_IS_GNUCC)
+ SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " -mwindows")
+ ENDIF()
SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
+ SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
+ IF(TARGET build_version)
+ ADD_DEPENDENCIES(OpenAL build_version)
+ ENDIF()
+ SET(HAS_ROUTER 1)
+
+ SET(LIBNAME "soft_oal")
+ SET(IMPL_TARGET soft_oal)
+ ENDIF()
+
+ ADD_LIBRARY(${IMPL_TARGET} SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
+ IF(WIN32)
+ SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
ENDIF()
ENDIF()
-SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME}
+SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
VERSION ${LIB_VERSION}
SOVERSION ${LIB_MAJOR_VERSION}
)
-SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES
+SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES
"${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc"
)
-ADD_INCLUDE_DIRS(OpenAL HAVE_ALSA ALSA_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_OSS OSS_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_SOLARIS AUDIOIO_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_SNDIO SOUNDIO_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_QSA QSA_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_DSOUND DSOUND_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_PORTAUDIO PORTAUDIO_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_PULSEAUDIO PULSEAUDIO_INCLUDE_DIRS)
-ADD_INCLUDE_DIRS(OpenAL HAVE_JACK JACK_INCLUDE_DIRS)
-SET_PROPERTY(TARGET OpenAL APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_ALSA ALSA_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_OSS OSS_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_SOLARIS AUDIOIO_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_SNDIO SOUNDIO_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_QSA QSA_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_DSOUND DSOUND_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_PORTAUDIO PORTAUDIO_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_PULSEAUDIO PULSEAUDIO_INCLUDE_DIRS)
+ADD_INCLUDE_DIRS(${IMPL_TARGET} HAVE_JACK JACK_INCLUDE_DIRS)
+SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND PROPERTY
+ COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES
+)
IF(WIN32 AND ALSOFT_NO_UID_DEFS)
- SET_PROPERTY(TARGET OpenAL APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS)
+ SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS)
ENDIF()
-SET_PROPERTY(TARGET OpenAL APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
+SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS})
-SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS})
-
-TARGET_LINK_LIBRARIES(OpenAL ${EXTRA_LIBS})
+TARGET_LINK_LIBRARIES(${IMPL_TARGET} ${EXTRA_LIBS})
IF(TARGET build_version)
- ADD_DEPENDENCIES(OpenAL build_version)
+ ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
ENDIF()
-SET(EX_TARGET OpenAL)
-
IF(WIN32)
IF(MSVC)
- SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS")
+ SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS")
ELSEIF(CMAKE_COMPILER_IS_GNUCC)
- SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " -mwindows")
- ENDIF()
-
- if(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 ${COMMON_OBJS})
- SET_PROPERTY(TARGET Router APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
- SET_PROPERTY(TARGET Router APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES)
- SET_PROPERTY(TARGET Router 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()
+ SET_PROPERTY(TARGET ${IMPL_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -mwindows")
ENDIF()
if(NOT LIBTYPE STREQUAL "STATIC")
@@ -1289,9 +1286,9 @@ IF(WIN32)
MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
ENDIF()
ELSE()
- SET_PROPERTY(TARGET ${EX_TARGET} APPEND_STRING PROPERTY LINK_FLAGS
+ SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--output-def,OpenAL32.def")
- ADD_CUSTOM_COMMAND(TARGET ${EX_TARGET} POST_BUILD
+ ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
@@ -1326,9 +1323,19 @@ IF(ALSOFT_INSTALL)
)
INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ IF(TARGET soft_oal)
+ INSTALL(TARGETS soft_oal
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+ ENDIF()
ENDIF()
+if(HAS_ROUTER)
+ message(STATUS "")
+ message(STATUS "Building DLL router")
+endif()
+
MESSAGE(STATUS "")
MESSAGE(STATUS "Building OpenAL with support for the following backends:")
MESSAGE(STATUS " ${BACKENDS}")
@@ -1350,11 +1357,6 @@ 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
@@ -1391,7 +1393,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 ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(openal-info OpenAL)
ADD_EXECUTABLE(makehrtf utils/makehrtf.c)
SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
@@ -1424,7 +1426,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 ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(altonegen OpenAL)
SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
IF(ALSOFT_INSTALL)
@@ -1441,7 +1443,7 @@ ENDIF()
IF(ALSOFT_EXAMPLES)
ADD_EXECUTABLE(alrecord examples/alrecord.c ${COMMON_OBJS})
- TARGET_LINK_LIBRARIES(alrecord ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alrecord OpenAL)
SET_PROPERTY(TARGET alrecord APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
IF(ALSOFT_INSTALL)
@@ -1459,35 +1461,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} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alstream ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL)
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} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alreverb ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL)
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} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(allatency ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL)
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} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alloopback ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL)
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} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alhrtf ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} OpenAL)
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}
@@ -1530,7 +1532,7 @@ IF(ALSOFT_EXAMPLES)
ENDIF()
IF(FFVER_OK)
ADD_EXECUTABLE(alffplay examples/alffplay.cpp ${COMMON_OBJS})
- TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ${EX_TARGET})
+ TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} OpenAL)
SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
SET_PROPERTY(TARGET alffplay APPEND PROPERTY
INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}