From 952fb94ff7e6911c26198455eb317c07e66345bf Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 4 Mar 2017 21:08:07 +0100 Subject: Make logical target name `openal` uniform accross all platforms --- CMakeLists.txt | 83 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 41 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index a8aa079b..b71fb44c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,10 +62,7 @@ if(DEFINED LIB_SUFFIX) endif() -IF(NOT WIN32) - SET(LIBNAME openal) -ELSE() - SET(LIBNAME OpenAL32) +IF(WIN32) ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502") # This option is mainly for static linking OpenAL Soft into another project @@ -1249,55 +1246,59 @@ ENDIF() # Build main library IF(LIBTYPE STREQUAL "STATIC") - ADD_LIBRARY(${LIBNAME} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + ADD_LIBRARY(openal STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ELSE() - ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) + ADD_LIBRARY(openal SHARED ${OPENAL_OBJS} ${ALC_OBJS}) ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) +SET_PROPERTY(TARGET openal APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) +SET_PROPERTY(TARGET openal APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) IF(WIN32 AND ALSOFT_NO_UID_DEFS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) + SET_PROPERTY(TARGET openal APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") +SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") IF(HAVE_ALSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) ENDIF() IF(HAVE_OSS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) ENDIF() IF(HAVE_SOLARIS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_SNDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_QSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) ENDIF() IF(HAVE_DSOUND) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) ENDIF() IF(HAVE_PORTAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_PULSEAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_JACK) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) + SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) ENDIF() IF(WIN32) IF(MSVC) - SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS") + SET_PROPERTY(TARGET openal APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS") ELSEIF(CMAKE_COMPILER_IS_GNUCC) - SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " -mwindows") + SET_PROPERTY(TARGET openal APPEND_STRING PROPERTY LINK_FLAGS " -mwindows") ENDIF() ENDIF() -SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} - SOVERSION ${LIB_MAJOR_VERSION}) -IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") +SET_TARGET_PROPERTIES(openal PROPERTIES VERSION ${LIB_VERSION} + SOVERSION ${LIB_MAJOR_VERSION}) +IF(WIN32) + SET_TARGET_PROPERTIES(openal PROPERTIES OUTPUT_NAME "OpenAL32") +ENDIF() + +if(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") + SET_TARGET_PROPERTIES(openal PROPERTIES PREFIX "") IF(MINGW AND ALSOFT_BUILD_IMPORT_LIB) FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") @@ -1311,25 +1312,25 @@ IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") ENDIF() ELSE() - SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--output-def,${LIBNAME}.def") - ADD_CUSTOM_COMMAND(TARGET ${LIBNAME} POST_BUILD - COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" ${LIBNAME}.def - COMMAND "${DLLTOOL_EXECUTABLE}" -d ${LIBNAME}.def -l ${LIBNAME}.lib -D ${LIBNAME}.dll - COMMENT "Stripping ordinals from ${LIBNAME}.def and generating ${LIBNAME}.lib..." + SET_PROPERTY(TARGET openal APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--output-def,OpenAL32.def") + 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..." VERBATIM ) ENDIF() ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS}) +TARGET_LINK_LIBRARIES(openal common ${EXTRA_LIBS}) IF(TARGET build_version) - ADD_DEPENDENCIES(${LIBNAME} build_version) + ADD_DEPENDENCIES(openal build_version) ENDIF() IF(ALSOFT_INSTALL) # Add an install target here - INSTALL(TARGETS ${LIBNAME} + INSTALL(TARGETS openal RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -1404,7 +1405,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 ${LIBNAME}) + TARGET_LINK_LIBRARIES(openal-info openal) ADD_EXECUTABLE(makehrtf utils/makehrtf.c) SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) @@ -1438,7 +1439,7 @@ IF(ALSOFT_TESTS) SET_PROPERTY(TARGET test-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) ADD_EXECUTABLE(altonegen examples/altonegen.c) - TARGET_LINK_LIBRARIES(altonegen test-common ${LIBNAME}) + TARGET_LINK_LIBRARIES(altonegen test-common openal) SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) IF(ALSOFT_INSTALL) @@ -1465,7 +1466,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alstream examples/alstream.c) TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) + common 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} @@ -1473,7 +1474,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alreverb examples/alreverb.c) TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) + common 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} @@ -1481,7 +1482,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(allatency examples/allatency.c) TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) + common 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} @@ -1489,7 +1490,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alloopback examples/alloopback.c) TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) + common 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} @@ -1497,7 +1498,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alhrtf examples/alhrtf.c) TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) + common 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} @@ -1540,7 +1541,7 @@ IF(ALSOFT_EXAMPLES) ENDIF() IF(FFVER_OK AND NOT MSVC) ADD_EXECUTABLE(alffplay examples/alffplay.c) - TARGET_LINK_LIBRARIES(alffplay common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES}) + TARGET_LINK_LIBRARIES(alffplay common ${SDL2_LIBRARY} openal ${FFMPEG_LIBRARIES}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} -- cgit v1.2.3 From 9d0bf065eea4ebda8cfd3af1b5deb80f6b4ec906 Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 4 Mar 2017 22:01:58 +0100 Subject: Compile `common` library within dependent targets --- CMakeLists.txt | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b71fb44c..1686587f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1237,18 +1237,11 @@ CONFIGURE_FILE( "${OpenAL_BINARY_DIR}/openal.pc" @ONLY) -# Build a common library with reusable helpers -ADD_LIBRARY(common STATIC ${COMMON_OBJS}) -SET_PROPERTY(TARGET common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -IF(NOT LIBTYPE STREQUAL "STATIC") - SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE) -ENDIF() - # Build main library IF(LIBTYPE STREQUAL "STATIC") ADD_LIBRARY(openal STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ELSE() - ADD_LIBRARY(openal SHARED ${OPENAL_OBJS} ${ALC_OBJS}) + ADD_LIBRARY(openal SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ENDIF() SET_PROPERTY(TARGET openal APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET openal APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) @@ -1323,7 +1316,7 @@ if(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(openal common ${EXTRA_LIBS}) +TARGET_LINK_LIBRARIES(openal ${EXTRA_LIBS}) IF(TARGET build_version) ADD_DEPENDENCIES(openal build_version) ENDIF() @@ -1438,7 +1431,7 @@ IF(ALSOFT_TESTS) ADD_LIBRARY(test-common STATIC examples/common/alhelpers.c) SET_PROPERTY(TARGET test-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - ADD_EXECUTABLE(altonegen examples/altonegen.c) + ADD_EXECUTABLE(altonegen examples/altonegen.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(altonegen test-common openal) SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) @@ -1464,41 +1457,41 @@ IF(ALSOFT_EXAMPLES) INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR} ) - ADD_EXECUTABLE(alstream examples/alstream.c) + ADD_EXECUTABLE(alstream examples/alstream.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common openal) + 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) + ADD_EXECUTABLE(alreverb examples/alreverb.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common openal) + 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) + ADD_EXECUTABLE(allatency examples/allatency.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common openal) + 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) + ADD_EXECUTABLE(alloopback examples/alloopback.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common openal) + 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) + ADD_EXECUTABLE(alhrtf examples/alhrtf.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common openal) + 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} @@ -1540,8 +1533,8 @@ IF(ALSOFT_EXAMPLES) ENDIF() ENDIF() IF(FFVER_OK AND NOT MSVC) - ADD_EXECUTABLE(alffplay examples/alffplay.c) - TARGET_LINK_LIBRARIES(alffplay common ${SDL2_LIBRARY} openal ${FFMPEG_LIBRARIES}) + ADD_EXECUTABLE(alffplay examples/alffplay.c ${COMMON_OBJS}) + TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} openal ${FFMPEG_LIBRARIES}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} -- cgit v1.2.3 From 27be429ca4b89fc23034c83a11ebcf963c36ba26 Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 4 Mar 2017 23:03:53 +0100 Subject: Rename logical CMake target `openal` to `OpenAL` --- CMakeLists.txt | 72 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1686587f..345ede2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,7 +328,7 @@ ELSE() # Force enable -fPIC for CMake versions before 2.8.9 (later versions have # the POSITION_INDEPENDENT_CODE target property). The static common library - # will be linked into the dynamic openal library, which requires all its + # will be linked into the dynamic OpenAL library, which requires all its # code to be position-independent. IF(CMAKE_VERSION VERSION_LESS "2.8.9" AND NOT WIN32) CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH) @@ -1239,59 +1239,61 @@ CONFIGURE_FILE( # Build main library IF(LIBTYPE STREQUAL "STATIC") - ADD_LIBRARY(openal STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ELSE() - ADD_LIBRARY(openal SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + ADD_LIBRARY(OpenAL SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ENDIF() -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 PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) +SET_PROPERTY(TARGET OpenAL 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 OpenAL APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) ENDIF() -SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") +SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") IF(HAVE_ALSA) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) ENDIF() IF(HAVE_OSS) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) ENDIF() IF(HAVE_SOLARIS) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_SNDIO) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_QSA) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) ENDIF() IF(HAVE_DSOUND) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) ENDIF() IF(HAVE_PORTAUDIO) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_PULSEAUDIO) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) ENDIF() IF(HAVE_JACK) - SET_PROPERTY(TARGET openal APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) + SET_PROPERTY(TARGET OpenAL APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) ENDIF() IF(WIN32) IF(MSVC) - SET_PROPERTY(TARGET openal APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS") + 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") + SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " -mwindows") ENDIF() ENDIF() -SET_TARGET_PROPERTIES(openal PROPERTIES VERSION ${LIB_VERSION} +SET_TARGET_PROPERTIES(OpenAL PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VERSION}) -IF(WIN32) - SET_TARGET_PROPERTIES(openal PROPERTIES OUTPUT_NAME "OpenAL32") +IF(NOT WIN32) + SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME "openal") +ELSE() + SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME "OpenAL32") ENDIF() if(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") - SET_TARGET_PROPERTIES(openal PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "") IF(MINGW AND ALSOFT_BUILD_IMPORT_LIB) FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") @@ -1305,8 +1307,8 @@ if(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") ENDIF() ELSE() - SET_PROPERTY(TARGET openal APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--output-def,OpenAL32.def") - ADD_CUSTOM_COMMAND(TARGET openal POST_BUILD + SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--output-def,OpenAL32.def") + 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..." @@ -1316,14 +1318,14 @@ if(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(openal ${EXTRA_LIBS}) +TARGET_LINK_LIBRARIES(OpenAL ${EXTRA_LIBS}) IF(TARGET build_version) - ADD_DEPENDENCIES(openal build_version) + ADD_DEPENDENCIES(OpenAL build_version) ENDIF() IF(ALSOFT_INSTALL) # Add an install target here - INSTALL(TARGETS openal + INSTALL(TARGETS OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -1398,7 +1400,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 OpenAL) ADD_EXECUTABLE(makehrtf utils/makehrtf.c) SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) @@ -1432,7 +1434,7 @@ IF(ALSOFT_TESTS) SET_PROPERTY(TARGET test-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) ADD_EXECUTABLE(altonegen examples/altonegen.c ${COMMON_OBJS}) - TARGET_LINK_LIBRARIES(altonegen test-common openal) + TARGET_LINK_LIBRARIES(altonegen test-common OpenAL) SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) IF(ALSOFT_INSTALL) @@ -1459,7 +1461,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alstream examples/alstream.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - openal) + 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} @@ -1467,7 +1469,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alreverb examples/alreverb.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - openal) + 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} @@ -1475,7 +1477,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(allatency examples/allatency.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - openal) + 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} @@ -1483,7 +1485,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alloopback examples/alloopback.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - openal) + 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} @@ -1491,7 +1493,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alhrtf examples/alhrtf.c ${COMMON_OBJS}) TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - openal) + 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} @@ -1534,7 +1536,7 @@ IF(ALSOFT_EXAMPLES) ENDIF() IF(FFVER_OK AND NOT MSVC) ADD_EXECUTABLE(alffplay examples/alffplay.c ${COMMON_OBJS}) - TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} openal ${FFMPEG_LIBRARIES}) + TARGET_LINK_LIBRARIES(alffplay ${SDL2_LIBRARY} OpenAL ${FFMPEG_LIBRARIES}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} -- cgit v1.2.3 From df87cf8002ace806879ef3646543d7f4037ba52e Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 4 Mar 2017 22:15:12 +0100 Subject: Export cmake import targets for project install tree --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 345ede2e..e0f349b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1325,11 +1325,16 @@ ENDIF() IF(ALSOFT_INSTALL) # Add an install target here - INSTALL(TARGETS OpenAL + INSTALL(TARGETS OpenAL EXPORT OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + INSTALL(EXPORT OpenAL + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) INSTALL(FILES include/AL/al.h include/AL/alc.h include/AL/alext.h -- cgit v1.2.3 From ad640245d85502f673480a21d06f6259f507f279 Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 4 Mar 2017 23:22:45 +0100 Subject: Export cmake import targets for project build tree --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e0f349b4..70709444 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1331,6 +1331,9 @@ IF(ALSOFT_INSTALL) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + EXPORT(TARGETS OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) INSTALL(EXPORT OpenAL DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL NAMESPACE OpenAL:: -- cgit v1.2.3