aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-07-09 22:19:34 -0700
committerChris Robinson <[email protected]>2017-07-09 22:19:34 -0700
commitd050af7eeb2bfd37d096d4583685c6d2a64f1907 (patch)
treef987d281437d6574dc0780b5f3bbe1f1b9002401
parent2be4c93f9f3ba42aa6fc03d329a873df9cbed4b6 (diff)
Reorganize some Windows-only CMake commands
-rw-r--r--CMakeLists.txt134
1 files changed, 68 insertions, 66 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46ff4049..b0305ba5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,10 +37,6 @@ 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)
@@ -69,6 +65,8 @@ endif()
IF(WIN32)
ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
+ OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF)
+
# This option is mainly for static linking OpenAL Soft into another project
# that already defines the IDs. It is up to that project to ensure all
# required IDs are defined.
@@ -1209,12 +1207,13 @@ IF(LIBTYPE STREQUAL "STATIC")
ELSE()
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)
-IF(WIN32 AND ALSOFT_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_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME}
+ VERSION ${LIB_VERSION}
+ SOVERSION ${LIB_MAJOR_VERSION}
+)
+SET_PROPERTY(TARGET OpenAL 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)
@@ -1224,46 +1223,14 @@ 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)
-IF(WIN32)
- 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_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)
ENDIF()
+SET_PROPERTY(TARGET OpenAL APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
-SET_TARGET_PROPERTIES(OpenAL PROPERTIES VERSION ${LIB_VERSION}
- SOVERSION ${LIB_MAJOR_VERSION})
-SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS})
-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")
- FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
- IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
- MESSAGE(STATUS "")
- IF(NOT SED_EXECUTABLE)
- MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
- ENDIF()
- IF(NOT DLLTOOL_EXECUTABLE)
- 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
- 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(OpenAL ${EXTRA_LIBS})
IF(TARGET build_version)
ADD_DEPENDENCIES(OpenAL build_version)
@@ -1271,31 +1238,66 @@ 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 ${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(WIN32)
IF(MSVC)
- SET_PROPERTY(TARGET Router 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 Router APPEND_STRING PROPERTY LINK_FLAGS " -mwindows")
+ SET_PROPERTY(TARGET OpenAL 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)
+
+ if(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")
+ FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
+ IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
+ MESSAGE(STATUS "")
+ IF(NOT SED_EXECUTABLE)
+ MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
+ ENDIF()
+ IF(NOT DLLTOOL_EXECUTABLE)
+ 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
+ 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()
- 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}
- )
+ 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()
ENDIF()
ENDIF()