Compare commits

...

4 Commits

Author SHA1 Message Date
crueter b79f2d0d1c Formatting
Signed-off-by: crueter <crueter@eden-emu.dev>
2026-07-10 00:57:36 -04:00
crueter ef28a394db Fix common build
Signed-off-by: crueter <crueter@eden-emu.dev>
2026-07-09 23:44:58 -04:00
crueter 8ba132c927 WIP: [cmake] Use a debloated boost distribution
Should speed up fetch time

Signed-off-by: crueter <crueter@eden-emu.dev>
2026-07-09 19:37:50 -04:00
crueter cd003e5ec9 [cmake] Fix CPMUtil on Windows by avoiding a temp dir (#4195)
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4195
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
2026-07-10 01:21:17 +02:00
6 changed files with 87 additions and 119 deletions
-13
View File
@@ -1,13 +0,0 @@
diff --git a/libs/cobalt/include/boost/cobalt/concepts.hpp b/libs/cobalt/include/boost/cobalt/concepts.hpp
index d49f2ec..a9bdb80 100644
--- a/libs/cobalt/include/boost/cobalt/concepts.hpp
+++ b/libs/cobalt/include/boost/cobalt/concepts.hpp
@@ -62,7 +62,7 @@ struct enable_awaitables
template <typename T>
concept with_get_executor = requires (T& t)
{
- {t.get_executor()} -> asio::execution::executor;
+ t.get_executor();
};
+3 -7
View File
@@ -417,12 +417,9 @@ AddJsonPackage(boost)
set(BOOST_NO_HEADERS ${Boost_ADDED})
if (Boost_ADDED)
if (MSVC OR ANDROID)
add_compile_definitions(YUZU_BOOST_v1)
endif()
add_compile_definitions(YUZU_BOOST_v1)
if (NOT MSVC OR CXX_CLANG)
# boost sucks
# solaris sucks
if (PLATFORM_SUN)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-pthreads>)
endif()
@@ -431,8 +428,7 @@ if (Boost_ADDED)
target_compile_options(boost_icl INTERFACE $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-shadow>)
target_compile_options(boost_asio INTERFACE
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-conversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-fallthrough>
)
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-fallthrough>)
endif()
endif()
+35 -89
View File
@@ -95,7 +95,7 @@ macro(echo)
execute_process(COMMAND ${CMAKE_COMMAND} -E echo
"${message}")
else()
message(STATUS "${message}")
message(DEBUG "${message}")
endif()
endmacro()
@@ -120,47 +120,6 @@ macro(sleep time)
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${time})
endmacro()
# Analogous to GNU mktemp, with fallbacks
function(mktempdir out)
# shell out to system mktemp if available
find_program(MKTEMP_EXECUTABLE mktemp)
if (MKTEMP_EXECUTABLE)
execute_process(COMMAND mktemp -d
OUTPUT_VARIABLE dir
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE ret)
if (ret EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
endif()
string(RANDOM LENGTH 10 rand_str)
set(tmp_str "tmp.${rand_str}")
# create something in /tmp if it exists
if(EXISTS "/tmp" AND IS_DIRECTORY "/tmp")
set(dir "/tmp/${tmp_str}")
file(MAKE_DIRECTORY "${dir}" RESULT res)
if (res EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
endif()
# tmpdir does not exist, extremely legacy mode
set(dir "${CMAKE_CURRENT_LIST_DIR}/.tmp/${tmp_str}")
file(MAKE_DIRECTORY "${dir}" RESULT res)
if (res EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
fatal("Fatal: Could not create temporary directory. "
"Check write permissions to the current directory")
endfunction()
# Get a package's effective URL.
function(get_package_url)
set(oneValueArgs
@@ -218,6 +177,7 @@ endfunction()
# Download a URL to file, with a sha512 hash
# And retry 5 times
function(cpm_download url file)
echo("Downloading ${url} to ${file}")
list(LENGTH ARGN argn_len)
if(argn_len GREATER 0)
list(GET ARGN 0 hash)
@@ -229,8 +189,7 @@ function(cpm_download url file)
foreach(i RANGE 5)
file(DOWNLOAD ${url} ${file}
${args}
STATUS ret
LOG log)
STATUS ret)
list(GET ret 0 code)
if (code EQUAL 0)
@@ -339,60 +298,47 @@ function(fetch_package)
return()
endif()
# Temporary directory.
mktempdir(TMP)
# Get filename from URL
get_filename_component(base_filename ${ARG_URL} NAME)
# Download
set(file ${TMP}/${base_filename})
cpm_download(${ARG_URL} ${file} ${ARG_HASH})
message(DEBUG "Downloaded ${base_filename}")
# Extract the downloaded archive
# TODO: Moar error handling
set(dir ${TMP}/${base_filename}-extracted)
file(MAKE_DIRECTORY ${dir})
file(ARCHIVE_EXTRACT
INPUT ${file}
DESTINATION ${dir})
# This is copied near-verbatim from ExternalProject/extractfile.cmake.in
# If there's just one subdirectory and nothing else, move it
file(GLOB contents "${dir}/*")
list(REMOVE_ITEM contents "${dir}/.DS_Store")
list(LENGTH contents n)
# If n == 1 and contents points to a directory, this is a GitHub-style pack
# In this case contents points to the subdir which will get renamed
# If not, contents will point to the parent dir which will get renamed
if (NOT n EQUAL 1 OR NOT IS_DIRECTORY "${contents}")
set(contents "${dir}")
endif()
file(REAL_PATH "${contents}" contents_abs)
# paths
cmake_path(ABSOLUTE_PATH ARG_PATH
NORMALIZE
OUTPUT_VARIABLE abs_path)
cmake_path(GET abs_path PARENT_PATH path_parent)
cmake_path(GET abs_path FILENAME path_name)
file(MAKE_DIRECTORY ${path_parent})
# rename tmp dir
set(tmp_renamed "${TMP}/${path_name}")
file(RENAME "${contents_abs}" "${tmp_renamed}")
# Get filename from URL
get_filename_component(base_filename ${ARG_URL} NAME)
# now copy
# TODO: Error handling beyond what cmake does????
file(COPY ${tmp_renamed} DESTINATION ${path_parent})
# Download
set(file ${path_parent}/${base_filename})
cpm_download(${ARG_URL} ${file} ${ARG_HASH})
echo("Downloaded ${base_filename}")
# Extract
echo("Extracting ${file}...")
file(ARCHIVE_EXTRACT
INPUT ${file}
DESTINATION ${abs_path})
# This is copied near-verbatim from ExternalProject/extractfile.cmake.in
# If there's just one subdirectory and nothing else, move it
file(GLOB contents "${abs_path}/*")
list(REMOVE_ITEM contents "${abs_path}/.DS_Store")
list(LENGTH contents n)
# If n == 1 and contents points to a directory, this is a GitHub-style pack
# In this case contents points to the subdir which will get renamed
# If not, contents will point to the parent dir which will get renamed
if (n EQUAL 1 AND IS_DIRECTORY "${contents}")
set(temp_path "${abs_path}_tmp")
file(RENAME "${contents}" "${temp_path}")
file(REMOVE_RECURSE "${abs_path}")
file(RENAME "${temp_path}" "${abs_path}")
endif()
# TODO: only echo this in script mode
message(DEBUG "Extracted to ${abs_path}")
echo("Extracted to ${abs_path}")
# Apply patches
apply_patches("${ARG_PATCHES}" "${abs_path}")
@@ -401,7 +347,7 @@ function(fetch_package)
file(WRITE "${abs_path}/.cpm_patch_key" ${ARG_PATCH_KEY})
# done! :)
file(REMOVE_RECURSE ${TMP})
file(REMOVE_RECURSE ${file})
endfunction()
# compute a hash of all patch file contents
+6 -9
View File
@@ -6,22 +6,19 @@
"version": "v0.19.0"
},
"boost": {
"artifact": "%VERSION%-cmake.tar.xz",
"artifact": "boost-%VERSION%.tar.zst",
"find_args": "CONFIG OPTIONAL_COMPONENTS headers context system fiber filesystem",
"hash": "6ae6e94664fe7f2fb01976b59b276ac5df8085c7503fa829d810fbfe495960cfec44fa2c36e2cb23480bc19c956ed199d4952b02639a00a6c07625d4e7130c2d",
"hash": "077ad58b3d336041c05ad5f2b1de7db9fe1d35af3da85cd99496c35ddeca080ecd0ae5c8058319077bda892361b38624d89f70bc9bfec6713aae2aabc17f2a43",
"min_version": "1.57",
"package": "Boost",
"patches": [
"0001-clang-cl.patch"
],
"repo": "boostorg/boost",
"version": "boost-1.90.0"
"repo": "eden-emulator/ext-boost",
"version": "1.91.0-1"
},
"boost_headers": {
"bundled": true,
"hash": "4ef845775e2277a8104ded6ddf749aa262ce52cf8438042869a048f9a0156dd772fbbcfa74efa1378fecef339b7286f6fe4b4feb5c45d49966b35d08e3e83507",
"hash": "c5fa2cd72f6e6666b7963b97bc359c75284b8fb540c30f3629a028b85270c9bc66c8a051383964f2bd4c1e005a4691593d15696e7ef39ea87cf6cff9e5691fb2",
"repo": "boostorg/headers",
"version": "boost-1.90.0"
"version": "boost-1.91.0"
},
"catch2": {
"hash": "7eea385d79d88a5690cde131fe7ccda97d5c54ea09d6f515000d7bf07c828809d61c1ac99912c1ee507cf933f61c1c47ecdcc45df7850ffa82714034b0fccf35",
+42
View File
@@ -19,6 +19,48 @@ macro(parse_key key)
parse_object(${object})
endmacro()
# Analogous to GNU mktemp, with fallbacks
function(mktempdir out)
# shell out to system mktemp if available
cpm_find_program(MKTEMP_EXECUTABLE mktemp)
if (MKTEMP_EXECUTABLE)
execute_process(COMMAND mktemp -d
OUTPUT_VARIABLE dir
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE ret)
if (ret EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
endif()
string(RANDOM LENGTH 10 rand_str)
set(tmp_str "tmp.${rand_str}")
# create something in /tmp if it exists
if(EXISTS "/tmp" AND IS_DIRECTORY "/tmp")
set(dir "/tmp/${tmp_str}")
file(MAKE_DIRECTORY "${dir}" RESULT res)
if (res EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
endif()
# tmpdir does not exist, extremely legacy mode
set(dir "${CMAKE_CURRENT_LIST_DIR}/.tmp/${tmp_str}")
file(MAKE_DIRECTORY "${dir}" RESULT res)
if (res EQUAL 0)
set(${out} "${dir}" PARENT_SCOPE)
return()
endif()
fatal("Fatal: Could not create temporary directory. "
"Check write permissions to the current directory")
endfunction()
# Get a package's effective URL, for an already parsed object
function(get_package_url_object out)
if (${url})
+1 -1
View File
@@ -65,7 +65,7 @@ else()
endif()
# update cached cpmfile content
string(JSON cpmfile SET "${cpmfile}" "${key}" "${new_object}")
string(JSON cpmfile SET "${cpmfile}" "${KEY}" "${new_object}")
# write cached cpmfile
get_cpmfile_path(file)