aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-16 14:46:41 -0700
committerChris Robinson <[email protected]>2019-09-16 14:46:41 -0700
commit7a9463f8637de3196e630264deaedc77e414a1e8 (patch)
tree6ef9a3f8c73bee5c02a7ef8312a6b86d6c0fd635 /CMakeLists.txt
parent10a841cd7e2e3b5115fe86ce40ee9049318dfd8f (diff)
Make the common code a separate static library
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 11 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8501740..bcd03cca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1234,6 +1234,12 @@ CONFIGURE_FILE(
@ONLY)
+ADD_LIBRARY(common STATIC EXCLUDE_FROM_ALL ${COMMON_OBJS})
+TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
+TARGET_INCLUDE_DIRECTORIES(common PRIVATE ${OpenAL_BINARY_DIR})
+SET_TARGET_PROPERTIES(common PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
+
+
UNSET(HAS_ROUTER)
SET(IMPL_TARGET OpenAL) # Either OpenAL or soft_oal.
SET(SUBSYS_FLAG )
@@ -1244,9 +1250,9 @@ IF(LIBTYPE STREQUAL "STATIC")
IF(WIN32 AND ALSOFT_NO_UID_DEFS)
SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
ENDIF()
- ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
+ ADD_LIBRARY(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
+ TARGET_LINK_LIBRARIES(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
ELSE()
-
IF(WIN32)
IF(MSVC)
SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
@@ -1263,12 +1269,11 @@ ELSE()
router/router.h
router/alc.cpp
router/al.cpp
- ${COMMON_OBJS}
)
TARGET_COMPILE_DEFINITIONS(OpenAL
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
- TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS})
+ TARGET_LINK_LIBRARIES(OpenAL PRIVATE common ${LINKER_FLAGS})
TARGET_INCLUDE_DIRECTORIES(OpenAL
PUBLIC
$<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>
@@ -1289,15 +1294,13 @@ ELSE()
SET(RC_CONFIG resources/soft_oal.rc)
ENDIF()
- ADD_LIBRARY(${IMPL_TARGET} SHARED ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS} ${RC_CONFIG})
+ ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS} ${RC_CONFIG})
IF(WIN32)
SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
ENDIF()
+ TARGET_LINK_LIBRARIES(${IMPL_TARGET} PRIVATE common ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
ENDIF()
-TARGET_LINK_LIBRARIES(${IMPL_TARGET}
- PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
-
TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
PUBLIC
$<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>