mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 09:09:15 +01:00
cmake: null audio is not possible + add cmake opus support
This commit is contained in:
parent
2ff9270279
commit
2f48d0c828
@ -4,13 +4,15 @@ project(re3 C CXX)
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(RE3_AUDIOS "NULL" "OAL" "MSS")
|
set(RE3_AUDIOS "OAL" "MSS")
|
||||||
else()
|
else()
|
||||||
set(RE3_AUDIOS "NULL" "OAL")
|
set(RE3_AUDIOS "OAL")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
|
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})
|
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
|
||||||
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
|
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
|
||||||
set("RE3_AUDIO_${RE3_AUDIO}" ON)
|
set("RE3_AUDIO_${RE3_AUDIO}" ON)
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
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")
|
file(GLOB_RECURSE RE3_SOURCES "*.cpp" "*.h")
|
||||||
|
|
||||||
function(header_directories RETURN_LIST)
|
function(header_directories RETURN_LIST)
|
||||||
@ -22,32 +16,45 @@ function(header_directories RETURN_LIST)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
header_directories(RE3_INCLUDES)
|
header_directories(RE3_INCLUDES)
|
||||||
include_directories(${RE3_INCLUDES})
|
|
||||||
|
|
||||||
add_executable(re3 ${RE3_SOURCES})
|
add_executable(re3 WIN32 ${RE3_SOURCES})
|
||||||
target_link_libraries(re3 PRIVATE
|
target_link_libraries(re3 PRIVATE
|
||||||
librw::librw
|
librw::librw
|
||||||
Threads::Threads
|
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
|
target_include_directories(re3
|
||||||
INTERFACE
|
PRIVATE
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
|
$<BUILD_INTERFACE:${RE3_INCLUDES}>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(re3
|
target_compile_definitions(re3
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
|
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
||||||
)
|
LIBRW
|
||||||
|
)
|
||||||
|
|
||||||
target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
|
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 )
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
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
|
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)
|
if (NOT LIBRW_PLATFORM_PS2)
|
||||||
target_compile_options(re3
|
target_compile_options(re3
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"-Wextra"
|
-Wextra
|
||||||
"-Wdouble-promotion"
|
-Wdouble-promotion
|
||||||
"-Wpedantic"
|
-Wpedantic
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
target_compile_options(re3
|
target_compile_options(re3
|
||||||
PUBLIC
|
PUBLIC
|
||||||
/wd4996 /wd4244
|
/Zc:sizedDealloc-
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user