Use more consistent formatting in CMakeLists.txt (#2)

This commit is contained in:
Maximilian Downey Twiss 2022-08-24 16:32:04 +10:00 committed by GitHub
parent ede1afd3ee
commit 5ae3c56de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,8 +7,8 @@ if (PUBLIC_RELEASE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO
endif() endif()
if(WIN32) if (WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "") set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
endif() endif()
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports") set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
@ -23,27 +23,26 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
IF(MSVC) if (MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GT") # fiber safe optimizations set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GT") # fiber safe optimizations
ENDIF() if (PUBLIC_RELEASE)
IF(MSVC AND PUBLIC_RELEASE)
message(STATUS "Using additional optimization flags for MSVC") message(STATUS "Using additional optimization flags for MSVC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi /Ot") # enable intrinsic functions, favor speed set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi /Ot") # enable intrinsic functions, favor speed
ENDIF() endif()
endif()
option(ENABLE_OPENGL "Enables the OpenGL backend" ON) option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
option(ENABLE_VULKAN "Enables the Vulkan backend" ON) option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON) option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
if(WIN32) if (WIN32)
option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON) option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
endif() endif()
# input backends # input backends
if(WIN32) if (WIN32)
option(ENABLE_XINPUT "Enables the usage of XInput" ON) option(ENABLE_XINPUT "Enables the usage of XInput" ON)
option(ENABLE_DIRECTINPUT "Enables the usage of DirectInput" ON) option(ENABLE_DIRECTINPUT "Enables the usage of DirectInput" ON)
add_definitions(-DHAS_DIRECTINPUT) add_definitions(-DHAS_DIRECTINPUT)
@ -51,9 +50,9 @@ endif()
option(ENABLE_SDL "Enables the SDLController backend" ON) option(ENABLE_SDL "Enables the SDLController backend" ON)
# audio backends # audio backends
if(WIN32) if (WIN32)
option(ENABLE_DIRECTAUDIO "Enables the directaudio backend" ON) option(ENABLE_DIRECTAUDIO "Enables the directaudio backend" ON)
option(ENABLE_XAUDIO "Enables the xaudio backend" ON) option(ENABLE_XAUDIO "Enables the xaudio backend" ON)
endif() endif()
option(ENABLE_CUBEB "Enabled cubeb backend" ON) option(ENABLE_CUBEB "Enabled cubeb backend" ON)
@ -70,20 +69,22 @@ find_package(glslang REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(zstd CONFIG REQUIRED) find_package(zstd CONFIG REQUIRED)
if(ENABLE_VULKAN) if (ENABLE_VULKAN)
find_package(Vulkan REQUIRED) find_package(Vulkan REQUIRED)
include_directories("${Vulkan_INCLUDE_DIRS}") include_directories("${Vulkan_INCLUDE_DIRS}")
endif() endif()
if(ENABLE_OPENGL)
if (ENABLE_OPENGL)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
endif() endif()
if(ENABLE_DISCORD_RPC)
if (ENABLE_DISCORD_RPC)
add_definitions(-DENABLE_DISCORD_RPC) add_definitions(-DENABLE_DISCORD_RPC)
add_subdirectory(dependencies/discord-rpc EXCLUDE_FROM_ALL) add_subdirectory(dependencies/discord-rpc EXCLUDE_FROM_ALL)
target_include_directories(discord-rpc INTERFACE ./dependencies/discord-rpc/include) target_include_directories(discord-rpc INTERFACE ./dependencies/discord-rpc/include)
endif() endif()
if(ENABLE_WXWIDGETS) if (ENABLE_WXWIDGETS)
find_package(wxWidgets CONFIG REQUIRED) find_package(wxWidgets CONFIG REQUIRED)
endif() endif()
@ -94,11 +95,11 @@ find_package(X11)
link_libraries(${Boost_LIBRARIES}) link_libraries(${Boost_LIBRARIES})
link_libraries(${X11_LIBRARIES}) link_libraries(${X11_LIBRARIES})
link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static) link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
if(ENABLE_WXWIDGETS) if (ENABLE_WXWIDGETS)
link_libraries(wx::core wx::base) link_libraries(wx::core wx::base)
endif() endif()
if(ENABLE_CUBEB) if (ENABLE_CUBEB)
option(BUILD_TESTS "" OFF) option(BUILD_TESTS "" OFF)
option(BUILD_TOOLS "" OFF) option(BUILD_TOOLS "" OFF)
option(BUNDLE_SPEEX "" OFF) option(BUNDLE_SPEEX "" OFF)