Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to compile against shared OpenAL lib #390

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ ENDIF()
OPTION(CONFIG_BUILD_GLSLANG "Build glslangValidator from source instead of using the SDK" ${DEFAULT_BUILD_GLSLANG})
OPTION(CONFIG_BUILD_IPO "Enable interprocedural optimizations" OFF)
OPTION(CONFIG_BUILD_SHADER_DEBUG_INFO "Build shaders with debug info" OFF)
OPTION(USE_SYSTEM_OPENAL "Prefer system OpenAL Soft instead of the bundled one" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(CheckIPOSupported)
Expand Down
36 changes: 20 additions & 16 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,23 @@ target_include_directories(tinyobjloader INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/t
#

if (IS_64_BIT)
set(LIBTYPE STATIC)
option(FORCE_STATIC_VCRT "" ON)
option(ALSOFT_UTILS "" OFF)
option(ALSOFT_EXAMPLES "" OFF)
option(ALSOFT_UPDATE_BUILD_VERSION "" OFF)
option(ALSOFT_INSTALL "" OFF)
option(ALSOFT_INSTALL_CONFIG "" OFF)
option(ALSOFT_INSTALL_HRTF_DATA "" OFF)
option(ALSOFT_INSTALL_AMBDEC_PRESETS "" OFF)
option(ALSOFT_INSTALL_EXAMPLES "" OFF)
option(ALSOFT_INSTALL_UTILS "" OFF)
add_subdirectory(openal-soft)
set_target_properties(OpenAL PROPERTIES FOLDER extern/openal-soft)
set_target_properties(common PROPERTIES FOLDER extern/openal-soft)
set_target_properties(ex-common PROPERTIES FOLDER extern/openal-soft)
endif()
if (USE_SYSTEM_OPENAL)
find_package(OpenAL REQUIRED)
else()
set(LIBTYPE STATIC)
option(FORCE_STATIC_VCRT "" ON)
option(ALSOFT_UTILS "" OFF)
option(ALSOFT_EXAMPLES "" OFF)
option(ALSOFT_UPDATE_BUILD_VERSION "" OFF)
option(ALSOFT_INSTALL "" OFF)
option(ALSOFT_INSTALL_CONFIG "" OFF)
option(ALSOFT_INSTALL_HRTF_DATA "" OFF)
option(ALSOFT_INSTALL_AMBDEC_PRESETS "" OFF)
option(ALSOFT_INSTALL_EXAMPLES "" OFF)
option(ALSOFT_INSTALL_UTILS "" OFF)
add_subdirectory(openal-soft)
set_target_properties(OpenAL PROPERTIES FOLDER extern/openal-soft)
set_target_properties(common PROPERTIES FOLDER extern/openal-soft)
set_target_properties(ex-common PROPERTIES FOLDER extern/openal-soft)
endif()
endif()
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ ADD_DEFINITIONS(-DVERSION_POINT=${Q2RTX_VERSION_POINT})
ADD_DEFINITIONS(-DVERSION_SHA=${Q2RTX_VERSION_SHA})
ADD_DEFINITIONS(-DVERSION_BRANCH=${Q2RTX_VERSION_BRANCH})

ADD_DEFINITIONS(-DHAVE_CONFIG_H=1 -DCURL_STATICLIB -DAL_LIBTYPE_STATIC)
ADD_DEFINITIONS(-DHAVE_CONFIG_H=1 -DCURL_STATICLIB)

IF (NOT USE_SYSTEM_OPENAL)
ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
ENDIF()

IF(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
Expand Down Expand Up @@ -505,7 +509,7 @@ IF (TARGET client)

TARGET_LINK_LIBRARIES(client stb)
TARGET_LINK_LIBRARIES(client tinyobjloader)
TARGET_LINK_LIBRARIES(client OpenAL)
TARGET_LINK_LIBRARIES(client OpenAL)
ENDIF()

SOURCE_GROUP("game\\sources" FILES ${SRC_GAME})
Expand Down
Loading