-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
97 lines (83 loc) · 3.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.27)
project(MetaAudio)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(OPENAL_LIBRARY ${PROJECT_SOURCE_DIR}/externals/OpenAL-SDK/libs/Win32/OpenAL32.lib)
set(OPENAL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/externals/OpenAL-SDK/include)
set(SNDFILE_LIBRARY ${PROJECT_SOURCE_DIR}/externals/libsndfile/lib/sndfile.lib)
set(SNDFILE_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/externals/libsndfile/include)
# Configure Alure2 the way we need it
option(METAAUDIO_STATIC_ALURE "Link Alure2 statically" ON)
if(METAAUDIO_STATIC_ALURE)
set(ALURE2_LIBRARY alure2_s)
option(ALURE_BUILD_SHARED "Shared Alure disabled" OFF)
else()
set(ALURE2_LIBRARY alure2)
option(ALURE_BUILD_STATIC "Static Alure disabled" OFF)
endif()
option(ALURE_ENABLE_MINIMP3 "" OFF)
option(ALURE_ENABLE_WAVE "" OFF)
option(ALURE_ENABLE_OPUS "" OFF)
option(ALURE_ENABLE_VORBIS "" OFF)
option(ALURE_ENABLE_FLAC "" OFF)
option(ALURE_INSTALL "" OFF)
option(ALURE_BUILD_EXAMPLES "" OFF)
# MetaAudio requires libSndFile
set(SOURCES
src/exportfuncs.cpp
src/metaaudio.cpp
src/Effects/EnvEffects.cpp
src/Loaders/SteamAudioMapMeshLoader.cpp
src/snd_hook.cpp
src/Voice/VoiceDecoder.cpp
src/Vox/VoxManager.cpp
src/Loaders/LocalAudioDecoder.cpp
src/Utilities/AudioCache.cpp
src/interface.cpp
src/Config/EfxJsonReader.cpp
src/Config/SettingsManager.cpp
src/Effects/GoldSrcOcclusionCalculator.cpp
src/Effects/SteamAudioOcclusionCalculator.cpp
src/Utilities/Fade.cpp
src/Workarounds/NoWorkarounds.cpp
src/Workarounds/XFiWorkarounds.cpp
src/Loaders/GoldSrcFileBuf.cpp
src/Loaders/GoldSrcFileStream.cpp
src/Loaders/GoldSrcFileFactory.cpp
src/Loaders/SoundLoader.cpp
src/AudioEngine.cpp
src/Utilities/ChannelManager.cpp
src/snd_local.cpp
src/SoundSources/SoundSourceFactory.cpp
src/SoundSources/BaseSoundSource.cpp
src/SoundSources/StaticSoundSource.cpp
src/SoundSources/StreamingSoundSource.cpp
)
add_library(MetaAudio SHARED ${SOURCES})
set_property(TARGET MetaAudio PROPERTY CXX_STANDARD 17)
target_compile_definitions(MetaAudio PRIVATE AUDIO_EXPORTS)
add_compile_definitions(NOMINMAX PICOJSON_USE_INT64)
target_include_directories(MetaAudio
PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/externals/picojson
${PROJECT_SOURCE_DIR}/externals/steamaudio/include
${PROJECT_SOURCE_DIR}/externals/alure/include/AL
${PROJECT_SOURCE_DIR}/externals/MetaHookSv
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/Interface
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/HLSDK/common
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/HLSDK/cl_dll
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/HLSDK/engine
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/HLSDK/public
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/HLSDK/pm_shared
${PROJECT_SOURCE_DIR}/externals/MetaHookSv/capstone/include/capstone
)
find_package(OpenAL REQUIRED)
add_subdirectory(externals/alure)
if ((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914))
# Force C++17 as mpark/variant doesn't compile with MSVC
set_property(TARGET ${ALURE2_LIBRARY} PROPERTY CXX_STANDARD 17)
target_compile_options(${ALURE2_LIBRARY} PUBLIC "/Zc:__cplusplus")
target_compile_options(MetaAudio PUBLIC "/Zc:__cplusplus")
endif()
add_dependencies(MetaAudio ${ALURE2_LIBRARY})
target_link_libraries(MetaAudio PRIVATE ${OPENAL_LIBRARY} ${ALURE2_LIBRARY})