mirror of https://github.com/stenzek/duckstation
CMake: Tidy up build system
And fix Windows CMake... who knows how long for.pull/3187/head
parent
a88ee93b4d
commit
8867bb129a
@ -0,0 +1,15 @@
|
||||
# Renderer options.
|
||||
option(ENABLE_OPENGL "Build with OpenGL renderer" ON)
|
||||
option(ENABLE_VULKAN "Build with Vulkan renderer" ON)
|
||||
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF)
|
||||
option(BUILD_QT_FRONTEND "Build the Qt frontend" ON)
|
||||
option(BUILD_REGTEST "Build regression test runner" OFF)
|
||||
option(BUILD_TESTS "Build unit tests" OFF)
|
||||
|
||||
if(LINUX OR BSD)
|
||||
option(ENABLE_X11 "Support X11 window system" ON)
|
||||
option(ENABLE_WAYLAND "Support Wayland window system" ON)
|
||||
endif()
|
||||
if(APPLE)
|
||||
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
|
||||
endif()
|
||||
@ -0,0 +1,45 @@
|
||||
if(ENABLE_OPENGL)
|
||||
message(STATUS "Building with OpenGL support.")
|
||||
endif()
|
||||
if(ENABLE_VULKAN)
|
||||
message(STATUS "Building with Vulkan support.")
|
||||
endif()
|
||||
if(ENABLE_X11)
|
||||
message(STATUS "Building with X11 support.")
|
||||
endif()
|
||||
if(ENABLE_WAYLAND)
|
||||
message(STATUS "Building with Wayland support.")
|
||||
endif()
|
||||
|
||||
if(BUILD_QT_FRONTEND)
|
||||
message(STATUS "Building Qt frontend.")
|
||||
endif()
|
||||
if(BUILD_NOGUI_FRONTEND)
|
||||
message(STATUS "Building NoGUI frontend.")
|
||||
endif()
|
||||
if(BUILD_REGTEST)
|
||||
message(STATUS "Building RegTest frontend.")
|
||||
endif()
|
||||
if(BUILD_TESTS)
|
||||
message(STATUS "Building unit tests.")
|
||||
endif()
|
||||
|
||||
if(NOT IS_SUPPORTED_COMPILER)
|
||||
message(WARNING "
|
||||
*************** UNSUPPORTED CONFIGURATION ***************
|
||||
You are not compiling DuckStation with a supported compiler.
|
||||
It may not even build successfully.
|
||||
DuckStation only supports the Clang and MSVC compilers.
|
||||
No support will be provided, continue at your own risk.
|
||||
*********************************************************")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
message(WARNING "
|
||||
*************** UNSUPPORTED CONFIGURATION ***************
|
||||
You are compiling DuckStation with CMake on Windows.
|
||||
It may not even build successfully.
|
||||
DuckStation only supports MSBuild on Windows.
|
||||
No support will be provided, continue at your own risk.
|
||||
*********************************************************")
|
||||
endif()
|
||||
@ -1,39 +1,53 @@
|
||||
if(ENABLE_SDL2)
|
||||
find_package(SDL2 2.30.2 REQUIRED)
|
||||
endif()
|
||||
if(NOT WIN32 AND NOT ANDROID)
|
||||
# From PCSX2: On macOS, Mono.framework contains an ancient version of libpng. We don't want that.
|
||||
# Avoid it by telling cmake to avoid finding frameworks while we search for libpng.
|
||||
if(APPLE)
|
||||
set(FIND_FRAMEWORK_BACKUP ${CMAKE_FIND_FRAMEWORK})
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
endif()
|
||||
# From PCSX2: On macOS, Mono.framework contains an ancient version of libpng. We don't want that.
|
||||
# Avoid it by telling cmake to avoid finding frameworks while we search for libpng.
|
||||
if(APPLE)
|
||||
set(FIND_FRAMEWORK_BACKUP ${CMAKE_FIND_FRAMEWORK})
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
endif()
|
||||
|
||||
# Enable threads everywhere.
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(Zstd 1.5.5 REQUIRED)
|
||||
find_package(WebP REQUIRED) # v1.3.2, spews an error on Linux because no pkg-config.
|
||||
find_package(ZLIB REQUIRED) # 1.3, but Mac currently doesn't use it.
|
||||
find_package(PNG 1.6.40 REQUIRED)
|
||||
find_package(JPEG REQUIRED) # No version because flatpak uses libjpeg-turbo.
|
||||
find_package(SDL2 2.30.2 REQUIRED)
|
||||
find_package(Zstd 1.5.5 REQUIRED)
|
||||
find_package(WebP REQUIRED) # v1.3.2, spews an error on Linux because no pkg-config.
|
||||
find_package(ZLIB REQUIRED) # 1.3, but Mac currently doesn't use it.
|
||||
find_package(PNG 1.6.40 REQUIRED)
|
||||
find_package(JPEG REQUIRED) # No version because flatpak uses libjpeg-turbo.
|
||||
find_package(Freetype 2.13.1 REQUIRED)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(Freetype 2.13.1 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(ENABLE_VULKAN OR APPLE)
|
||||
find_package(Shaderc REQUIRED)
|
||||
if(ENABLE_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
if (NOT X11_Xrandr_FOUND)
|
||||
message(FATAL_ERROR "XRandR extension is required")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# SPIRV-Cross is currently only used on MacOS.
|
||||
find_package(spirv_cross_c_shared REQUIRED)
|
||||
if(ENABLE_VULKAN OR APPLE)
|
||||
find_package(Shaderc REQUIRED)
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP})
|
||||
endif()
|
||||
if(APPLE)
|
||||
# SPIRV-Cross is currently only used on MacOS.
|
||||
find_package(spirv_cross_c_shared REQUIRED)
|
||||
endif()
|
||||
if(LINUX AND NOT ANDROID)
|
||||
|
||||
if(LINUX)
|
||||
find_package(UDEV REQUIRED)
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
find_package(Libbacktrace)
|
||||
if(NOT LIBBACKTRACE_FOUND)
|
||||
message(WARNING "libbacktrace not found, crashes will not produce backtraces.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP})
|
||||
endif()
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
add_library(WinPixEventRuntime::WinPixEventRuntime UNKNOWN IMPORTED GLOBAL)
|
||||
add_library(WinPixEventRuntime::WinPixEventRuntime SHARED IMPORTED GLOBAL)
|
||||
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
||||
set_target_properties(WinPixEventRuntime::WinPixEventRuntime PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libarm64/WinPixEventRuntime.lib"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/binarm64/WinPixEventRuntime.dll"
|
||||
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/libarm64/WinPixEventRuntime.lib"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
)
|
||||
else()
|
||||
set_target_properties(WinPixEventRuntime::WinPixEventRuntime PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib64/WinPixEventRuntime.lib"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/bin64/WinPixEventRuntime.dll"
|
||||
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib64/WinPixEventRuntime.lib"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
)
|
||||
endif()
|
||||
|
||||
Loading…
Reference in New Issue