Skip to content

Commit

Permalink
Merged pull request "Add option to compile against shared OpenAL lib":
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Apr 1, 2024
2 parents c7d0484 + b8fd774 commit 945023c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ OPTION(CONFIG_BUILD_GLSLANG "Build glslangValidator from source instead of using
OPTION(CONFIG_BUILD_IPO "Enable interprocedural optimizations" OFF)
OPTION(CONFIG_BUILD_SHADER_DEBUG_INFO "Build shaders with debug info" OFF)
OPTION(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the bundled one" OFF)
OPTION(USE_SYSTEM_OPENAL "Prefer system OpenAL Soft instead of the bundled one" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# use dynamic zlib for steam runtime
Expand Down
34 changes: 19 additions & 15 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)
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

0 comments on commit 945023c

Please sign in to comment.