forked from ShuriZma/suyu
1
0
Fork 0

cmake: apply defaults to all externals

This commit is contained in:
Alexandre Bouvier 2023-03-01 21:31:27 +01:00
parent 72a14a6817
commit 9c3c7ec009
4 changed files with 26 additions and 22 deletions

View File

@ -8,15 +8,21 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# Disable tests in all externals supporting the standard option name # Disable tests in all externals supporting the standard option name
set(BUILD_TESTING OFF) set(BUILD_TESTING OFF)
# Build only static externals
set(BUILD_SHARED_LIBS OFF)
# Skip install rules for all externals
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON)
# xbyak # xbyak
if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak) if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak)
add_subdirectory(xbyak EXCLUDE_FROM_ALL) add_subdirectory(xbyak)
endif() endif()
# Dynarmic # Dynarmic
if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmic) if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmic)
set(DYNARMIC_IGNORE_ASSERTS ON) set(DYNARMIC_IGNORE_ASSERTS ON)
add_subdirectory(dynarmic EXCLUDE_FROM_ALL) add_subdirectory(dynarmic)
add_library(dynarmic::dynarmic ALIAS dynarmic) add_library(dynarmic::dynarmic ALIAS dynarmic)
endif() endif()
@ -34,7 +40,7 @@ if (NOT TARGET inih::INIReader)
endif() endif()
# mbedtls # mbedtls
add_subdirectory(mbedtls EXCLUDE_FROM_ALL) add_subdirectory(mbedtls)
target_include_directories(mbedtls PUBLIC ./mbedtls/include) target_include_directories(mbedtls PUBLIC ./mbedtls/include)
# MicroProfile # MicroProfile
@ -48,7 +54,7 @@ endif()
# libusb # libusb
if (ENABLE_LIBUSB AND NOT TARGET libusb::usb) if (ENABLE_LIBUSB AND NOT TARGET libusb::usb)
add_subdirectory(libusb EXCLUDE_FROM_ALL) add_subdirectory(libusb)
endif() endif()
# SDL2 # SDL2
@ -67,18 +73,16 @@ if (YUZU_USE_EXTERNAL_SDL2)
set(HIDAPI ON) set(HIDAPI ON)
endif() endif()
set(SDL_STATIC ON)
set(SDL_SHARED OFF)
if (APPLE) if (APPLE)
set(SDL_FILE ON) set(SDL_FILE ON)
endif() endif()
add_subdirectory(SDL EXCLUDE_FROM_ALL) add_subdirectory(SDL)
endif() endif()
# ENet # ENet
if (NOT TARGET enet::enet) if (NOT TARGET enet::enet)
add_subdirectory(enet EXCLUDE_FROM_ALL) add_subdirectory(enet)
target_include_directories(enet INTERFACE ./enet/include) target_include_directories(enet INTERFACE ./enet/include)
add_library(enet::enet ALIAS enet) add_library(enet::enet ALIAS enet)
endif() endif()
@ -86,24 +90,26 @@ endif()
# Cubeb # Cubeb
if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb) if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb)
set(BUILD_TESTS OFF) set(BUILD_TESTS OFF)
add_subdirectory(cubeb EXCLUDE_FROM_ALL) set(BUILD_TOOLS OFF)
add_subdirectory(cubeb)
add_library(cubeb::cubeb ALIAS cubeb) add_library(cubeb::cubeb ALIAS cubeb)
endif() endif()
# DiscordRPC # DiscordRPC
if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc) if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc)
add_subdirectory(discord-rpc EXCLUDE_FROM_ALL) set(BUILD_EXAMPLES OFF)
add_subdirectory(discord-rpc)
target_include_directories(discord-rpc INTERFACE ./discord-rpc/include) target_include_directories(discord-rpc INTERFACE ./discord-rpc/include)
add_library(DiscordRPC::discord-rpc ALIAS discord-rpc) add_library(DiscordRPC::discord-rpc ALIAS discord-rpc)
endif() endif()
# Sirit # Sirit
add_subdirectory(sirit EXCLUDE_FROM_ALL) add_subdirectory(sirit)
# httplib # httplib
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib) if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
set(HTTPLIB_REQUIRE_OPENSSL ON) set(HTTPLIB_REQUIRE_OPENSSL ON)
add_subdirectory(cpp-httplib EXCLUDE_FROM_ALL) add_subdirectory(cpp-httplib)
endif() endif()
# cpp-jwt # cpp-jwt
@ -111,12 +117,12 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt)
set(CPP_JWT_BUILD_EXAMPLES OFF) set(CPP_JWT_BUILD_EXAMPLES OFF)
set(CPP_JWT_BUILD_TESTS OFF) set(CPP_JWT_BUILD_TESTS OFF)
set(CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF) set(CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF)
add_subdirectory(cpp-jwt EXCLUDE_FROM_ALL) add_subdirectory(cpp-jwt)
endif() endif()
# Opus # Opus
if (NOT TARGET Opus::opus) if (NOT TARGET Opus::opus)
add_subdirectory(opus EXCLUDE_FROM_ALL) add_subdirectory(opus)
endif() endif()
# FFMpeg # FFMpeg
@ -130,16 +136,14 @@ endif()
# Vulkan-Headers # Vulkan-Headers
if (YUZU_USE_EXTERNAL_VULKAN_HEADERS) if (YUZU_USE_EXTERNAL_VULKAN_HEADERS)
add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL) add_subdirectory(Vulkan-Headers)
endif() endif()
if (NOT TARGET LLVM::Demangle) if (NOT TARGET LLVM::Demangle)
add_library(demangle STATIC) add_library(demangle demangle/ItaniumDemangle.cpp)
target_include_directories(demangle PUBLIC ./demangle) target_include_directories(demangle PUBLIC ./demangle)
target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp)
add_library(LLVM::Demangle ALIAS demangle) add_library(LLVM::Demangle ALIAS demangle)
endif() endif()
add_library(stb STATIC) add_library(stb stb/stb_dxt.cpp)
target_include_directories(stb PUBLIC ./stb) target_include_directories(stb PUBLIC ./stb)
target_sources(stb PRIVATE stb/stb_dxt.cpp)

View File

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2015 Yuri Kunde Schlesner <yuriks@yuriks.net> # SPDX-FileCopyrightText: 2015 Yuri Kunde Schlesner <yuriks@yuriks.net>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
add_library(glad STATIC add_library(glad
src/glad.c src/glad.c
include/KHR/khrplatform.h include/KHR/khrplatform.h
include/glad/glad.h include/glad/glad.h

View File

@ -122,7 +122,7 @@ else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_compile_options(/utf-8) add_compile_options(/utf-8)
endif() endif()
add_library(usb STATIC EXCLUDE_FROM_ALL add_library(usb
libusb/libusb/core.c libusb/libusb/core.c
libusb/libusb/core.c libusb/libusb/core.c
libusb/libusb/descriptor.c libusb/libusb/descriptor.c

View File

@ -23,7 +23,7 @@ else()
endif() endif()
endif() endif()
add_library(opus STATIC add_library(opus
# CELT sources # CELT sources
opus/celt/bands.c opus/celt/bands.c
opus/celt/celt.c opus/celt/celt.c