cmake: fix OpenAL on Switch + using X11 on Linux

This commit is contained in:
Anonymous Maarten 2021-07-05 16:02:10 +02:00 committed by Adrian Graber
parent ca5d3c8811
commit a247d53367
2 changed files with 13 additions and 5 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.14)
set(EXECUTABLE re3) set(EXECUTABLE re3)
set(PROJECT RE3) set(PROJECT RE3)

View file

@ -54,9 +54,13 @@ target_compile_definitions(${EXECUTABLE} PRIVATE USE_OUR_VERSIONING)
if(${PROJECT}_AUDIO STREQUAL "OAL") if(${PROJECT}_AUDIO STREQUAL "OAL")
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
if(TARGET OpenAL::OpenAL)
target_link_libraries(${EXECUTABLE} PRIVATE OpenAL::OpenAL)
else()
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR}) target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY}) target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS}) target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
endif()
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL) target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
elseif(${PROJECT}_AUDIO STREQUAL "MSS") elseif(${PROJECT}_AUDIO STREQUAL "MSS")
find_package(MilesSDK REQUIRED) find_package(MilesSDK REQUIRED)
@ -126,6 +130,11 @@ else()
set(${PROJECT}_C_CXX_EXTENSIONS OFF) set(${PROJECT}_C_CXX_EXTENSIONS OFF)
endif() endif()
if(NOT (WINDOWS OR APPLE OR NINTENDO_SWITCH))
find_package(X11 REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE X11::X11)
endif()
set_target_properties(${EXECUTABLE} set_target_properties(${EXECUTABLE}
PROPERTIES PROPERTIES
C_STANDARD 11 C_STANDARD 11
@ -151,7 +160,6 @@ endif()
if(NINTENDO_SWITCH) if(NINTENDO_SWITCH)
# Needed for OpenAL-Soft # Needed for OpenAL-Soft
target_link_libraries(${EXECUTABLE} PRIVATE target_link_libraries(${EXECUTABLE} PRIVATE
openal # HACK - something broke with latest cmake
SDL2 SDL2
) )