build: make vcpkg optional

This commit is contained in:
Andrea Pappacoda 2022-08-28 23:04:03 +02:00
parent 0f24b0663e
commit a5a9077164
No known key found for this signature in database
GPG key ID: 4A9208A2455077A7

View file

@ -1,19 +1,25 @@
cmake_minimum_required(VERSION 3.21.1) cmake_minimum_required(VERSION 3.21.1)
option(PUBLIC_RELEASE "Compile with debug asserts disabled and no console" OFF) option(PUBLIC_RELEASE "Compile with debug asserts disabled and no console" OFF)
option(ENABLE_VCPKG "Enable the vcpkg package manager" ON)
if (PUBLIC_RELEASE) if (PUBLIC_RELEASE)
add_definitions(-DPUBLIC_RELEASE) add_definitions(-DPUBLIC_RELEASE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO
endif() endif()
if (WIN32) if (ENABLE_VCPKG)
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
# Set this so that all the various find_package() calls don't need an explicit
# CONFIG option
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
if (WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "") set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
endif()
endif() endif()
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
project(Cemu VERSION 0.1) project(Cemu VERSION 0.1)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
@ -58,16 +64,16 @@ option(ENABLE_CUBEB "Enabled cubeb backend" ON)
option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON) option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
find_package(SDL2 CONFIG REQUIRED) find_package(SDL2 REQUIRED)
find_package(CURL CONFIG REQUIRED) find_package(CURL REQUIRED)
find_package(pugixml CONFIG REQUIRED) find_package(pugixml REQUIRED)
find_package(imgui CONFIG REQUIRED) find_package(imgui REQUIRED)
find_package(RapidJSON CONFIG REQUIRED) find_package(RapidJSON REQUIRED)
find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED) find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
find_package(libzip REQUIRED) find_package(libzip REQUIRED)
find_package(glslang REQUIRED) find_package(glslang REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(zstd CONFIG REQUIRED) find_package(zstd REQUIRED)
if (ENABLE_VULKAN) if (ENABLE_VULKAN)
include_directories("dependencies/Vulkan-Headers/include") include_directories("dependencies/Vulkan-Headers/include")
@ -84,7 +90,7 @@ if (ENABLE_DISCORD_RPC)
endif() endif()
if (ENABLE_WXWIDGETS) if (ENABLE_WXWIDGETS)
find_package(wxWidgets CONFIG REQUIRED) find_package(wxWidgets 3.2 REQUIRED COMPONENTS base core gl propgrid xrc)
endif() endif()
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)