summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnonymous Maarten <anonymous.maarten@gmail.com>2020-12-06 15:42:15 +0100
committershfil <filip.gawin@zoho.com>2021-01-11 11:24:25 +0100
commit2f48d0c828e9a279e578e10ed3e3294b58a00331 (patch)
tree281175803f1214c001a81a3d44bc5b08b14542b1
parentcmake: make librw non-vendorable + rename Findmpg123 + create targets for dependencies (diff)
downloadre3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar.gz
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar.bz2
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar.lz
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar.xz
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.tar.zst
re3-2f48d0c828e9a279e578e10ed3e3294b58a00331.zip
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/CMakeLists.txt53
2 files changed, 34 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20a38595..76f4da89 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,13 +4,15 @@ project(re3 C CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(WIN32)
- set(RE3_AUDIOS "NULL" "OAL" "MSS")
+ set(RE3_AUDIOS "OAL" "MSS")
else()
- set(RE3_AUDIOS "NULL" "OAL")
+ set(RE3_AUDIOS "OAL")
endif()
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
+option(RE3_WITH_OPUS "Build re3 with opus support" ON)
+
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
set("RE3_AUDIO_${RE3_AUDIO}" ON)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0b124958..3e666121 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,12 +1,6 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-if(${RE3_AUDIO} STREQUAL "OAL")
- find_package(OpenAL REQUIRED)
- find_package(mpg123 REQUIRED)
- find_package(SndFile REQUIRED)
-endif()
-
file(GLOB_RECURSE RE3_SOURCES "*.cpp" "*.h")
function(header_directories RETURN_LIST)
@@ -22,32 +16,45 @@ function(header_directories RETURN_LIST)
endfunction()
header_directories(RE3_INCLUDES)
-include_directories(${RE3_INCLUDES})
-add_executable(re3 ${RE3_SOURCES})
+add_executable(re3 WIN32 ${RE3_SOURCES})
target_link_libraries(re3 PRIVATE
librw::librw
Threads::Threads
)
-if(RE3_AUDIO STREQUAL "OAL")
- target_link_libraries(re3 PRIVATE ${OPENAL_LIBRARY})
- target_link_libraries(re3 PRIVATE MPG123::libmpg123)
- target_link_libraries(re3 PRIVATE SndFile::SndFile)
-endif()
-
target_include_directories(re3
- INTERFACE
+ PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
- $<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
- )
+ $<BUILD_INTERFACE:${RE3_INCLUDES}>
+)
target_compile_definitions(re3
PRIVATE
- "$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
+ $<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
+ LIBRW
+)
+
+if(RE3_AUDIO STREQUAL "OAL")
+ find_package(OpenAL REQUIRED)
+ target_include_directories(re3 PRIVATE ${OPENAL_INCLUDE_DIR})
+ target_link_libraries(re3 PRIVATE ${OPENAL_LIBRARY})
+ target_compile_definitions(re3 PRIVATE AUDIO_OAL)
+elseif(RE3_AUDIO STREQUAL "MSS")
+ target_compile_definitions(re3 PRIVATE AUDIO_MSS)
+endif()
+
+if(RE3_WITH_OPUS)
+ find_package(mpg123 REQUIRED)
+ find_package(SndFile REQUIRED)
+ target_link_libraries(re3 PRIVATE
+ MPG123::libmpg123
+ SndFile::SndFile
)
+ target_compile_definitions(re3 PRIVATE AUDIO_OPUS)
+endif()
-target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
+target_compile_definitions(re3 PRIVATE )
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(re3
@@ -57,15 +64,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang
if (NOT LIBRW_PLATFORM_PS2)
target_compile_options(re3
PRIVATE
- "-Wextra"
- "-Wdouble-promotion"
- "-Wpedantic"
+ -Wextra
+ -Wdouble-promotion
+ -Wpedantic
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(re3
PUBLIC
- /wd4996 /wd4244
+ /Zc:sizedDealloc-
)
endif()