[cmake, tools] update CPMUtil and add support for CPMUtil bundled Qt, module updates, cleanups (#3289)

Support for bundled Qt, not through aqtinstall but rather my CI. Multimedia is
implemented too, works on both Windows and Linux, though we don't
actually use it so it doesn't really matter. Contains Declarative and all that so the Quick frontend will work once it becomes a thing.

Some options have changed, notably w.r.t LTO and faster
linker, which are now handled directly in the modules.

CPMUtil also has support for custom dirs (`PackageName_CUSTOM_DIR`) now. Probably most useful for adding external fragment shaders and whatnot.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3289
This commit is contained in:
crueter
2026-01-14 19:29:13 +01:00
parent ecd01e13fd
commit 89f72d286a
48 changed files with 618 additions and 929 deletions

View File

@@ -13,13 +13,13 @@ set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm)
include(DetectPlatform)
include(DetectArchitecture)
include(DefaultConfig)
include(DownloadExternals)
include(UseLTO)
include(FasterLinker)
include(UseCcache)
include(CMakeDependentOption)
include(CTest)
include(CPMUtil)
DetectArchitecture()
if (NOT DEFINED ARCHITECTURE)
message(FATAL_ERROR "Architecture didn't make it out of scope, did you delete DetectArchitecture.cmake?")
endif()
@@ -41,6 +41,7 @@ if (PLATFORM_NETBSD)
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/pkg/lib/ffmpeg7/pkgconfig")
endif()
# TODO: does mingw need any of this anymore
# static stuff
option(YUZU_STATIC_BUILD "Use static libraries and executables if available" OFF)
@@ -121,15 +122,13 @@ if (CXX_CLANG_CL)
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-reserved-identifier>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-deprecated-declarations>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-cast-function-type-mismatch>
$<$<COMPILE_LANGUAGE:C,CXX>:/EHsc> # thanks microsoft
)
$<$<COMPILE_LANGUAGE:C,CXX>:/EHsc>)
# REQUIRED CPU features IN Windows-amd64
if (ARCHITECTURE_x86_64)
add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-msse4.1>
$<$<COMPILE_LANGUAGE:C,CXX>:-mcx16>
)
$<$<COMPILE_LANGUAGE:C,CXX>:-mcx16>)
endif()
endif()
@@ -150,10 +149,10 @@ cmake_dependent_option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MS
option(ENABLE_QT "Enable the Qt frontend" ON)
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
option(ENABLE_UPDATE_CHECKER "Enable update checker (for Qt and Android)" OFF)
cmake_dependent_option(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
cmake_dependent_option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF "NOT YUZU_USE_BUNDLED_QT" OFF)
set(YUZU_QT_MIRROR "" CACHE STRING "What mirror to use for downloading the bundled Qt libraries")
cmake_dependent_option(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
@@ -161,6 +160,7 @@ set(EXT_DEFAULT OFF)
if (MSVC OR ANDROID)
set(EXT_DEFAULT ON)
endif()
option(YUZU_USE_CPM "Use CPM to fetch system dependencies (fmt, boost, etc) if needed. Externals will still be fetched." ${EXT_DEFAULT})
# ffmpeg
@@ -169,9 +169,10 @@ cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external sour
# sirit
set(BUNDLED_SIRIT_DEFAULT OFF)
if ((MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo") OR ANDROID))
if (MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Deb") OR ANDROID)
set(BUNDLED_SIRIT_DEFAULT ON)
endif()
option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${BUNDLED_SIRIT_DEFAULT})
# FreeBSD 15+ has libusb, versions below should disable it
@@ -187,35 +188,6 @@ cmake_dependent_option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF
option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
if(YUZU_ENABLE_LTO)
include(UseLTO)
endif()
option(USE_CCACHE "Use ccache for compilation" OFF)
set(CCACHE_PATH "ccache" CACHE STRING "Path to ccache binary")
if(USE_CCACHE)
find_program(CCACHE_BINARY ${CCACHE_PATH})
if(CCACHE_BINARY)
message(STATUS "Found ccache at: ${CCACHE_BINARY}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY})
else()
message(FATAL_ERROR "USE_CCACHE enabled, but no executable found at: ${CCACHE_PATH}")
endif()
# Follow SCCache recommendations:
# <https://github.com/mozilla/sccache/blob/main/README.md?plain=1#L144>
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
endif()
endif()
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
option(YUZU_LEGACY "Apply patches that improve compatibility with older GPUs (e.g. Snapdragon 865) at the cost of performance" OFF)
@@ -230,8 +202,6 @@ cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support"
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" ON)
set(YUZU_TZDB_PATH "" CACHE STRING "Path to a pre-downloaded timezone database")
cmake_dependent_option(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "PLATFORM_LINUX" OFF)
cmake_dependent_option(YUZU_USE_BUNDLED_MOLTENVK "Download bundled MoltenVK lib" ON "APPLE" OFF)
option(YUZU_DISABLE_LLVM "Disable LLVM (useful for CI)" OFF)
@@ -252,15 +222,16 @@ if (ENABLE_WEB_SERVICE OR USE_DISCORD_PRESENCE)
endif()
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
if (ENABLE_OPENSSL)
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF)
if (EXT_DEFAULT OR PLATFORM_SUN)
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL ON)
endif()
option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL build" ${DEFAULT_YUZU_USE_BUNDLED_OPENSSL})
endif()
# TODO(crueter): CPM this
cmake_dependent_option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL build" ${DEFAULT_YUZU_USE_BUNDLED_OPENSSL} "ENABLE_OPENSSL" OFF)
if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL)
AddJsonPackage(vulkan-validation-layers)
@@ -324,44 +295,51 @@ if ((ANDROID OR APPLE OR UNIX) AND (NOT PLATFORM_LINUX OR ANDROID) AND NOT WIN32
endif()
# Build/optimization presets
if (PLATFORM_LINUX OR CXX_CLANG)
if (CXX_GCC OR CXX_CLANG)
if (ARCHITECTURE_x86_64)
# See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
# Generic supports Pentium Pro instruction set and above
# TODO: if a value is unknown, pass that as march and mtune
set(YUZU_BUILD_PRESET "custom" CACHE STRING "Build preset to use. One of: custom, generic, v3, zen2, zen4, native")
if (${YUZU_BUILD_PRESET} STREQUAL "generic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -mtune=generic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=x86-64 -mtune=generic")
set(march x86-64)
set(mtune generic)
elseif (${YUZU_BUILD_PRESET} STREQUAL "v3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64-v3 -mtune=generic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=x86-64-v3 -mtune=generic")
set(march x86-64-v3)
set(mtune generic)
elseif (${YUZU_BUILD_PRESET} STREQUAL "zen2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=znver2 -mtune=znver2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver2 -mtune=znver2")
set(march znver2)
set(mtune znver2)
elseif (${YUZU_BUILD_PRESET} STREQUAL "zen4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=znver4 -mtune=znver4")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=znver4 -mtune=znver4")
elseif (${YUZU_BUILD_PRESET} STREQUAL "native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
set(march znver4)
set(mtune znver4)
endif()
elseif(ARCHITECTURE_arm64)
# See https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
set(YUZU_BUILD_PRESET "custom" CACHE STRING "Build preset to use. One of: custom, generic, armv9, native")
set(mtune generic)
if (${YUZU_BUILD_PRESET} STREQUAL "generic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a -mtune=generic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a -mtune=generic")
set(march armv8-a)
elseif (${YUZU_BUILD_PRESET} STREQUAL "armv9")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv9-a -mtune=generic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv9-a -mtune=generic")
elseif (${YUZU_BUILD_PRESET} STREQUAL "native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
set(march armv9-a)
endif()
endif()
if ("${YUZU_BUILD_PRESET}" STREQUAL "native")
set(march native)
set(mtune native)
endif()
if (DEFINED march AND DEFINED mtune)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${march} -mtune=${mtune}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${march} -mtune=${mtune}")
endif()
endif()
# Other presets, e.g. steamdeck
# TODO(crueter): Just have every Linux/Windows use old sdl2
set(YUZU_SYSTEM_PROFILE "generic" CACHE STRING "CMake and Externals profile to use. One of: generic, steamdeck")
# Configure C++ standard
@@ -376,9 +354,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# System imported libraries
# =======================================================================
# Prefer the -pthread flag on Linux.
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# openssl funniness
if (ENABLE_OPENSSL)
if (YUZU_USE_BUNDLED_OPENSSL)
set(BUILD_SHARED_LIBS OFF)
AddJsonPackage(openssl)
if (OpenSSL_ADDED)
add_compile_definitions(YUZU_BUNDLED_OPENSSL)
@@ -541,10 +524,6 @@ elseif (WIN32)
endif()
elseif (PLATFORM_HAIKU)
# Haiku is so special :)
# Some fucking genius decided to name an entire module "network" in 2019
# this caused great disaster amongst the Haiku community who had came first with
# their "libnetwork.so"; since CMake doesn't do magic, we have to use an ABSOLUTE PATH
# to the library itself, otherwise it will think we are linking to... our network thing
set(PLATFORM_LIBRARIES bsd /boot/system/lib/libnetwork.so)
elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$")
set(PLATFORM_LIBRARIES rt)
@@ -563,17 +542,17 @@ find_package(VulkanUtilityLibraries)
find_package(SimpleIni)
find_package(SPIRV-Tools)
find_package(sirit)
find_package(gamemode)
find_package(gamemode)
find_package(mcl)
if (ARCHITECTURE_riscv64)
find_package(biscuit)
endif()
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
find_package(xbyak)
endif()
if (ENABLE_WEB_SERVICE OR ENABLE_QT_UPDATE_CHECKER)
# Workaround: httplib will kill itself if you attempt to do a find_package propagation
# find_package(httplib CONFIG)
endif()
if (ENABLE_WEB_SERVICE OR ENABLE_UPDATE_CHECKER)
find_package(cpp-jwt)
endif()
@@ -598,9 +577,16 @@ if (YUZU_TESTS OR DYNARMIC_TESTS)
find_package(Catch2)
endif()
# Qt stuff
if (ENABLE_QT)
if (YUZU_USE_BUNDLED_QT)
download_qt(6.8.3)
# Qt 6.8+ is broken on macOS (??)
if (APPLE)
AddQt(6.7.3)
else()
AddQt(6.9.3)
endif()
set(YUZU_STATIC_BUILD ON)
else()
message(STATUS "Using system Qt")
if (NOT Qt6_DIR)
@@ -644,9 +630,9 @@ if (ENABLE_QT)
message(STATUS "Using target Qt at ${QT_TARGET_PATH}")
message(STATUS "Using host Qt at ${QT_HOST_PATH}")
endif()
function(set_yuzu_qt_components)
## Components ##
# Best practice is to ask for all components at once, so they are from the same version
set(YUZU_QT_COMPONENTS2 Core Widgets Concurrent)
if (PLATFORM_LINUX)
@@ -662,10 +648,7 @@ function(set_yuzu_qt_components)
list(APPEND YUZU_QT_COMPONENTS2 LinguistTools)
endif()
set(YUZU_QT_COMPONENTS ${YUZU_QT_COMPONENTS2} PARENT_SCOPE)
endfunction(set_yuzu_qt_components)
if(ENABLE_QT)
set_yuzu_qt_components()
find_package(Qt6 REQUIRED COMPONENTS ${YUZU_QT_COMPONENTS})
set(QT_MAJOR_VERSION 6)
# Qt6 sets cxx_std_17 and we need to undo that
@@ -683,21 +666,18 @@ if (NOT (YUZU_USE_BUNDLED_FFMPEG OR YUZU_USE_EXTERNAL_FFMPEG))
endif()
if (WIN32 AND YUZU_CRASH_DUMPS)
set(BREAKPAD_VER "breakpad-c89f9dd")
download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
message(STATUS "YUZU_CRASH_DUMPS is unimplemented on Windows. Check back later.")
# set(BREAKPAD_VER "breakpad-c89f9dd")
# download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
set(BREAKPAD_CLIENT_INCLUDE_DIR "${BREAKPAD_PREFIX}/include")
set(BREAKPAD_CLIENT_LIBRARY "${BREAKPAD_PREFIX}/lib/libbreakpad_client.lib")
# set(BREAKPAD_CLIENT_INCLUDE_DIR "${BREAKPAD_PREFIX}/include")
# set(BREAKPAD_CLIENT_LIBRARY "${BREAKPAD_PREFIX}/lib/libbreakpad_client.lib")
add_library(libbreakpad_client INTERFACE IMPORTED)
target_link_libraries(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_LIBRARY}")
target_include_directories(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_INCLUDE_DIR}")
# add_library(libbreakpad_client INTERFACE IMPORTED)
# target_link_libraries(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_LIBRARY}")
# target_include_directories(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_INCLUDE_DIR}")
endif()
# Prefer the -pthread flag on Linux.
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# Include source code
# ===================
@@ -725,16 +705,11 @@ if (MSVC AND CXX_CLANG)
add_library(llvm-mingw-runtime STATIC IMPORTED)
set_target_properties(llvm-mingw-runtime PROPERTIES
IMPORTED_LOCATION "${LIB_PATH}"
)
IMPORTED_LOCATION "${LIB_PATH}")
link_libraries(llvm-mingw-runtime)
endif()
if (YUZU_USE_FASTER_LD)
include(FasterLinker)
endif()
# Set runtime library to MD/MDd for all configurations
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

View File

@@ -1,8 +1,3 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# This is a slightly modified version of CPM.cmake
# CPM.cmake - CMake's missing package manager
# ===========================================
# See https://github.com/cpm-cmake/CPM.cmake for usage and update instructions.

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
set(CPM_SOURCE_CACHE "${PROJECT_SOURCE_DIR}/.cache/cpm" CACHE STRING "" FORCE)
@@ -23,8 +23,17 @@ set(CPMUTIL_JSON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cpmfile.json")
if(EXISTS ${CPMUTIL_JSON_FILE})
file(READ ${CPMUTIL_JSON_FILE} CPMFILE_CONTENT)
if (NOT TARGET cpmfiles)
add_custom_target(cpmfiles)
endif()
target_sources(cpmfiles PRIVATE ${CPMUTIL_JSON_FILE})
set_property(DIRECTORY APPEND PROPERTY
CMAKE_CONFIGURE_DEPENDS
"${CPMUTIL_JSON_FILE}")
else()
message(WARNING "[CPMUtil] cpmfile ${CPMUTIL_JSON_FILE} does not exist, AddJsonPackage will be a no-op")
message(DEBUG "[CPMUtil] cpmfile ${CPMUTIL_JSON_FILE}"
"does not exist, AddJsonPackage will be a no-op")
endif()
# Utility stuff
@@ -68,10 +77,10 @@ function(AddJsonPackage)
set(oneValueArgs
NAME
# these are overrides that can be generated at runtime, so can be defined separately from the json
# these are overrides that can be generated at runtime,
# so can be defined separately from the json
DOWNLOAD_ONLY
BUNDLED_PACKAGE
)
BUNDLED_PACKAGE)
set(multiValueArgs OPTIONS)
@@ -86,7 +95,8 @@ function(AddJsonPackage)
endif()
if(NOT DEFINED CPMFILE_CONTENT)
cpm_utils_message(WARNING ${name} "No cpmfile, AddJsonPackage is a no-op")
cpm_utils_message(WARNING ${name}
"No cpmfile, AddJsonPackage is a no-op")
return()
endif()
@@ -94,7 +104,8 @@ function(AddJsonPackage)
cpm_utils_message(FATAL_ERROR "json package" "No name specified")
endif()
string(JSON object ERROR_VARIABLE err GET "${CPMFILE_CONTENT}" "${JSON_NAME}")
string(JSON object ERROR_VARIABLE
err GET "${CPMFILE_CONTENT}" "${JSON_NAME}")
if(err)
cpm_utils_message(FATAL_ERROR ${JSON_NAME} "Not found in cpmfile")
@@ -112,7 +123,8 @@ function(AddJsonPackage)
get_json_element("${object}" raw_disabled disabled_platforms "")
if(raw_disabled)
array_to_list("${raw_disabled}" ${raw_disabled_LENGTH} disabled_platforms)
array_to_list("${raw_disabled}"
${raw_disabled_LENGTH} disabled_platforms)
else()
set(disabled_platforms "")
endif()
@@ -124,8 +136,7 @@ function(AddJsonPackage)
PACKAGE ${package}
EXTENSION ${extension}
MIN_VERSION ${min_version}
DISABLED_PLATFORMS ${disabled_platforms}
)
DISABLED_PLATFORMS ${disabled_platforms})
# pass stuff to parent scope
set(${package}_ADDED "${${package}_ADDED}"
@@ -153,8 +164,10 @@ function(AddJsonPackage)
get_json_element("${object}" raw_patches patches "")
# okay here comes the fun part: REPLACEMENTS!
# first: tag gets %VERSION% replaced if applicable, with either git_version (preferred) or version
# second: artifact gets %VERSION% and %TAG% replaced accordingly (same rules for VERSION)
# first: tag gets %VERSION% replaced if applicable,
# with either git_version (preferred) or version
# second: artifact gets %VERSION% and %TAG% replaced
# accordingly (same rules for VERSION)
if(git_version)
set(version_replace ${git_version})
@@ -179,9 +192,11 @@ function(AddJsonPackage)
foreach(IDX RANGE ${range})
string(JSON _patch GET "${raw_patches}" "${IDX}")
set(full_patch "${CMAKE_SOURCE_DIR}/.patch/${JSON_NAME}/${_patch}")
set(full_patch
"${PROJECT_SOURCE_DIR}/.patch/${JSON_NAME}/${_patch}")
if(NOT EXISTS ${full_patch})
cpm_utils_message(FATAL_ERROR ${JSON_NAME} "specifies patch ${full_patch} which does not exist")
cpm_utils_message(FATAL_ERROR ${JSON_NAME}
"specifies patch ${full_patch} which does not exist")
endif()
list(APPEND patches "${full_patch}")
@@ -223,8 +238,7 @@ function(AddJsonPackage)
GIT_HOST ${git_host}
ARTIFACT ${artifact}
TAG ${tag}
)
TAG ${tag})
# pass stuff to parent scope
set(${package}_ADDED "${${package}_ADDED}"
@@ -280,8 +294,7 @@ function(AddPackage)
KEY
BUNDLED_PACKAGE
FORCE_BUNDLED_PACKAGE
FIND_PACKAGE_ARGUMENTS
)
FIND_PACKAGE_ARGUMENTS)
set(multiValueArgs OPTIONS PATCHES)
@@ -292,8 +305,17 @@ function(AddPackage)
cpm_utils_message(FATAL_ERROR "package" "No package name defined")
endif()
option(${PKG_ARGS_NAME}_FORCE_SYSTEM "Force the system package for ${PKG_ARGS_NAME}")
option(${PKG_ARGS_NAME}_FORCE_BUNDLED "Force the bundled package for ${PKG_ARGS_NAME}")
set(${PKG_ARGS_NAME}_CUSTOM_DIR "" CACHE STRING
"Path to a separately-downloaded copy of ${PKG_ARGS_NAME}")
option(${PKG_ARGS_NAME}_FORCE_SYSTEM
"Force the system package for ${PKG_ARGS_NAME}")
option(${PKG_ARGS_NAME}_FORCE_BUNDLED
"Force the bundled package for ${PKG_ARGS_NAME}")
if (DEFINED ${PKG_ARGS_NAME}_CUSTOM_DIR AND
NOT ${PKG_ARGS_NAME}_CUSTOM_DIR STREQUAL "")
set(CPM_${PKG_ARGS_NAME}_SOURCE ${${PKG_ARGS_NAME}_CUSTOM_DIR})
endif()
if(NOT DEFINED PKG_ARGS_GIT_HOST)
set(git_host github.com)
@@ -333,17 +355,19 @@ function(AddPackage)
set(PKG_BRANCH ${PKG_ARGS_BRANCH})
else()
cpm_utils_message(WARNING ${PKG_ARGS_NAME}
"REPO defined but no TAG, SHA, BRANCH, or URL specified, defaulting to master")
"REPO defined but no TAG, SHA, BRANCH, or URL"
"specified, defaulting to master")
set(PKG_BRANCH master)
endif()
set(pkg_url ${pkg_git_url}/archive/refs/heads/${PKG_BRANCH}.tar.gz)
endif()
else()
cpm_utils_message(FATAL_ERROR ${PKG_ARGS_NAME} "No URL or repository defined")
cpm_utils_message(FATAL_ERROR ${PKG_ARGS_NAME}
"No URL or repository defined")
endif()
cpm_utils_message(STATUS ${PKG_ARGS_NAME} "Download URL is ${pkg_url}")
cpm_utils_message(DEBUG ${PKG_ARGS_NAME} "Download URL is ${pkg_url}")
if(NOT DEFINED PKG_ARGS_KEY)
if(DEFINED PKG_ARGS_SHA)
@@ -402,7 +426,8 @@ function(AddPackage)
# because "technically" the hash is invalidated each week
# but it works for now kjsdnfkjdnfjksdn
string(TOLOWER ${PKG_ARGS_NAME} lowername)
if(NOT EXISTS ${outfile} AND NOT EXISTS ${CPM_SOURCE_CACHE}/${lowername}/${pkg_key})
if(NOT EXISTS ${outfile} AND NOT EXISTS
${CPM_SOURCE_CACHE}/${lowername}/${pkg_key})
file(DOWNLOAD ${hash_url} ${outfile})
endif()
@@ -428,7 +453,7 @@ function(AddPackage)
- CPMUTIL_FORCE_BUNDLED
- BUNDLED_PACKAGE
- default to allow local
]] #
]]
if(PKG_ARGS_FORCE_BUNDLED_PACKAGE)
set_precedence(OFF OFF)
elseif(${PKG_ARGS_NAME}_FORCE_SYSTEM)
@@ -439,7 +464,8 @@ function(AddPackage)
set_precedence(ON ON)
elseif(CPMUTIL_FORCE_BUNDLED)
set_precedence(OFF OFF)
elseif(DEFINED PKG_ARGS_BUNDLED_PACKAGE AND NOT PKG_ARGS_BUNDLED_PACKAGE STREQUAL "unset")
elseif(DEFINED PKG_ARGS_BUNDLED_PACKAGE AND
NOT PKG_ARGS_BUNDLED_PACKAGE STREQUAL "unset")
if(PKG_ARGS_BUNDLED_PACKAGE)
set(local OFF)
else()
@@ -453,8 +479,7 @@ function(AddPackage)
if(DEFINED PKG_ARGS_VERSION)
list(APPEND EXTRA_ARGS
VERSION ${PKG_ARGS_VERSION}
)
VERSION ${PKG_ARGS_VERSION})
endif()
CPMAddPackage(
@@ -471,8 +496,7 @@ function(AddPackage)
${EXTRA_ARGS}
${PKG_ARGS_UNPARSED_ARGUMENTS}
)
${PKG_ARGS_UNPARSED_ARGUMENTS})
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_NAMES ${PKG_ARGS_NAME})
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_URLS ${pkg_git_url})
@@ -516,24 +540,6 @@ function(AddPackage)
endfunction()
function(add_ci_package key)
set(ARTIFACT ${ARTIFACT_NAME}-${key}-${ARTIFACT_VERSION}.${ARTIFACT_EXT})
AddPackage(
NAME ${ARTIFACT_PACKAGE}
REPO ${ARTIFACT_REPO}
TAG v${ARTIFACT_VERSION}
GIT_VERSION ${ARTIFACT_VERSION}
ARTIFACT ${ARTIFACT}
KEY ${key}-${ARTIFACT_VERSION}
HASH_SUFFIX sha512sum
FORCE_BUNDLED_PACKAGE ON
)
set(ARTIFACT_DIR ${${ARTIFACT_PACKAGE}_SOURCE_DIR} PARENT_SCOPE)
endfunction()
# TODO(crueter): we could do an AddMultiArchPackage, multiplatformpackage?
# name is the artifact name, package is for find_package override
function(AddCIPackage)
@@ -543,12 +549,17 @@ function(AddCIPackage)
REPO
PACKAGE
EXTENSION
MIN_VERSION
)
MIN_VERSION)
set(multiValueArgs DISABLED_PLATFORMS)
cmake_parse_arguments(PKG_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(optionArgs MODULE)
cmake_parse_arguments(PKG_ARGS
"${optionArgs}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN})
if(NOT DEFINED PKG_ARGS_VERSION)
message(FATAL_ERROR "[CPMUtil] VERSION is required")
@@ -589,55 +600,74 @@ function(AddCIPackage)
set(ARTIFACT_REPO ${PKG_ARGS_REPO})
set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE})
if((MSVC AND ARCHITECTURE_x86_64) AND NOT "windows-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(windows-amd64)
if(MSVC AND ARCHITECTURE_x86_64)
set(pkgname windows-amd64)
elseif(MSVC AND ARCHITECTURE_arm64)
set(pkgname windows-arm64)
elseif(MINGW AND ARCHITECTURE_x86_64)
set(pkgname mingw-amd64)
elseif(MINGW AND ARCHITECTURE_arm64)
set(pkgname mingw-arm64)
elseif(ANDROID AND ARCHITECTURE_x86_64)
set(pkgname android-x86_64)
elseif(ANDROID AND ARCHITECTURE_arm64)
set(pkgname android-aarch64)
elseif(PLATFORM_SUN)
set(pkgname solaris-amd64)
elseif(PLATFORM_FREEBSD)
set(pkgname freebsd-amd64)
elseif(PLATFORM_LINUX AND ARCHITECTURE_x86_64)
set(pkgname linux-amd64)
elseif(PLATFORM_LINUX AND ARCHITECTURE_arm64)
set(pkgname linux-aarch64)
elseif(APPLE)
set(pkgname macos-universal)
endif()
if((MSVC AND ARCHITECTURE_arm64) AND NOT "windows-arm64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(windows-arm64)
endif()
if (DEFINED pkgname AND NOT "${pkgname}" IN_LIST DISABLED_PLATFORMS)
set(ARTIFACT "${ARTIFACT_NAME}-${pkgname}-${ARTIFACT_VERSION}.${ARTIFACT_EXT}")
if((MINGW AND ARCHITECTURE_x86_64) AND NOT "mingw-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(mingw-amd64)
endif()
AddPackage(
NAME ${ARTIFACT_PACKAGE}
REPO ${ARTIFACT_REPO}
TAG "v${ARTIFACT_VERSION}"
GIT_VERSION ${ARTIFACT_VERSION}
ARTIFACT ${ARTIFACT}
if((MINGW AND ARCHITECTURE_arm64) AND NOT "mingw-arm64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(mingw-arm64)
endif()
KEY "${pkgname}-${ARTIFACT_VERSION}"
HASH_SUFFIX sha512sum
FORCE_BUNDLED_PACKAGE ON
DOWNLOAD_ONLY ${PKG_ARGS_MODULE})
if((ANDROID AND ARCHITECTURE_x86_64) AND NOT "android-x86_64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(android-x86_64)
endif()
if((ANDROID AND ARCHITECTURE_arm64) AND NOT "android-aarch64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(android-aarch64)
endif()
if(PLATFORM_SUN AND NOT "solaris-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(solaris-amd64)
endif()
if(PLATFORM_FREEBSD AND NOT "freebsd-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(freebsd-amd64)
endif()
if((PLATFORM_LINUX AND ARCHITECTURE_x86_64) AND NOT "linux-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(linux-amd64)
endif()
if((PLATFORM_LINUX AND ARCHITECTURE_arm64) AND NOT "linux-aarch64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(linux-aarch64)
endif()
# TODO(crueter): macOS amd64/aarch64 split mayhaps
if(APPLE AND NOT "macos-universal" IN_LIST DISABLED_PLATFORMS)
add_ci_package(macos-universal)
endif()
if(DEFINED ARTIFACT_DIR)
set(${ARTIFACT_PACKAGE}_ADDED TRUE PARENT_SCOPE)
set(${ARTIFACT_PACKAGE}_SOURCE_DIR "${ARTIFACT_DIR}" PARENT_SCOPE)
set(${ARTIFACT_PACKAGE}_SOURCE_DIR
"${${ARTIFACT_PACKAGE}_SOURCE_DIR}" PARENT_SCOPE)
if (PKG_ARGS_MODULE)
list(APPEND CMAKE_PREFIX_PATH "${${ARTIFACT_PACKAGE}_SOURCE_DIR}")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
endif()
else()
find_package(${ARTIFACT_PACKAGE} ${ARTIFACT_MIN_VERSION} REQUIRED)
endif()
endfunction()
# Utility function for Qt
function(AddQt version)
if (NOT DEFINED version)
message(FATAL_ERROR "[CPMUtil] AddQt: version is required")
endif()
AddCIPackage(
NAME Qt
PACKAGE Qt6
VERSION ${version}
MIN_VERSION 6
REPO crueter-ci/Qt
DISABLED_PLATFORMS
android-x86_64 android-aarch64
freebsd-amd64 solaris-amd64 openbsd-amd64
MODULE)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
endfunction()

View File

@@ -1,271 +0,0 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# This function downloads a binary library package from our external repo.
# Params:
# remote_path: path to the file to download, relative to the remote repository root
# prefix_var: name of a variable which will be set with the path to the extracted contents
set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})
function(download_bundled_external remote_path lib_name cpm_key prefix_var version)
set(package_base_url "https://github.com/eden-emulator/")
set(package_repo "no_platform")
set(package_extension "no_platform")
set(CACHE_KEY "")
# TODO(crueter): Need to convert ffmpeg to a CI.
if (WIN32 OR FORCE_WIN_ARCHIVES)
if (ARCHITECTURE_arm64)
set(CACHE_KEY "windows")
set(package_repo "ext-windows-arm64-bin/raw/master/")
set(package_extension ".zip")
elseif(ARCHITECTURE_x86_64)
set(CACHE_KEY "windows")
set(package_repo "ext-windows-bin/raw/master/")
set(package_extension ".7z")
endif()
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CACHE_KEY "linux")
set(package_repo "ext-linux-bin/raw/master/")
set(package_extension ".tar.xz")
elseif (ANDROID)
set(CACHE_KEY "android")
set(package_repo "ext-android-bin/raw/master/")
set(package_extension ".tar.xz")
else()
message(FATAL_ERROR "No package available for this platform")
endif()
string(CONCAT package_url "${package_base_url}" "${package_repo}")
string(CONCAT full_url "${package_url}" "${remote_path}" "${lib_name}" "${package_extension}")
message(STATUS "Resolved bundled URL: ${full_url}")
# TODO(crueter): DELETE THIS ENTIRELY, GLORY BE TO THE CI!
AddPackage(
NAME ${cpm_key}
VERSION ${version}
URL ${full_url}
DOWNLOAD_ONLY YES
KEY ${CACHE_KEY}
BUNDLED_PACKAGE ON
# TODO(crueter): hash
)
if (DEFINED ${cpm_key}_SOURCE_DIR)
set(${prefix_var} "${${cpm_key}_SOURCE_DIR}" PARENT_SCOPE)
message(STATUS "Using bundled binaries at ${${cpm_key}_SOURCE_DIR}")
else()
message(FATAL_ERROR "AddPackage did not set ${cpm_key}_SOURCE_DIR")
endif()
endfunction()
# Determine installation parameters for OS, architecture, and compiler
function(determine_qt_parameters target host_out type_out arch_out arch_path_out host_type_out host_arch_out host_arch_path_out)
if (WIN32)
set(host "windows")
set(type "desktop")
if (NOT tool)
if (MINGW)
set(arch "win64_mingw")
set(arch_path "mingw_64")
elseif (MSVC)
if ("arm64" IN_LIST ARCHITECTURE)
set(arch_path "msvc2022_arm64")
elseif ("x86_64" IN_LIST ARCHITECTURE)
set(arch_path "msvc2022_64")
else()
message(FATAL_ERROR "Unsupported bundled Qt architecture. Disable YUZU_USE_BUNDLED_QT and provide your own.")
endif()
set(arch "win64_${arch_path}")
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(host_arch_path "msvc2022_64")
elseif (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(host_arch_path "msvc2022_arm64")
endif()
set(host_arch "win64_${host_arch_path}")
else()
message(FATAL_ERROR "Unsupported bundled Qt toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
endif()
endif()
elseif (APPLE)
set(host "mac")
set(type "desktop")
set(arch "clang_64")
set(arch_path "macos")
else()
set(host "linux")
set(type "desktop")
set(arch "linux_gcc_64")
set(arch_path "gcc_64")
endif()
set(${host_out} "${host}" PARENT_SCOPE)
set(${type_out} "${type}" PARENT_SCOPE)
set(${arch_out} "${arch}" PARENT_SCOPE)
set(${arch_path_out} "${arch_path}" PARENT_SCOPE)
if (DEFINED host_type)
set(${host_type_out} "${host_type}" PARENT_SCOPE)
else()
set(${host_type_out} "${type}" PARENT_SCOPE)
endif()
if (DEFINED host_arch)
set(${host_arch_out} "${host_arch}" PARENT_SCOPE)
else()
set(${host_arch_out} "${arch}" PARENT_SCOPE)
endif()
if (DEFINED host_arch_path)
set(${host_arch_path_out} "${host_arch_path}" PARENT_SCOPE)
else()
set(${host_arch_path_out} "${arch_path}" PARENT_SCOPE)
endif()
endfunction()
# Download Qt binaries for a specific configuration.
function(download_qt_configuration prefix_out target host type arch arch_path base_path)
if (target MATCHES "tools_.*")
set(tool ON)
else()
set(tool OFF)
endif()
set(install_args -c "${CURRENT_MODULE_DIR}/aqt_config.ini")
if (tool)
set(prefix "${base_path}/Tools")
list(APPEND install_args install-tool --outputdir "${base_path}" "${host}" desktop "${target}")
else()
set(prefix "${base_path}/${target}/${arch_path}")
list(APPEND install_args install-qt --outputdir "${base_path}" "${host}" "${type}" "${target}" "${arch}" -m qt_base)
if (YUZU_USE_QT_MULTIMEDIA)
list(APPEND install_args qtmultimedia)
endif()
if (YUZU_USE_QT_WEB_ENGINE)
list(APPEND install_args qtpositioning qtwebchannel qtwebengine)
endif()
if (NOT "${YUZU_QT_MIRROR}" STREQUAL "")
message(STATUS "Using Qt mirror ${YUZU_QT_MIRROR}")
list(APPEND install_args -b "${YUZU_QT_MIRROR}")
endif()
endif()
message(STATUS "Install Args: ${install_args}")
if (NOT EXISTS "${prefix}")
message(STATUS "Downloading Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path}")
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.3.0")
if (WIN32)
set(aqt_path "${base_path}/aqt.exe")
if (NOT EXISTS "${aqt_path}")
file(DOWNLOAD "${AQT_PREBUILD_BASE_URL}/aqt.exe" "${aqt_path}" SHOW_PROGRESS)
endif()
execute_process(COMMAND "${aqt_path}" ${install_args}
WORKING_DIRECTORY "${base_path}"
RESULT_VARIABLE aqt_res
OUTPUT_VARIABLE aqt_out
ERROR_VARIABLE aqt_err)
if (NOT aqt_res EQUAL 0)
message(FATAL_ERROR "aqt.exe failed: ${aqt_err}")
endif()
elseif (APPLE)
set(aqt_path "${base_path}/aqt-macos")
if (NOT EXISTS "${aqt_path}")
file(DOWNLOAD "${AQT_PREBUILD_BASE_URL}/aqt-macos" "${aqt_path}" SHOW_PROGRESS)
endif()
execute_process(COMMAND chmod +x "${aqt_path}")
execute_process(COMMAND "${aqt_path}" ${install_args}
WORKING_DIRECTORY "${base_path}"
RESULT_VARIABLE aqt_res
ERROR_VARIABLE aqt_err)
if (NOT aqt_res EQUAL 0)
message(FATAL_ERROR "aqt-macos failed: ${aqt_err}")
endif()
else()
find_program(PYTHON3_EXECUTABLE python3)
if (NOT PYTHON3_EXECUTABLE)
message(FATAL_ERROR "python3 is required to install Qt using aqt (pip mode).")
endif()
set(aqt_install_path "${base_path}/aqt")
file(MAKE_DIRECTORY "${aqt_install_path}")
execute_process(COMMAND "${PYTHON3_EXECUTABLE}" -m pip install --target="${aqt_install_path}" aqtinstall
WORKING_DIRECTORY "${base_path}"
RESULT_VARIABLE pip_res
ERROR_VARIABLE pip_err)
if (NOT pip_res EQUAL 0)
message(FATAL_ERROR "pip install aqtinstall failed: ${pip_err}")
endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E env PYTHONPATH="${aqt_install_path}" "${PYTHON3_EXECUTABLE}" -m aqt ${install_args}
WORKING_DIRECTORY "${base_path}"
RESULT_VARIABLE aqt_res
ERROR_VARIABLE aqt_err)
if (NOT aqt_res EQUAL 0)
message(FATAL_ERROR "aqt (python) failed: ${aqt_err}")
endif()
endif()
message(STATUS "Downloaded Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path} to ${prefix}")
endif()
set(${prefix_out} "${prefix}" PARENT_SCOPE)
endfunction()
# This function downloads Qt using aqt.
# The path of the downloaded content will be added to the CMAKE_PREFIX_PATH.
# QT_TARGET_PATH is set to the Qt for the compile target platform.
# QT_HOST_PATH is set to a host-compatible Qt, for running tools.
# Params:
# target: Qt dependency to install. Specify a version number to download Qt, or "tools_(name)" for a specific build tool.
function(download_qt target)
determine_qt_parameters("${target}" host type arch arch_path host_type host_arch host_arch_path)
set(base_path "${CMAKE_BINARY_DIR}/externals/qt")
file(MAKE_DIRECTORY "${base_path}")
download_qt_configuration(prefix "${target}" "${host}" "${type}" "${arch}" "${arch_path}" "${base_path}")
if (DEFINED host_arch_path AND NOT "${host_arch_path}" STREQUAL "${arch_path}")
download_qt_configuration(host_prefix "${target}" "${host}" "${host_type}" "${host_arch}" "${host_arch_path}" "${base_path}")
else()
set(host_prefix "${prefix}")
endif()
set(QT_TARGET_PATH "${prefix}" CACHE STRING "")
set(QT_HOST_PATH "${host_prefix}" CACHE STRING "")
list(APPEND CMAKE_PREFIX_PATH "${prefix}")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
endfunction()
function(download_moltenvk version platform)
if(NOT version)
message(FATAL_ERROR "download_moltenvk: version argument is required")
endif()
if(NOT platform)
message(FATAL_ERROR "download_moltenvk: platform argument is required")
endif()
set(MOLTENVK_DIR "${CMAKE_BINARY_DIR}/externals/MoltenVK")
set(MOLTENVK_TAR "${CMAKE_BINARY_DIR}/externals/MoltenVK.tar")
if(NOT EXISTS "${MOLTENVK_DIR}")
if(NOT EXISTS "${MOLTENVK_TAR}")
file(DOWNLOAD "https://github.com/KhronosGroup/MoltenVK/releases/download/${version}/MoltenVK-${platform}.tar"
"${MOLTENVK_TAR}" SHOW_PROGRESS)
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xf "${MOLTENVK_TAR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals"
RESULT_VARIABLE tar_res
ERROR_VARIABLE tar_err
)
if(NOT tar_res EQUAL 0)
message(FATAL_ERROR "Extracting MoltenVK failed: ${tar_err}")
endif()
endif()
list(APPEND CMAKE_PREFIX_PATH "${MOLTENVK_DIR}/MoltenVK/dylib/${platform}")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
endfunction()

View File

@@ -4,7 +4,7 @@
"package": "OpenSSL",
"name": "openssl",
"repo": "crueter-ci/OpenSSL",
"version": "3.6.0-965d6279e8",
"version": "3.6.0-1cb0d36b39",
"min_version": "1.1.1"
},
"boost": {

View File

@@ -7,13 +7,14 @@
- `EXTENSION`: Artifact extension (default `tar.zst`)
- `MIN_VERSION`: Minimum version for `find_package`. Only used if platform does not support this package as a bundled artifact
- `DISABLED_PLATFORMS`: List of platforms that lack artifacts for this package. Options:
* `windows-amd64`
* `windows-arm64`
* `mingw-amd64`
* `mingw-arm64`
* `android`
* `solaris-amd64`
* `freebsd-amd64`
* `linux-amd64`
* `linux-aarch64`
* `macos-universal`
- `windows-amd64`
- `windows-arm64`
- `mingw-amd64`
- `mingw-arm64`
- `android-x86_64`
- `android-aarch64`
- `solaris-amd64`
- `freebsd-amd64`
- `linux-amd64`
- `linux-aarch64`
- `macos-universal`

View File

@@ -22,11 +22,11 @@ If `ci` is `false`:
- `sha` -> `SHA`
- `key` -> `KEY`
- `tag` -> `TAG`
* If the tag contains `%VERSION%`, that part will be replaced by the `git_version`, OR `version` if `git_version` is not specified
- If the tag contains `%VERSION%`, that part will be replaced by the `git_version`, OR `version` if `git_version` is not specified
- `url` -> `URL`
- `artifact` -> `ARTIFACT`
* If the artifact contains `%VERSION%`, that part will be replaced by the `git_version`, OR `version` if `git_version` is not specified
* If the artifact contains `%TAG%`, that part will be replaced by the `tag` (with its replacement already done)
- If the artifact contains `%VERSION%`, that part will be replaced by the `git_version`, OR `version` if `git_version` is not specified
- If the artifact contains `%TAG%`, that part will be replaced by the `tag` (with its replacement already done)
- `git_version` -> `GIT_VERSION`
- `git_host` -> `GIT_HOST`
- `source_subdir` -> `SOURCE_SUBDIR`
@@ -101,4 +101,4 @@ In order: OpenSSL CI, Boost (tag + artifact), Opus (options + find_args), discor
]
}
}
```
```

View File

@@ -17,7 +17,7 @@
- `URL`: The URL to fetch.
- `REPO`: The repo to use (`owner/repo`).
- `GIT_HOST`: The Git host to use
* Defaults to `github.com`. Do not include the protocol, as HTTPS is enforced.
- Defaults to `github.com`. Do not include the protocol, as HTTPS is enforced.
- `TAG`: The tag to fetch, if applicable.
- `ARTIFACT`: The name of the artifact, if applicable.
- `SHA`: Commit sha to fetch, if applicable.
@@ -26,23 +26,23 @@
The following configurations are supported, in descending order of precedence:
- `URL`: Bare URL download, useful for custom artifacts
* If this is set, `GIT_URL` or `REPO` should be set to allow the dependency viewer to link to the project's Git repository.
* If this is NOT set, `REPO` must be defined.
- If this is set, `GIT_URL` or `REPO` should be set to allow the dependency viewer to link to the project's Git repository.
- If this is NOT set, `REPO` must be defined.
- `REPO + TAG + ARTIFACT`: GitHub release artifact
* The final download URL will be `https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}`
* Useful for prebuilt libraries and prefetched archives
- The final download URL will be `https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}`
- Useful for prebuilt libraries and prefetched archives
- `REPO + TAG`: GitHub tag archive
* The final download URL will be `https://github.com/${REPO}/archive/refs/tags/${TAG}.tar.gz`
* Useful for pinning to a specific tag, better for build identification
- The final download URL will be `https://github.com/${REPO}/archive/refs/tags/${TAG}.tar.gz`
- Useful for pinning to a specific tag, better for build identification
- `REPO + SHA`: GitHub commit archive
* The final download URL will be `https://github.com/${REPO}/archive/${SHA}.zip`
* Useful for pinning to a specific commit
- The final download URL will be `https://github.com/${REPO}/archive/${SHA}.zip`
- Useful for pinning to a specific commit
- `REPO + BRANCH`: GitHub branch archive
* The final download URL will be `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip`
* Generally not recommended unless the branch is frozen
- The final download URL will be `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip`
- Generally not recommended unless the branch is frozen
- `REPO`: GitHub master archive
* The final download URL will be `https://github.com/${REPO}/archive/refs/heads/master.zip`
* Generally not recommended unless the project is dead
- The final download URL will be `https://github.com/${REPO}/archive/refs/heads/master.zip`
- Generally not recommended unless the project is dead
## Hashing
@@ -54,20 +54,20 @@ Hashing strategies, descending order of precedence:
- `HASH`: Bare hash verification, useful for static downloads e.g. commit archives
- `HASH_SUFFIX`: Download the hash as `${DOWNLOAD_URL}.${HASH_SUFFIX}`
* The downloaded hash *must* match the hash algorithm and contain nothing but the hash; no filenames or extra content.
- The downloaded hash *must* match the hash algorithm and contain nothing but the hash; no filenames or extra content.
- `HASH_URL`: Download the hash from a separate URL
## Other Options
- `KEY`: Custom cache key to use (stored as `.cache/cpm/${packagename_lower}/${key}`)
* Default is based on, in descending order of precedence:
- Default is based on, in descending order of precedence:
- First 4 characters of the sha
- `GIT_VERSION`
- Tag
- `VERSION`
- Otherwise, CPM defaults will be used. This is not recommended as it doesn't produce reproducible caches
- `DOWNLOAD_ONLY`: Whether or not to configure the downloaded package via CMake
* Useful to turn `OFF` if the project doesn't use CMake
- Useful to turn `OFF` if the project doesn't use CMake
- `SOURCE_SUBDIR`: Subdirectory of the project containing a CMakeLists.txt file
- `FIND_PACKAGE_ARGUMENTS`: Arguments to pass to the `find_package` call
- `BUNDLED_PACKAGE`: Set to `ON` to default to the bundled package
@@ -80,12 +80,14 @@ Hashing strategies, descending order of precedence:
For each added package, users may additionally force usage of the system/bundled package.
- `${package}_DIR`: Path to a separately-downloaded copy of the package. Note that versioning is not checked!
- `${package}_FORCE_SYSTEM`: Require the package to be installed on the system
- `${package}_FORCE_BUNDLED`: Force the package to be fetched and use the bundled version
## System/Bundled Packages
Descending order of precedence:
- If `${package}_FORCE_SYSTEM` is true, requires the package to be on the system
- If `${package}_FORCE_BUNDLED` is true, forcefully uses the bundled package
- If `CPMUTIL_FORCE_SYSTEM` is true, requires the package to be on the system
@@ -101,8 +103,8 @@ URLs:
- `GIT_URL`
- `REPO` as a Git repository
* You may optionally specify `GIT_HOST` to use a custom host, e.g. `GIT_HOST git.crueter.xyz`. Note that the git host MUST be GitHub-like in its artifact/archive downloads, e.g. Forgejo
* If `GIT_HOST` is unspecified, defaults to `github.com`
- You may optionally specify `GIT_HOST` to use a custom host, e.g. `GIT_HOST git.crueter.xyz`. Note that the git host MUST be GitHub-like in its artifact/archive downloads, e.g. Forgejo
- If `GIT_HOST` is unspecified, defaults to `github.com`
- `URL`
Versions (bundled):
@@ -113,4 +115,4 @@ Versions (bundled):
- `TAG`
- "unknown"
If the package is a system package, AddPackage will attempt to determine the package version and append ` (system)` to the identifier. Otherwise, it will be marked as `unknown (system)`
If the package is a system package, AddPackage will attempt to determine the package version and append `(system)` to the identifier. Otherwise, it will be marked as `unknown (system)`

28
docs/CPMUtil/AddQt.md Normal file
View File

@@ -0,0 +1,28 @@
# AddQt
Simply call `AddQt(<Qt Version>)` before any Qt `find_package` calls and everything will be set up for you. On Linux, the bundled Qt library is built as a shared library, and provided you have OpenSSL and X11, everything should just work.
On Windows, MinGW, and MacOS, Qt is bundled as a static library. No further action is needed, as the provided libraries automatically integrate the Windows/Cocoa plugins, alongside the corresponding Multimedia and Network plugins.
## Modules
The following modules are bundled into these Qt builds:
- Base (Gui, Core, Widgets, Network)
- Multimedia
- Declarative (Quick, QML)
- Linux: Wayland client
Each platform has the corresponding QPA built in and set as the default as well. This means you don't need to add `Q_IMPORT_PLUGIN`!
## Example
See an example in the [`tests/qt`](https://git.crueter.xyz/CMake/CPMUtil/src/branch/master/tests/qt/CMakeLists.txt) directory.
## Versions
The following versions have available builds:
- 6.9.3
See [`crueter-ci/Qt`](https://github.com/crueter-ci/Qt) for an updated list at any time.

View File

@@ -5,7 +5,7 @@ CPMUtil is a wrapper around CPM that aims to reduce boilerplate and add useful u
Global Options:
- `CPMUTIL_FORCE_SYSTEM` (default `OFF`): Require all CPM dependencies to use system packages. NOT RECOMMENDED!
* You may optionally override this (section)
- You may optionally override this (section)
- `CPMUTIL_FORCE_BUNDLED` (default `ON` on MSVC and Android, `OFF` elsewhere): Require all CPM dependencies to use bundled packages.
You are highly encouraged to read AddPackage first, even if you plan to only interact with CPMUtil via `AddJsonPackage`.
@@ -13,6 +13,7 @@ You are highly encouraged to read AddPackage first, even if you plan to only int
- [AddPackage](#addpackage)
- [AddCIPackage](#addcipackage)
- [AddJsonPackage](#addjsonpackage)
- [AddQt](#addqt)
- [Lists](#lists)
- [For Packagers](#for-packagers)
- [Network Sandbox](#network-sandbox)
@@ -30,6 +31,10 @@ The core of CPMUtil is the [`AddPackage`](./AddPackage.md) function. [`AddPackag
[`AddJsonPackage`](./AddJsonPackage.md) is the recommended method of usage for CPMUtil.
## AddQt
[`AddQt`](./AddQt.md) adds a specific version of Qt to your project.
## Lists
CPMUtil will create three lists of dependencies where `AddPackage` or similar was used. Each is in order of addition.
@@ -37,8 +42,8 @@ CPMUtil will create three lists of dependencies where `AddPackage` or similar wa
- `CPM_PACKAGE_NAMES`: The names of packages included by CPMUtil
- `CPM_PACKAGE_URLS`: The URLs to project/repo pages of packages
- `CPM_PACKAGE_SHAS`: Short version identifiers for each package
* If the package was included as a system package, ` (system)` is appended thereafter
* Packages whose versions can't be deduced will be left as `unknown`.
- If the package was included as a system package, `(system)` is appended thereafter
- Packages whose versions can't be deduced will be left as `unknown`.
For an example of how this might be implemented in an application, see Eden's implementation:
@@ -54,6 +59,8 @@ If you are packaging a project that uses CPMUtil, read this!
For sandboxed environments (e.g. Gentoo, nixOS) you must install all dependencies to the system beforehand and set `-DCPMUTIL_FORCE_SYSTEM=ON`. If a dependency is missing, get creating!
Alternatively, if CPMUtil pulls in a package that has no suitable way to install or use a system version, download it separately and pass `-DPackageName_DIR=/path/to/downloaded/dir` (e.g. shaders)
### Unsandboxed
For others (AUR, MPR, etc). CPMUtil will handle everything for you, including if some of the project's dependencies are missing from your distribution's repositories. That is pretty much half the reason I created this behemoth, after all.
For others (AUR, MPR, etc). CPMUtil will handle everything for you, including if some of the project's dependencies are missing from your distribution's repositories. That is pretty much half the reason I created this behemoth, after all.

View File

@@ -25,7 +25,7 @@ set(BUILD_SHARED_LIBS OFF)
# Skip install rules for all externals
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON)
# Xbyak (also used by Dynarmic, so needs to be added first)
# Xbyak
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
if (PLATFORM_SUN OR PLATFORM_OPENBSD OR PLATFORM_NETBSD OR PLATFORM_DRAGONFLY)
AddJsonPackage(xbyak_sun)
@@ -34,11 +34,19 @@ if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
endif()
endif()
# Oaknut (also used by Dynarmic, so needs to be added first)
# Oaknut
if (ARCHITECTURE_arm64 OR DYNARMIC_TESTS)
AddJsonPackage(oaknut)
endif()
# biscuit
if (ARCHITECTURE_riscv64)
AddJsonPackage(biscuit)
endif()
# mcl
AddJsonPackage(mcl)
# enet
AddJsonPackage(enet)

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## DefaultConfig ##

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## DetectArchitecture ##
#[[
@@ -93,133 +93,129 @@ function(detect_architecture_symbols)
endforeach()
endfunction()
function(DetectArchitecture)
# arches here are put in a sane default order of importance
# notably, amd64, arm64, and riscv (in order) are BY FAR the most common
# mips is pretty popular in embedded
# ppc64 is pretty popular in supercomputing
# sparc is uh
# ia64 exists
# the rest exist, but are probably less popular than ia64
# arches here are put in a sane default order of importance
# notably, amd64, arm64, and riscv (in order) are BY FAR the most common
# mips is pretty popular in embedded
# ppc64 is pretty popular in supercomputing
# sparc is uh
# ia64 exists
# the rest exist, but are probably less popular than ia64
detect_architecture_symbols(
ARCH arm64
SYMBOLS
"__ARM64__"
"__aarch64__"
"_M_ARM64")
detect_architecture_symbols(
ARCH arm64
SYMBOLS
"__ARM64__"
"__aarch64__"
"_M_ARM64")
detect_architecture_symbols(
ARCH x86_64
SYMBOLS
"__x86_64"
"__x86_64__"
"__amd64"
"_M_X64"
"_M_AMD64")
detect_architecture_symbols(
ARCH x86_64
SYMBOLS
"__x86_64"
"__x86_64__"
"__amd64"
"_M_X64"
"_M_AMD64")
# riscv is interesting since it generally does not define a riscv64-specific symbol
# We can, however, check for the rv32 zcf extension which is good enough of a heuristic on GCC
detect_architecture_symbols(
ARCH riscv
SYMBOLS
"__riscv_zcf")
# riscv is interesting since it generally does not define a riscv64-specific symbol
# We can, however, check for the rv32 zcf extension which is good enough of a heuristic on GCC
detect_architecture_symbols(
ARCH riscv
SYMBOLS
"__riscv_zcf")
# if zcf doesn't exist we can safely assume it's riscv64
detect_architecture_symbols(
ARCH riscv64
SYMBOLS
"__riscv")
# if zcf doesn't exist we can safely assume it's riscv64
detect_architecture_symbols(
ARCH riscv64
SYMBOLS
"__riscv")
detect_architecture_symbols(
ARCH x86
SYMBOLS
"__i386"
"__i386__"
"_M_IX86")
detect_architecture_symbols(
ARCH x86
SYMBOLS
"__i386"
"__i386__"
"_M_IX86")
detect_architecture_symbols(
ARCH arm
SYMBOLS
"__arm__"
"__TARGET_ARCH_ARM"
"_M_ARM")
detect_architecture_symbols(
ARCH arm
SYMBOLS
"__arm__"
"__TARGET_ARCH_ARM"
"_M_ARM")
detect_architecture_symbols(
ARCH ia64
SYMBOLS
"__ia64"
"__ia64__"
"_M_IA64")
detect_architecture_symbols(
ARCH ia64
SYMBOLS
"__ia64"
"__ia64__"
"_M_IA64")
# mips is probably the least fun to detect due to microMIPS
# Because microMIPS is such cancer I'm considering it out of scope for now
detect_architecture_symbols(
ARCH mips64
SYMBOLS
"__mips64")
# mips is probably the least fun to detect due to microMIPS
# Because microMIPS is such cancer I'm considering it out of scope for now
detect_architecture_symbols(
ARCH mips64
SYMBOLS
"__mips64")
detect_architecture_symbols(
ARCH mips
SYMBOLS
"__mips"
"__mips__"
"_M_MRX000")
detect_architecture_symbols(
ARCH mips
SYMBOLS
"__mips"
"__mips__"
"_M_MRX000")
detect_architecture_symbols(
ARCH ppc64
SYMBOLS
"__ppc64__"
"__powerpc64__"
"_ARCH_PPC64"
"_M_PPC64")
detect_architecture_symbols(
ARCH ppc64
SYMBOLS
"__ppc64__"
"__powerpc64__"
"_ARCH_PPC64"
"_M_PPC64")
detect_architecture_symbols(
ARCH ppc
SYMBOLS
"__ppc__"
"__ppc"
"__powerpc__"
"_ARCH_COM"
"_ARCH_PWR"
"_ARCH_PPC"
"_M_MPPC"
"_M_PPC")
detect_architecture_symbols(
ARCH ppc
SYMBOLS
"__ppc__"
"__ppc"
"__powerpc__"
"_ARCH_COM"
"_ARCH_PWR"
"_ARCH_PPC"
"_M_MPPC"
"_M_PPC")
detect_architecture_symbols(
ARCH sparc64
SYMBOLS
"__sparc_v9__")
detect_architecture_symbols(
ARCH sparc64
SYMBOLS
"__sparc_v9__")
detect_architecture_symbols(
ARCH sparc
SYMBOLS
"__sparc__"
"__sparc")
detect_architecture_symbols(
ARCH sparc
SYMBOLS
"__sparc__"
"__sparc")
# I don't actually know about loongarch32 since crossdev does not support it, only 64
detect_architecture_symbols(
ARCH loongarch64
SYMBOLS
"__loongarch__"
"__loongarch64")
# I don't actually know about loongarch32 since crossdev does not support it, only 64
detect_architecture_symbols(
ARCH loongarch64
SYMBOLS
"__loongarch__"
"__loongarch64")
detect_architecture_symbols(
ARCH wasm
SYMBOLS
"__EMSCRIPTEN__")
detect_architecture_symbols(
ARCH wasm
SYMBOLS
"__EMSCRIPTEN__")
# "generic" target
# If you have reached this point, you're on some as-of-yet unsupported architecture.
# See the docs up above for known unsupported architectures
# If you're not in the list... I think you know what you're doing.
if (NOT DEFINED ARCHITECTURE)
set(ARCHITECTURE "GENERIC")
set(ARCHITECTURE_GENERIC 1)
add_definitions(-DARCHITECTURE_GENERIC=1)
endif()
# "generic" target
# If you have reached this point, you're on some as-of-yet unsupported architecture.
# See the docs up above for known unsupported architectures
# If you're not in the list... I think you know what you're doing.
if (NOT DEFINED ARCHITECTURE)
set(ARCHITECTURE "GENERIC")
set(ARCHITECTURE_GENERIC 1)
add_definitions(-DARCHITECTURE_GENERIC=1)
endif()
message(STATUS "[DetectArchitecture] Target architecture: ${ARCHITECTURE}")
set(ARCHITECTURE "${ARCHITECTURE}" PARENT_SCOPE)
set(ARCHITECTURE_${ARCHITECTURE} 1 PARENT_SCOPE)
endfunction()
message(STATUS "[DetectArchitecture] Target architecture: ${ARCHITECTURE}")

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## DetectPlatform ##
@@ -147,5 +147,6 @@ endif()
# awesome
if (PLATFORM_FREEBSD OR PLATFORM_DRAGONFLYBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib")
endif()

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## FasterLinker ##
@@ -12,47 +12,45 @@
- mold (GCC only) - generally does well on GCC
- lld - preferred on clang
- bfd - the final fallback
- If none are found (macOS uses ld.prime, etc) just use the default linker
- If none are found just use the default linker
]]
# This module is based on the work of Yuzu, specifically Liam White,
# and later extended by crueter.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXX_GCC ON)
endif()
option(USE_FASTER_LINKER "Attempt to use a faster linker program" OFF)
find_program(LINKER_BFD bfd)
if (LINKER_BFD)
set(LINKER bfd)
endif()
if (USE_FASTER_LINKER)
macro(find_linker ld)
find_program(LINKER_${ld} ld.${ld})
if (LINKER_${ld})
set(LINKER ${ld})
endif()
endmacro()
find_program(LINKER_LLD lld)
if (LINKER_LLD)
set(LINKER lld)
endif()
find_linker(bfd)
find_linker(lld)
if (CXX_GCC)
find_program(LINKER_MOLD mold)
if (LINKER_MOLD AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
set(LINKER mold)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
find_program(LINKER_MOLD mold)
if (LINKER_MOLD AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
set(LINKER mold)
endif()
find_linker(gold)
if (LINKER STREQUAL "lld")
message(WARNING
"[FasterLinker] Using lld on GCC may cause issues.\
Install mold, gold, or disable USE_FASTER_LINKER.")
endif()
endif()
find_program(LINKER_GOLD gold)
if (LINKER_GOLD)
set(LINKER gold)
if (LINKER)
message(NOTICE "[FasterLinker] Selecting ${LINKER} as linker")
add_link_options("-fuse-ld=${LINKER}")
else()
message(WARNING "[FasterLinker] No faster linker found--using default")
endif()
endif()
if (LINKER)
message(NOTICE "[FasterLinker] Selecting ${LINKER} as linker")
add_link_options("-fuse-ld=${LINKER}")
else()
message(WARNING "[FasterLinker] No faster linker found--using default")
endif()
if (LINKER STREQUAL "lld" AND CXX_GCC)
message(WARNING
"[FasterLinker] Using lld on GCC may cause issues "
"with certain LTO settings.")
endif()
endif()

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## GetSCMRev ##
# Name is self explanatory. Gets revision information from files, OR from git.
@@ -13,6 +13,8 @@ find_package(Git QUIET)
# tag: git describe --tags --abbrev=0
# branch: git rev-parse --abbrev-ref=HEAD
# TODO: string overrides
function(run_git_command variable)
if(NOT GIT_FOUND)
set(${variable} "GIT-NOTFOUND" PARENT_SCOPE)

View File

@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## UseCcache ##

View File

@@ -1,17 +1,21 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LGPL-3.0-or-later
## UseLTO ##
# Enable Interprocedural Optimization (IPO).
# Self-explanatory.
include(CheckIPOSupported)
check_ipo_supported(RESULT COMPILER_SUPPORTS_LTO)
if(NOT COMPILER_SUPPORTS_LTO)
message(FATAL_ERROR
"Your compiler does not support interprocedural optimization"
" (IPO).")
endif()
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${COMPILER_SUPPORTS_LTO})
option(ENABLE_LTO "Enable Link-Time Optimization (LTO)" OFF)
if (ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT COMPILER_SUPPORTS_LTO)
if(NOT COMPILER_SUPPORTS_LTO)
message(FATAL_ERROR
"Your compiler does not support interprocedural optimization"
" (IPO). Disable ENABLE_LTO and try again.")
endif()
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${COMPILER_SUPPORTS_LTO})
endif()

View File

@@ -23,7 +23,7 @@
"package": "sirit",
"name": "sirit",
"repo": "eden-emulator/sirit",
"version": "1.0.3"
"version": "1.0.4"
},
"httplib": {
"repo": "yhirose/cpp-httplib",
@@ -225,5 +225,57 @@
"hash": "e87ec14ed3e826d578ebf095c41580069dda603792ba91efa84f45f4571a28f4d91889675055fd6f042d7dc25b0b9443daf70963ae463e38b11bcba95f4c65a9",
"version": "1.7",
"find_args": "MODULE"
},
"biscuit": {
"repo": "lioncash/biscuit",
"tag": "v%VERSION%",
"hash": "1229f345b014f7ca544dedb4edb3311e41ba736f9aa9a67f88b5f26f3c983288c6bb6cdedcfb0b8a02c63088a37e6a0d7ba97d9c2a4d721b213916327cffe28a",
"version": "0.9.1",
"git_version": "0.19.0"
},
"mcl": {
"version": "0.1.12",
"repo": "azahar-emu/mcl",
"sha": "7b08d83418",
"hash": "9c6ba624cb22ef622f78046a82abb99bf5026284ba17dfacaf46ac842cbd3b0f515f5ba45a1598c7671318a78a2e648db72ce8d10e7537f34e39800bdcb57694",
"options": [
"MCL_INSTALL OFF"
],
"patches": [
"0001-assert-macro.patch"
]
},
"libusb": {
"repo": "libusb/libusb",
"tag": "v%VERSION%",
"hash": "98c5f7940ff06b25c9aa65aa98e23de4c79a4c1067595f4c73cc145af23a1c286639e1ba11185cd91bab702081f307b973f08a4c9746576dc8d01b3620a3aeb5",
"find_args": "MODULE",
"git_version": "1.0.29",
"patches": [
"0001-netbsd-gettime.patch"
]
},
"ffmpeg": {
"repo": "FFmpeg/FFmpeg",
"sha": "5e56937b74",
"hash": "9ab0457dcd6ce6359b5053c1662f57910d332f68ca0cca9d4134d858464840917027374de3d97e0863c3a7daaea2fe4f4cd17d1c6d8e7f740f4ad91e71c2932b",
"bundled": true
},
"ffmpeg-ci": {
"ci": true,
"package": "FFmpeg",
"name": "ffmpeg",
"repo": "crueter-ci/FFmpeg",
"version": "8.0.1-5e56937b74",
"min_version": "4.1"
},
"tzdb": {
"package": "nx_tzdb",
"repo": "misc/tzdb_to_nx",
"git_host": "git.crueter.xyz",
"artifact": "%VERSION%.tar.gz",
"tag": "%VERSION%",
"hash": "dc37a189a44ce8b5c988ca550582431a6c7eadfd3c6e709bee6277116ee803e714333e85c9e6cbb5c69346a14d6f2cc7ed96e8aa09cc5fb8a89f945059651db6",
"version": "121125"
}
}

View File

@@ -4,8 +4,6 @@
# SPDX-FileCopyrightText: 2021 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
include(CPMUtil)
# TODO(crueter, MaranBr): Externals FFmpeg 8.0
set(FFmpeg_HWACCEL_LIBRARIES)

View File

@@ -1,16 +0,0 @@
{
"ffmpeg": {
"repo": "FFmpeg/FFmpeg",
"sha": "5e56937b74",
"hash": "9ab0457dcd6ce6359b5053c1662f57910d332f68ca0cca9d4134d858464840917027374de3d97e0863c3a7daaea2fe4f4cd17d1c6d8e7f740f4ad91e71c2932b",
"bundled": true
},
"ffmpeg-ci": {
"ci": true,
"package": "FFmpeg",
"name": "ffmpeg",
"repo": "crueter-ci/FFmpeg",
"version": "8.0.1-5e56937b74",
"min_version": "4.1"
}
}

View File

@@ -4,8 +4,6 @@
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
include(CPMUtil)
AddJsonPackage(libusb)
if (NOT libusb_ADDED)

View File

@@ -1,12 +0,0 @@
{
"libusb": {
"repo": "libusb/libusb",
"tag": "v%VERSION%",
"hash": "98c5f7940ff06b25c9aa65aa98e23de4c79a4c1067595f4c73cc145af23a1c286639e1ba11185cd91bab702081f307b973f08a4c9746576dc8d01b3620a3aeb5",
"find_args": "MODULE",
"git_version": "1.0.29",
"patches": [
"0001-netbsd-gettime.patch"
]
}
}

View File

@@ -4,8 +4,6 @@
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
include(CPMUtil)
set(NX_TZDB_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
add_library(nx_tzdb INTERFACE)

View File

@@ -1,11 +0,0 @@
{
"tzdb": {
"package": "nx_tzdb",
"repo": "misc/tzdb_to_nx",
"git_host": "git.crueter.xyz",
"artifact": "%VERSION%.tar.gz",
"tag": "%VERSION%",
"hash": "dc37a189a44ce8b5c988ca550582431a6c7eadfd3c6e709bee6277116ee803e714333e85c9e6cbb5c69346a14d6f2cc7ed96e8aa09cc5fb8a89f945059651db6",
"version": "121125"
}
}

View File

@@ -16,6 +16,10 @@ endif()
set_property(DIRECTORY APPEND PROPERTY
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
if (YUZU_STATIC_BUILD)
add_compile_definitions(QT_STATICPLUGIN)
endif()
# Set compilation flags
if (MSVC AND NOT CXX_CLANG)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
@@ -169,25 +173,19 @@ else()
add_compile_definitions(_FILE_OFFSET_BITS=64)
endif()
if (YUZU_STATIC_BUILD)
add_compile_definitions(QT_STATICPLUGIN)
# macos doesn't even let you make static executables... wtf?
if (NOT APPLE)
add_compile_options(-static)
if (YUZU_STATIC_BUILD)
# yuzu-cmd requires us to explicitly link libpthread, libgcc, and libstdc++ as static
# At a guess, it's probably because Qt handles the Qt executable for us, whereas this does not
add_link_options(-static -lpthread)
add_link_options(-static-libgcc -static-libstdc++)
endif()
if (YUZU_STATIC_BUILD AND NOT APPLE)
add_compile_options(-static)
if (YUZU_STATIC_BUILD)
# yuzu-cmd requires us to explicitly link libpthread, libgcc, and libstdc++ as static
add_link_options(-static -lpthread)
add_link_options(-static-libgcc -static-libstdc++)
endif()
endif()
if (MINGW)
add_compile_definitions(MINGW_HAS_SECURE_API)
# Only windows has this requirement, thanks windows
# Only windows has this requirement
if (WIN32 AND ARCHITECTURE_x86_64)
add_compile_options("-msse4.1")
endif()

View File

@@ -38,7 +38,6 @@ CMAKE_DEPENDENT_OPTION(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 c
option(DYNARMIC_INSTALL "Install dynarmic headers and CMake files" OFF)
option(DYNARMIC_USE_BUNDLED_EXTERNALS "Use all bundled externals (useful when e.g. cross-compiling)" OFF)
option(DYNARMIC_ENABLE_LTO "Enable LTO" OFF)
# Set hard requirements for C++
set(CMAKE_CXX_STANDARD 20)
@@ -115,10 +114,6 @@ endif()
find_package(Boost 1.57 REQUIRED)
find_package(fmt 8 CONFIG)
# Pull in externals CMakeLists for libs where available
add_subdirectory(externals)
find_package(mcl 0.1.12 REQUIRED)
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)

View File

@@ -1,34 +0,0 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
include(CPMUtil)
# Always build externals as static libraries, even when dynarmic is built as shared
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
# Allow options shadowing with normal variables when subproject use old cmake policy
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# Disable tests in all externals supporting the standard option name
set(BUILD_TESTING OFF)
# For libraries that already come with a CMakeLists file,
# simply add the directory to that file as a subdirectory
# to have CMake automatically recognize them.
# biscuit
if ("riscv" IN_LIST ARCHITECTURE)
AddJsonPackage(
NAME biscuit
BUNDLED_PACKAGE ${DYNARMIC_USE_BUNDLED_EXTERNALS}
)
endif()
# mcl
AddJsonPackage(
NAME mcl
BUNDLED_PACKAGE ${DYNARMIC_USE_BUNDLED_EXTERNALS}
)

View File

@@ -1,21 +0,0 @@
{
"biscuit": {
"repo": "lioncash/biscuit",
"tag": "v%VERSION%",
"hash": "1229f345b014f7ca544dedb4edb3311e41ba736f9aa9a67f88b5f26f3c983288c6bb6cdedcfb0b8a02c63088a37e6a0d7ba97d9c2a4d721b213916327cffe28a",
"version": "0.9.1",
"git_version": "0.19.0"
},
"mcl": {
"version": "0.1.12",
"repo": "azahar-emu/mcl",
"sha": "7b08d83418",
"hash": "9c6ba624cb22ef622f78046a82abb99bf5026284ba17dfacaf46ac842cbd3b0f515f5ba45a1598c7671318a78a2e648db72ce8d10e7537f34e39800bdcb57694",
"options": [
"MCL_INSTALL OFF"
],
"patches": [
"0001-assert-macro.patch"
]
}
}

View File

@@ -395,7 +395,3 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
endif()
target_compile_definitions(dynarmic PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
if (DYNARMIC_ENABLE_LTO)
set_property(TARGET dynarmic PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

View File

@@ -88,8 +88,7 @@ set(SHADER_FILES
)
if (PLATFORM_HAIKU)
# glslangValidator WILL crash, glslang will not - why? Who the fuck knows
#/boot/home/glslang/build/StandAlone/glslangValidator
# glslangValidator WILL crash, glslang will not
set(GLSLANGVALIDATOR "glslang")
else()
# Normal sane platform who doesn't have a CRASHING glslangValidator

View File

@@ -242,8 +242,7 @@ set_target_properties(yuzu PROPERTIES OUTPUT_NAME "eden")
if (YUZU_CRASH_DUMPS)
target_sources(yuzu PRIVATE
breakpad.cpp
breakpad.h
)
breakpad.h)
target_link_libraries(yuzu PRIVATE libbreakpad_client)
target_compile_definitions(yuzu PRIVATE YUZU_CRASH_DUMPS)
@@ -251,8 +250,7 @@ endif()
if (CXX_CLANG)
target_compile_definitions(yuzu PRIVATE
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>
)
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>)
endif()
file(GLOB COMPAT_LIST
@@ -288,8 +286,7 @@ if (ENABLE_QT_TRANSLATION)
${SRCS}
${UIS}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
${CMAKE_CURRENT_SOURCE_DIR})
else()
qt_create_translation(QM_FILES
${SRCS}
@@ -297,8 +294,7 @@ if (ENABLE_QT_TRANSLATION)
${YUZU_QT_LANGUAGES}/en.ts
OPTIONS
-source-language en_US
-target-language en_US
)
-target-language en_US)
endif()
# Generate plurals into dist/english_plurals/generated_en.ts so it can be used to revise dist/english_plurals/en.ts
@@ -316,8 +312,7 @@ if (ENABLE_QT_TRANSLATION)
${SRCS}
${UIS}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
${CMAKE_CURRENT_SOURCE_DIR})
else()
qt_create_translation(QM_FILES ${SRCS} ${UIS} ${GENERATED_PLURALS_FILE} OPTIONS -pluralonly -source-language en_US -target-language en_US)
endif()
@@ -355,8 +350,11 @@ target_sources(yuzu
${COMPAT_LIST}
${ICONS}
${LANGUAGES}
${THEMES}
)
${THEMES})
if (ENABLE_OPENSSL)
target_link_libraries(yuzu PRIVATE OpenSSL::SSL OpenSSL::Crypto)
endif()
if (APPLE)
# Normal icns

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
##################################
@@ -9,6 +9,14 @@
# TODO: cache cpmfile defs
must_install() {
for cmd in "$@"; do
command -v "$cmd" >/dev/null 2>&1 || { echo "-- $cmd must be installed" && exit 1; }
done
}
must_install jq find mktemp tar 7z unzip sha512sum git patch curl xargs
# How many levels to go (3 is 2 subdirs max)
MAXDEPTH=3

View File

@@ -1,11 +1,10 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
SUBMODULES="$(git submodule status --recursive | cut -c2-)"
[ -z "$SUBMODULES" ] && echo "No submodules defined!" && exit 0
: "${SUBMODULES:?No submodules defined!}"
tmp=$(mktemp)
printf '{}' >"$tmp"
@@ -22,7 +21,7 @@ for i in $SUBMODULES; do
remote=$(git -C "$path" remote get-url origin)
host=$(echo "$remote" | cut -d"/" -f3)
[ "$host" = github.com ] && host=
[ "$host" != github.com ] || host=
repo=$(echo "$remote" | cut -d"/" -f4-5 | cut -d'.' -f1)

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@@ -31,48 +31,12 @@ export SCRIPTS
while :; do
case "$1" in
hash)
hash | update | fetch | add | rm | version | which | download)
cmd="$1"
shift
"$SCRIPTS"/hash.sh "$@"
"$SCRIPTS/$cmd".sh "$@"
break
;;
update)
shift
"$SCRIPTS"/update.sh "$@"
break
;;
fetch)
shift
"$SCRIPTS"/fetch.sh "$@"
break
;;
add)
shift
"$SCRIPTS"/add.sh "$@"
break
;;
rm)
shift
"$SCRIPTS"/rm.sh "$@"
break
;;
version)
shift
"$SCRIPTS"/version.sh "$@"
break
;;
which)
shift
"$SCRIPTS"/which.sh "$@"
break
;;
download)
shift
"$SCRIPTS"/download.sh "$@"
break
;;
-h | --help) usage ;;
"") usage ;;
*) usage ;;
esac

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@@ -30,7 +30,7 @@ die() {
}
_cpmfile() {
[ -z "$1" ] && die "You must specify a valid cpmfile."
[ -n "$1" ] || die "You must specify a valid cpmfile."
CPMFILE="$1"
}
@@ -70,7 +70,7 @@ done
: "${CPMFILE:=$PWD/cpmfile.json}"
[ -z "$PKG" ] && die "You must specify a package name."
[ -n "$PKG" ] || die "You must specify a package name."
export PKG
export CPMFILE

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
usage() {
@@ -29,8 +29,8 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ -n "$packages" ] || usage
for pkg in $packages; do
PACKAGE="$pkg"

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
: "${CPM_SOURCE_CACHE:=$PWD/.cache/cpm}"
@@ -73,11 +73,12 @@ download_package() {
}
ci_package() {
[ "$REPO" = null ] && echo "-- ! No repo defined" && return
[ "$REPO" != null ] || echo "-- ! No repo defined" && return
echo "-- CI package $PACKAGE_NAME"
for platform in windows-amd64 windows-arm64 \
for platform in \
windows-amd64 windows-arm64 \
mingw-amd64 mingw-arm64 \
android-aarch64 android-x86_64 \
solaris-amd64 freebsd-amd64 openbsd-amd64 \
@@ -90,7 +91,6 @@ ci_package() {
echo "-- * -- disabled"
continue
;;
*) ;;
esac
FILENAME="${NAME}-${platform}-${VERSION}.${EXT}"
@@ -102,7 +102,7 @@ ci_package() {
[ -d "$OUTDIR" ] && continue
HASH_ALGO=$(echo "$JSON" | jq -r ".hash_algo")
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
[ "$HASH_ALGO" != null ] || HASH_ALGO=sha512
HASH_SUFFIX="${HASH_ALGO}sum"
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}"
@@ -137,8 +137,8 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ -n "$packages" ] || usage
for PACKAGE in $packages; do
export PACKAGE

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@@ -52,9 +52,9 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
[ "$DRY" = 1 ] && UPDATE=false || UPDATE=true
[ -z "$packages" ] && usage
[ -n "$packages" ] || usage
export UPDATE

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
@@ -16,7 +16,7 @@ EOF
exit $RETURN
}
[ $# -lt 1 ] && usage
[ $# -ge 1 ] || usage
for pkg in "$@"; do
JSON=$("$SCRIPTS"/which.sh "$pkg") || {

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
filter_out() {
@@ -37,13 +37,13 @@ while :; do
case "$char" in
a) ALL=1 ;;
n) DRY=1 ;;
n) UPDATE=false ;;
h) usage ;;
*) die "Invalid option -$char" ;;
esac
done
;;
--dry-run) DRY=1 ;;
--dry-run) UPDATE=false ;;
--all) ALL=1 ;;
--help) usage ;;
"$0") break ;;
@@ -54,9 +54,9 @@ while :; do
shift
done
[ "$ALL" = 1 ] && packages="${LIBS:-$packages}"
[ "$DRY" = 1 ] && UPDATE=false || UPDATE=true
[ -z "$packages" ] && usage
[ "$ALL" != 1 ] || packages="${LIBS:-$packages}"
: "${UPDATE:=true}"
[ -n "$packages" ] || usage
for pkg in $packages; do
PACKAGE="$pkg"
@@ -66,15 +66,15 @@ for pkg in $packages; do
SKIP=$(value "skip_updates")
[ "$SKIP" = "true" ] && continue
[ "$SKIP" != "true" ] || continue
[ "$REPO" = null ] && continue
[ "$GIT_HOST" != "github.com" ] && continue # TODO
[ "$REPO" != null ] || continue
[ "$GIT_HOST" = "github.com" ] || continue # TODO
[ "$CI" = "true" ] && continue
[ "$CI" != "true" ] || continue
# shellcheck disable=SC2153
[ "$TAG" = null ] && continue
[ "$TAG" != null ] || continue
echo "-- Package $PACKAGE"
@@ -99,12 +99,15 @@ for pkg in $packages; do
filter_out rc
# Add package-specific overrides here, e.g. here for fmt:
[ "$PACKAGE" = fmt ] && filter_out v0.11
[ "$PACKAGE" != fmt ] || filter_out v0.11
LATEST=$(echo "$TAGS" | jq -r '.[0].name')
[ "$LATEST" = "null" ] && echo "-- * Up-to-date" && continue
[ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ] && echo "-- * Up-to-date" && continue
if [ "$LATEST" = "null" ] ||
{ [ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ]; }; then
echo "-- * Up-to-date"
continue
fi
if [ "$HAS_REPLACE" = "true" ]; then
# this just extracts the tag prefix

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
: "${PACKAGE:=$1}"
@@ -13,7 +13,7 @@
[ "$HASH_URL" = null ] || exit 0
[ "$HASH_SUFFIX" = null ] || exit 0
[ "$HASH" = null ] && echo "-- * Package has no hash specified" && exit 0
[ "$HASH" != null ] || { echo "-- * Package has no hash specified" && exit 0; }
ACTUAL=$("$SCRIPTS"/util/url-hash.sh "$DOWNLOAD")

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# This reads a single-line input from the user and also gives them
@@ -13,7 +13,7 @@
read_single() {
while :; do
printf -- "-- %s" "$1"
[ -n "$2" ] && printf " (? for help, %s)" "$3"
[ -z "$2" ] || printf " (? for help, %s)" "$3"
printf ": "
if ! IFS= read -r reply; then
echo
@@ -113,7 +113,7 @@ tag v1.3.0, then set this to 1.3.0 and set the tag to v%VERSION%."
"Most commonly this will be something like v%VERSION% or release-%VERSION%, or just %VERSION%."
TAGNAME="$reply"
[ -z "$TAGNAME" ] && TAGNAME="%VERSION%"
[ -n "$TAGNAME" ] || TAGNAME="%VERSION%"
optional "Name of the release artifact to download, if applicable.
-- %VERSION% is replaced by the numeric version and %TAG% is replaced by the tag name" \
@@ -160,9 +160,9 @@ fi
jq_input='{repo: "'"$REPO"'"}'
# common trivial fields
[ -n "$PACKAGE" ] && jq_input="$jq_input + {package: \"$PACKAGE\"}"
[ -n "$MIN_VERSION" ] && jq_input="$jq_input + {min_version: \"$MIN_VERSION\"}"
[ -n "$FIND_ARGS" ] && jq_input="$jq_input + {find_args: \"$FIND_ARGS\"}"
[ -z "$PACKAGE" ] || jq_input="$jq_input + {package: \"$PACKAGE\"}"
[ -z "$MIN_VERSION" ] || jq_input="$jq_input + {min_version: \"$MIN_VERSION\"}"
[ -z "$FIND_ARGS" ] || jq_input="$jq_input + {find_args: \"$FIND_ARGS\"}"
if [ "$CI" = "true" ]; then
jq_input="$jq_input + {
@@ -177,7 +177,7 @@ if [ "$CI" = "true" ]; then
jq_input="$jq_input + {disabled_platforms: $disabled_json}"
fi
else
[ -n "$MIN_VERSION" ] && jq_input="$jq_input + {version: \"$MIN_VERSION\"}"
[ -z "$MIN_VERSION" ] || jq_input="$jq_input + {version: \"$MIN_VERSION\"}"
jq_input="$jq_input + {hash: \"\"}"
# options
@@ -194,8 +194,8 @@ else
# versioning stuff
if [ -n "$GIT_VERSION" ]; then
jq_input="$jq_input + {git_version: \"$GIT_VERSION\"}"
[ -n "$TAGNAME" ] && jq_input="$jq_input + {tag: \"$TAGNAME\"}"
[ -n "$ARTIFACT" ] && jq_input="$jq_input + {artifact: \"$ARTIFACT\"}"
[ -z "$TAGNAME" ] || jq_input="$jq_input + {tag: \"$TAGNAME\"}"
[ -z "$ARTIFACT" ] || jq_input="$jq_input + {artifact: \"$ARTIFACT\"}"
else
jq_input="$jq_input + {sha: \"$SHA\"}"
fi

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@@ -9,12 +9,15 @@ value() {
echo "$JSON" | jq -r ".$1"
}
[ -z "$PACKAGE" ] && echo "Package was not specified" && exit 0
[ -n "$PACKAGE" ] || { echo "Package was not specified" && exit 0; }
# shellcheck disable=SC2153
JSON=$(echo "$PACKAGES" | jq -r ".\"$PACKAGE\" | select( . != null )")
[ -z "$JSON" ] && echo "!! No cpmfile definition for $PACKAGE" >&2 && exit 1
if [ -z "$JSON" ]; then
echo "!! No cpmfile definition for $PACKAGE" >&2
exit 1
fi
# unset stuff
export PACKAGE_NAME="null"
@@ -48,10 +51,10 @@ REPO=$(value "repo")
CI=$(value "ci")
PACKAGE_NAME=$(value "package")
[ "$PACKAGE_NAME" = null ] && PACKAGE_NAME="$PACKAGE"
[ "$PACKAGE_NAME" != null ] || PACKAGE_NAME="$PACKAGE"
GIT_HOST=$(value "git_host")
[ "$GIT_HOST" = null ] && GIT_HOST=github.com
[ "$GIT_HOST" != null ] || GIT_HOST=github.com
export PACKAGE_NAME
export REPO
@@ -66,12 +69,12 @@ VERSION=$(value "version")
if [ "$CI" = "true" ]; then
EXT=$(value "extension")
[ "$EXT" = null ] && EXT="tar.zst"
[ "$EXT" != null ] || EXT="tar.zst"
NAME=$(value "name")
DISABLED=$(echo "$JSON" | jq -j '.disabled_platforms')
[ "$NAME" = null ] && NAME="$PACKAGE_NAME"
[ "$NAME" != null ] || NAME="$PACKAGE_NAME"
export EXT
export NAME
@@ -90,7 +93,7 @@ ARTIFACT=$(value "artifact")
SHA=$(value "sha")
GIT_VERSION=$(value "git_version")
[ "$GIT_VERSION" = null ] && GIT_VERSION="$VERSION"
[ "$GIT_VERSION" != null ] || GIT_VERSION="$VERSION"
if [ "$GIT_VERSION" != null ]; then
VERSION_REPLACE="$GIT_VERSION"
@@ -98,8 +101,11 @@ else
VERSION_REPLACE="$VERSION"
fi
echo "$TAG" | grep -e "%VERSION%" >/dev/null &&
HAS_REPLACE=true || HAS_REPLACE=false
if echo "$TAG" | grep -e "%VERSION%" >/dev/null; then
HAS_REPLACE=true
else
HAS_REPLACE=false
fi
ORIGINAL_TAG="$TAG"
@@ -145,7 +151,7 @@ export KEY
################
HASH_ALGO=$(value "hash_algo")
[ "$HASH_ALGO" = null ] && HASH_ALGO=sha512
[ "$HASH_ALGO" != null ] || HASH_ALGO=sha512
HASH=$(value "hash")

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@@ -20,14 +20,14 @@ EOF
PACKAGE="$1"
NEW_VERSION="$2"
[ -z "$PACKAGE" ] && usage
[ -z "$NEW_VERSION" ] && usage
[ -n "$PACKAGE" ] || usage
[ -n "$NEW_VERSION" ] || usage
export PACKAGE
. "$SCRIPTS"/vars.sh
[ "$REPO" = null ] && exit 0
[ "$REPO" != null ] || exit 0
if [ "$HAS_REPLACE" = "true" ]; then
# this just extracts the tag prefix
@@ -54,7 +54,7 @@ fi
echo "-- * -- Updating $PACKAGE to version $NEW_VERSION"
"$SCRIPTS"/util/replace.sh "$PACKAGE" "$NEW_JSON"
[ "$CI" = "true" ] && exit 0
[ "$CI" != "true" ] || exit 0
echo "-- * -- Fixing hash"
. "$ROOTDIR"/common.sh
UPDATE=true QUIET=true "$SCRIPTS"/util/fix-hash.sh

View File

@@ -1,12 +1,12 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# check which file a package is in
JSON=$(echo "$CPMFILES" | xargs grep -l "\"$1\"")
[ -z "$JSON" ] && echo "!! No cpmfile definition for $1" >&2 && exit 1
[ -n "$JSON" ] || { echo "!! No cpmfile definition for $1" >&2 && exit 1; }
echo "$JSON"

View File

@@ -1,16 +1,19 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# updates CPMUtil, its docs, and related tools from the latest release
if command -v zstd >/dev/null; then
if command -v zstd >/dev/null 2>&1; then
EXT=tar.zst
else
EXT=tar.gz
fi
wget "https://git.crueter.xyz/CMake/CPMUtil/releases/download/continuous/CPMUtil.$EXT"
tar xf "CPMUtil.$EXT"
rm "CPMUtil.$EXT"
file=CPMUtil.$EXT
url="https://git.crueter.xyz/CMake/CPMUtil/releases/download/continuous/$file"
curl -L "$url" -o "$file"
tar xf "$file"
rm "$file"

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
@@ -49,26 +49,18 @@ export ROOTDIR
while :; do
case "$1" in
-h | --help) usage ;;
ls)
echo "$CPMFILES" | tr ' ' '\n'
break
;;
format)
"$SCRIPTS"/format.sh
break
;;
update)
"$SCRIPTS"/update.sh
break
;;
migrate)
"$SCRIPTS"/migrate.sh
format | update | migrate)
"$SCRIPTS/$1".sh
break
;;
package)
cmd="$1"
shift
"$SCRIPTS"/package.sh "$@"
"$SCRIPTS/$cmd".sh "$@"
break
;;
*) usage ;;