build: Rework CI and move all bundling into new build target. (#6556)
* build: Rework CI and move all bundling into new build target. * ci: Use "mingw" in msys2 release names for compatibility. * ci: Use "osx" in macOS release names for compatibility. * ci: Disable macOS upload. Will be moved to a separate PR for canary merge.
This commit is contained in:
parent
2e479fcec5
commit
2d6aca4563
57 changed files with 614 additions and 967 deletions
|
@ -12,7 +12,7 @@ endif()
|
|||
|
||||
list(APPEND CMAKE_MODULE_PATH "${BASE_DIR}/CMakeModules")
|
||||
include(DownloadExternals)
|
||||
download_qt_external(tools_ifw QT_PREFIX)
|
||||
download_qt(tools_ifw QT_PREFIX)
|
||||
|
||||
file(GLOB_RECURSE INSTALLER_BASE "${QT_PREFIX}/**/installerbase*")
|
||||
file(GLOB_RECURSE BINARY_CREATOR "${QT_PREFIX}/**/binarycreator*")
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
# Bundles libraries with an output executable.
|
||||
# Parameters:
|
||||
# - TYPE: "qt" or "standalone". The type of app to bundle.
|
||||
# - "qt" uses windeployqt/macdeployqt to bundle Qt and other libraries.
|
||||
# - "standalone" copies dependent libraries to a "libs" folder alongside the executable file.
|
||||
# - EXECUTABLE_PATH: Path to the executable binary.
|
||||
|
||||
# TODO: This does not really work fully for Windows yet, some libraries are missing from the output.
|
||||
# TODO: Leaving a basic framework of Windows support here to be iterated on in the future.
|
||||
if (WIN32)
|
||||
message(FATAL_ERROR "Advanced library bundling is not yet supported for Windows.")
|
||||
endif()
|
||||
|
||||
if ("${TYPE}" STREQUAL "qt")
|
||||
get_filename_component(executable_dir ${EXECUTABLE_PATH} DIRECTORY)
|
||||
|
||||
# Bundle dependencies using appropriate Qt tool.
|
||||
if (WIN32)
|
||||
find_program(WINDEPLOYQT_EXECUTABLE windeployqt)
|
||||
execute_process(COMMAND ${WINDEPLOYQT_EXECUTABLE} ${EXECUTABLE_PATH}
|
||||
--no-compiler-runtime --no-system-d3d-compiler --no-opengl-sw --no-translations
|
||||
--plugindir "${executable_dir}/plugins")
|
||||
elseif (APPLE)
|
||||
get_filename_component(contents_dir ${executable_dir} DIRECTORY)
|
||||
get_filename_component(bundle_dir ${contents_dir} DIRECTORY)
|
||||
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt)
|
||||
execute_process(COMMAND ${MACDEPLOYQT_EXECUTABLE} ${bundle_dir} -executable=${EXECUTABLE_PATH} -always-overwrite)
|
||||
|
||||
# Bundling libraries can rewrite path information and break code signatures of system libraries.
|
||||
# Perform an ad-hoc re-signing on the whole app bundle to fix this.
|
||||
execute_process(COMMAND codesign --deep -fs - ${bundle_dir})
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported OS for Qt-based library bundling.")
|
||||
endif()
|
||||
else()
|
||||
# Resolve dependent library files.
|
||||
file(GET_RUNTIME_DEPENDENCIES
|
||||
EXECUTABLES ${EXECUTABLE_PATH}
|
||||
RESOLVED_DEPENDENCIES_VAR resolved_deps
|
||||
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
|
||||
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll")
|
||||
|
||||
# Determine libraries directory.
|
||||
get_filename_component(executable_dir ${EXECUTABLE_PATH} DIRECTORY)
|
||||
if (WIN32)
|
||||
# Same directory since we don't have rpath.
|
||||
set(lib_dir ${executable_dir})
|
||||
else()
|
||||
set(lib_dir ${executable_dir}/libs)
|
||||
endif()
|
||||
|
||||
# Copy library files to bundled output.
|
||||
file(MAKE_DIRECTORY ${lib_dir})
|
||||
foreach (lib_file ${resolved_deps})
|
||||
# Use native copy to turn symlinks into normal files.
|
||||
execute_process(COMMAND cp -L ${lib_file} ${lib_dir})
|
||||
endforeach()
|
||||
|
||||
# Add libs directory to executable rpath where applicable.
|
||||
if (APPLE)
|
||||
execute_process(COMMAND install_name_tool -add_rpath "@loader_path/libs" ${EXECUTABLE_PATH})
|
||||
elseif (UNIX)
|
||||
execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' ${EXECUTABLE_PATH})
|
||||
endif()
|
||||
endif()
|
243
CMakeModules/BundleTarget.cmake
Normal file
243
CMakeModules/BundleTarget.cmake
Normal file
|
@ -0,0 +1,243 @@
|
|||
|
||||
if (BUNDLE_TARGET_EXECUTE)
|
||||
# --- Bundling method logic ---
|
||||
|
||||
function(bundle_qt executable_path)
|
||||
if (WIN32)
|
||||
get_filename_component(executable_parent_dir "${executable_path}" DIRECTORY)
|
||||
find_program(windeployqt_executable windeployqt6)
|
||||
|
||||
# Create a qt.conf file pointing to the app directory.
|
||||
# This ensures Qt can find its plugins.
|
||||
file(WRITE "${executable_parent_dir}/qt.conf" "[Paths]\nprefix = .")
|
||||
|
||||
message(STATUS "Executing windeployqt for executable ${executable_path}")
|
||||
execute_process(COMMAND "${windeployqt_executable}" "${executable_path}"
|
||||
--no-compiler-runtime --no-system-d3d-compiler --no-opengl-sw --no-translations
|
||||
--plugindir "${executable_parent_dir}/plugins")
|
||||
|
||||
# Remove the FFmpeg multimedia plugin as we don't include FFmpeg.
|
||||
# We want to use the Windows media plugin instead, which is also included.
|
||||
file(REMOVE "${executable_parent_dir}/plugins/multimedia/ffmpegmediaplugin.dll")
|
||||
elseif (APPLE)
|
||||
get_filename_component(executable_name "${executable_path}" NAME_WE)
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt6)
|
||||
|
||||
message(STATUS "Executing macdeployqt for executable ${executable_path}")
|
||||
execute_process(
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
|
||||
"${executable_path}"
|
||||
"-executable=${executable_path}/Contents/MacOS/${executable_name}"
|
||||
-always-overwrite)
|
||||
|
||||
# Bundling libraries can rewrite path information and break code signatures of system libraries.
|
||||
# Perform an ad-hoc re-signing on the whole app bundle to fix this.
|
||||
execute_process(COMMAND codesign --deep -fs - "${executable_path}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported OS for Qt bundling.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(bundle_appimage bundle_dir executable_path source_path binary_path linuxdeploy_executable enable_qt)
|
||||
get_filename_component(executable_name "${executable_path}" NAME_WE)
|
||||
set(appdir_path "${binary_path}/AppDir-${executable_name}")
|
||||
|
||||
if (enable_qt)
|
||||
# Find qmake to make sure the plugin uses the right version of Qt.
|
||||
find_program(QMAKE_EXECUTABLE qmake6)
|
||||
|
||||
set(extra_linuxdeploy_env "QMAKE=${QMAKE_EXECUTABLE}")
|
||||
set(extra_linuxdeploy_args --plugin qt)
|
||||
endif()
|
||||
|
||||
message(STATUS "Creating AppDir for executable ${executable_path}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E env
|
||||
${extra_linuxdeploy_env}
|
||||
"${linuxdeploy_executable}"
|
||||
${extra_linuxdeploy_args}
|
||||
--plugin checkrt
|
||||
--executable "${executable_path}"
|
||||
--icon-file "${source_path}/dist/citra.svg"
|
||||
--desktop-file "${source_path}/dist/${executable_name}.desktop"
|
||||
--appdir "${appdir_path}")
|
||||
|
||||
if (enable_qt)
|
||||
set(qt_hook_file "${appdir_path}/apprun-hooks/linuxdeploy-plugin-qt-hook.sh")
|
||||
file(READ "${qt_hook_file}" qt_hook_contents)
|
||||
# Add Cinnamon to list of DEs for GTK3 theming.
|
||||
string(REPLACE
|
||||
"*XFCE*"
|
||||
"*X-Cinnamon*|*XFCE*"
|
||||
qt_hook_contents "${qt_hook_contents}")
|
||||
# Wayland backend crashes due to changed schemas in Gnome 40.
|
||||
string(REPLACE
|
||||
"export QT_QPA_PLATFORMTHEME=gtk3"
|
||||
"export QT_QPA_PLATFORMTHEME=gtk3; export GDK_BACKEND=x11"
|
||||
qt_hook_contents "${qt_hook_contents}")
|
||||
file(WRITE "${qt_hook_file}" "${qt_hook_contents}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Creating AppImage for executable ${executable_path}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E env
|
||||
"OUTPUT=${bundle_dir}/${executable_name}.AppImage"
|
||||
"${linuxdeploy_executable}"
|
||||
--output appimage
|
||||
--appdir "${appdir_path}")
|
||||
endfunction()
|
||||
|
||||
function(bundle_standalone executable_path original_executable_path bundle_library_paths)
|
||||
get_filename_component(executable_parent_dir "${executable_path}" DIRECTORY)
|
||||
|
||||
# Resolve dependent library files if they were not passed in.
|
||||
message(STATUS "Determining runtime dependencies of ${executable_path} using library paths ${bundle_library_paths}")
|
||||
file(GET_RUNTIME_DEPENDENCIES
|
||||
EXECUTABLES ${original_executable_path}
|
||||
RESOLVED_DEPENDENCIES_VAR resolved_deps
|
||||
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
|
||||
DIRECTORIES ${bundle_library_paths}
|
||||
POST_EXCLUDE_REGEXES ".*system32.*")
|
||||
|
||||
if (WIN32)
|
||||
# Same directory since we don't have rpath.
|
||||
set(lib_dir "${executable_parent_dir}")
|
||||
else()
|
||||
set(lib_dir "${executable_parent_dir}/libs")
|
||||
endif()
|
||||
|
||||
# Copy files to bundled output.
|
||||
if (resolved_deps)
|
||||
file(MAKE_DIRECTORY ${lib_dir})
|
||||
foreach (lib_file IN LISTS resolved_deps)
|
||||
message(STATUS "Bundling library ${lib_file}")
|
||||
# Use native copy to turn symlinks into normal files.
|
||||
execute_process(COMMAND cp -L "${lib_file}" "${lib_dir}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Add libs directory to executable rpath where applicable.
|
||||
if (APPLE)
|
||||
execute_process(COMMAND install_name_tool -add_rpath "@loader_path/libs" "${executable_path}")
|
||||
elseif (UNIX)
|
||||
execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' "${executable_path}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# --- Root bundling logic ---
|
||||
|
||||
set(bundle_dir ${BINARY_PATH}/bundle)
|
||||
file(MAKE_DIRECTORY ${bundle_dir})
|
||||
|
||||
# On Linux, always bundle an AppImage.
|
||||
if (DEFINED LINUXDEPLOY)
|
||||
bundle_appimage("${bundle_dir}" "${EXECUTABLE_PATH}" "${SOURCE_PATH}" "${BINARY_PATH}" "${LINUXDEPLOY}" ${BUNDLE_QT})
|
||||
else()
|
||||
message(STATUS "Copying base executable ${EXECUTABLE_PATH} to output directory ${bundle_dir}")
|
||||
file(COPY ${EXECUTABLE_PATH} DESTINATION ${bundle_dir})
|
||||
get_filename_component(bundled_executable_name "${EXECUTABLE_PATH}" NAME)
|
||||
set(bundled_executable_path "${bundle_dir}/${bundled_executable_name}")
|
||||
|
||||
if (BUNDLE_QT)
|
||||
bundle_qt("${bundled_executable_path}")
|
||||
endif()
|
||||
|
||||
if (WIN32 OR NOT BUNDLE_QT)
|
||||
bundle_standalone("${bundled_executable_path}" "${EXECUTABLE_PATH}" "${BUNDLE_LIBRARY_PATHS}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# --- Bundling target creation logic ---
|
||||
|
||||
# Downloads and extracts a linuxdeploy component.
|
||||
function(download_linuxdeploy_component base_dir name executable_name)
|
||||
set(executable_file "${base_dir}/${executable_name}")
|
||||
if (NOT EXISTS "${executable_file}")
|
||||
message(STATUS "Downloading ${executable_name}")
|
||||
file(DOWNLOAD
|
||||
"https://github.com/linuxdeploy/${name}/releases/download/continuous/${executable_name}"
|
||||
"${executable_file}" SHOW_PROGRESS)
|
||||
file(CHMOD "${executable_file}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
get_filename_component(executable_ext "${executable_file}" LAST_EXT)
|
||||
if (executable_ext STREQUAL ".AppImage")
|
||||
message(STATUS "Extracting ${executable_name}")
|
||||
execute_process(
|
||||
COMMAND "${executable_file}" --appimage-extract
|
||||
WORKING_DIRECTORY "${base_dir}")
|
||||
else()
|
||||
message(STATUS "Copying ${executable_name}")
|
||||
file(COPY "${executable_file}" DESTINATION "${base_dir}/squashfs-root/usr/bin/")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Adds a target to the bundle target, packing in required libraries.
|
||||
function(bundle_target target_name)
|
||||
# Create base bundle target if it does not exist.
|
||||
if (NOT TARGET bundle)
|
||||
message(STATUS "Creating base bundle target")
|
||||
|
||||
add_custom_target(bundle)
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/license.txt" "${CMAKE_BINARY_DIR}/bundle/")
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/README.md" "${CMAKE_BINARY_DIR}/bundle/")
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/dist/scripting" "${CMAKE_BINARY_DIR}/bundle/scripting")
|
||||
endif()
|
||||
|
||||
set(BUNDLE_EXECUTABLE_PATH "$<TARGET_FILE:${target_name}>")
|
||||
if (target_name MATCHES ".*qt")
|
||||
set(BUNDLE_QT ON)
|
||||
if (APPLE)
|
||||
# For Qt targets on Apple, expect an app bundle.
|
||||
set(BUNDLE_EXECUTABLE_PATH "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
endif()
|
||||
else()
|
||||
set(BUNDLE_QT OFF)
|
||||
endif()
|
||||
|
||||
# Build a list of library search paths from prefix paths.
|
||||
foreach(prefix_path IN LISTS CMAKE_PREFIX_PATH CMAKE_SYSTEM_PREFIX_PATH)
|
||||
if (WIN32)
|
||||
list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/bin")
|
||||
endif()
|
||||
list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/lib")
|
||||
endforeach()
|
||||
foreach(library_path IN LISTS CMAKE_SYSTEM_LIBRARY_PATH)
|
||||
list(APPEND BUNDLE_LIBRARY_PATHS "${library_path}")
|
||||
endforeach()
|
||||
|
||||
# On Linux, prepare linuxdeploy and any required plugins.
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(LINUXDEPLOY_BASE "${CMAKE_BINARY_DIR}/externals/linuxdeploy")
|
||||
|
||||
# Download plugins first so they don't overwrite linuxdeploy's AppRun file.
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy-plugin-qt" "linuxdeploy-plugin-qt-x86_64.AppImage")
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy-plugin-checkrt" "linuxdeploy-plugin-checkrt-x86_64.sh")
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy" "linuxdeploy-x86_64.AppImage")
|
||||
|
||||
set(EXTRA_BUNDLE_ARGS "-DLINUXDEPLOY=${LINUXDEPLOY_BASE}/squashfs-root/AppRun")
|
||||
endif()
|
||||
|
||||
message(STATUS "Adding ${target_name} to bundle target")
|
||||
|
||||
add_custom_target(bundle-${target_name}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\""
|
||||
"-DBUNDLE_TARGET_EXECUTE=1"
|
||||
"-DTARGET=${target_name}"
|
||||
"-DSOURCE_PATH=${CMAKE_SOURCE_DIR}"
|
||||
"-DBINARY_PATH=${CMAKE_BINARY_DIR}"
|
||||
"-DEXECUTABLE_PATH=${BUNDLE_EXECUTABLE_PATH}"
|
||||
"-DBUNDLE_LIBRARY_PATHS=\"${BUNDLE_LIBRARY_PATHS}\""
|
||||
"-DBUNDLE_QT=${BUNDLE_QT}"
|
||||
${EXTRA_BUNDLE_ARGS}
|
||||
-P "${CMAKE_SOURCE_DIR}/CMakeModules/BundleTarget.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS ${target_name})
|
||||
add_dependencies(bundle bundle-${target_name})
|
||||
endfunction()
|
||||
endif()
|
|
@ -1,6 +0,0 @@
|
|||
function(copy_citra_openssl_deps target_dir)
|
||||
include(WindowsCopyFiles)
|
||||
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
|
||||
windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libcrypto-1_1-x64.dll)
|
||||
windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libssl-1_1-x64.dll)
|
||||
endfunction(copy_citra_openssl_deps)
|
|
@ -1,46 +0,0 @@
|
|||
function(copy_citra_Qt6_deps target_dir)
|
||||
include(WindowsCopyFiles)
|
||||
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
|
||||
set(Qt6_DLL_DIR "${Qt6_DIR}/../../../bin")
|
||||
set(Qt6_PLATFORMS_DIR "${Qt6_DIR}/../../../plugins/platforms/")
|
||||
set(Qt6_MULTIMEDIA_DIR "${Qt6_DIR}/../../../plugins/multimedia/")
|
||||
set(Qt6_STYLES_DIR "${Qt6_DIR}/../../../plugins/styles/")
|
||||
set(Qt6_IMAGEFORMATS_DIR "${Qt6_DIR}/../../../plugins/imageformats/")
|
||||
set(PLATFORMS ${DLL_DEST}plugins/platforms/)
|
||||
set(MULTIMEDIA ${DLL_DEST}plugins/multimedia/)
|
||||
set(STYLES ${DLL_DEST}plugins/styles/)
|
||||
set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/)
|
||||
windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST}
|
||||
icudt*.dll
|
||||
icuin*.dll
|
||||
icuuc*.dll
|
||||
Qt6Core$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Gui$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Widgets$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Concurrent$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Multimedia$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Network$<$<CONFIG:Debug>:d>.*
|
||||
)
|
||||
windows_copy_files(citra-qt ${Qt6_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.*)
|
||||
windows_copy_files(citra-qt ${Qt6_MULTIMEDIA_DIR} ${MULTIMEDIA}
|
||||
windowsmediaplugin$<$<CONFIG:Debug>:d>.*
|
||||
)
|
||||
windows_copy_files(citra-qt ${Qt6_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$<CONFIG:Debug>:d>.*)
|
||||
windows_copy_files(${target_dir} ${Qt6_IMAGEFORMATS_DIR} ${IMAGEFORMATS}
|
||||
qgif$<$<CONFIG:Debug>:d>.dll
|
||||
qicns$<$<CONFIG:Debug>:d>.dll
|
||||
qico$<$<CONFIG:Debug>:d>.dll
|
||||
qjpeg$<$<CONFIG:Debug>:d>.dll
|
||||
qsvg$<$<CONFIG:Debug>:d>.dll
|
||||
qtga$<$<CONFIG:Debug>:d>.dll
|
||||
qtiff$<$<CONFIG:Debug>:d>.dll
|
||||
qwbmp$<$<CONFIG:Debug>:d>.dll
|
||||
qwebp$<$<CONFIG:Debug>:d>.dll
|
||||
)
|
||||
|
||||
# Create an empty qt.conf file. Qt will detect that this file exists, and use the folder that its in as the root folder.
|
||||
# This way it'll look for plugins in the root/plugins/ folder
|
||||
add_custom_command(TARGET citra-qt POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${DLL_DEST}qt.conf
|
||||
)
|
||||
endfunction(copy_citra_Qt6_deps)
|
|
@ -1,60 +1,28 @@
|
|||
|
||||
# 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
|
||||
function(download_bundled_external remote_path lib_name prefix_var)
|
||||
get_external_prefix(${lib_name} prefix)
|
||||
if (NOT EXISTS "${prefix}")
|
||||
message(STATUS "Downloading binaries for ${lib_name}...")
|
||||
|
||||
if (WIN32)
|
||||
set(repo_base "ext-windows-bin/raw/master")
|
||||
elseif (APPLE)
|
||||
set(repo_base "ext-macos-bin/raw/main")
|
||||
else()
|
||||
message(FATAL_ERROR "Bundled libraries are unsupported for this OS.")
|
||||
endif()
|
||||
|
||||
file(DOWNLOAD
|
||||
https://github.com/citra-emu/${repo_base}/${remote_path}${lib_name}.7z
|
||||
"${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
||||
endif()
|
||||
|
||||
# For packages that include the /usr/local prefix, include it in the prefix path.
|
||||
if (EXISTS "${prefix}/usr/local")
|
||||
set(prefix "${prefix}/usr/local")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using bundled binaries at ${prefix}")
|
||||
set(${prefix_var} "${prefix}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# This function downloads Qt using aqt.
|
||||
# Params:
|
||||
# target: Qt dependency to install. Specify a version number to download Qt, or "tools_(name)" for a specific build tool.
|
||||
# prefix_var: Name of a variable which will be set with the path to the extracted contents.
|
||||
function(download_qt_external target)
|
||||
function(download_qt target)
|
||||
# Determine installation parameters for OS, architecture, and compiler
|
||||
if (WIN32)
|
||||
set(host "windows")
|
||||
set(type "desktop")
|
||||
if (MINGW)
|
||||
set(arch_path "mingw81")
|
||||
elseif ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND "x86_64" IN_LIST ARCHITECTURE)
|
||||
set(arch "win64_mingw")
|
||||
set(arch_path "mingw_64")
|
||||
elseif (MSVC)
|
||||
if ("arm64" IN_LIST ARCHITECTURE)
|
||||
set(arch_path "msvc2019_arm64")
|
||||
elseif ("x86_64" IN_LIST ARCHITECTURE)
|
||||
set(arch_path "msvc2019_64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported bundled Qt architecture. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
||||
message(FATAL_ERROR "Unsupported bundled Qt architecture. Enable USE_SYSTEM_QT and provide your own.")
|
||||
endif()
|
||||
set(arch "win64_${arch_path}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported bundled Qt toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
||||
message(FATAL_ERROR "Unsupported bundled Qt toolchain. Enable USE_SYSTEM_QT and provide your own.")
|
||||
endif()
|
||||
set(arch "win64_${arch_path}")
|
||||
elseif (APPLE)
|
||||
set(host "mac")
|
||||
if (IOS)
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# buildcache wrapper
|
||||
OPTION(CITRA_USE_CCACHE "Use buildcache for compilation" OFF)
|
||||
IF(CITRA_USE_CCACHE)
|
||||
FIND_PROGRAM(CCACHE buildcache)
|
||||
IF (CCACHE)
|
||||
MESSAGE(STATUS "Using buildcache found in PATH")
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
|
||||
ELSE(CCACHE)
|
||||
MESSAGE(WARNING "CITRA_USE_CCACHE enabled, but no buildcache executable found")
|
||||
ENDIF(CCACHE)
|
||||
ENDIF(CITRA_USE_CCACHE)
|
|
@ -1,52 +0,0 @@
|
|||
SET(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
|
||||
SET(SDL2_PATH ${MINGW_PREFIX})
|
||||
SET(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
|
||||
|
||||
# Specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++)
|
||||
SET(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
|
||||
|
||||
# Mingw tools
|
||||
SET(STRIP ${MINGW_TOOL_PREFIX}strip)
|
||||
SET(WINDRES ${MINGW_TOOL_PREFIX}windres)
|
||||
SET(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
|
||||
|
||||
# ccache wrapper
|
||||
OPTION(CITRA_USE_CCACHE "Use ccache for compilation" OFF)
|
||||
IF(CITRA_USE_CCACHE)
|
||||
FIND_PROGRAM(CCACHE ccache)
|
||||
IF (CCACHE)
|
||||
MESSAGE(STATUS "Using ccache found in PATH")
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
|
||||
ELSE(CCACHE)
|
||||
MESSAGE(WARNING "CITRA_USE_CCACHE enabled, but no ccache found")
|
||||
ENDIF(CCACHE)
|
||||
ENDIF(CITRA_USE_CCACHE)
|
||||
|
||||
# Search for programs in the build host directories
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
|
||||
# Echo modified cmake vars to screen for debugging purposes
|
||||
IF(NOT DEFINED ENV{MINGW_DEBUG_INFO})
|
||||
MESSAGE("")
|
||||
MESSAGE("Custom cmake vars: (blank = system default)")
|
||||
MESSAGE("-----------------------------------------")
|
||||
MESSAGE("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
|
||||
MESSAGE("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
|
||||
MESSAGE("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
|
||||
MESSAGE("* WINDRES : ${WINDRES}")
|
||||
MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
|
||||
MESSAGE("* STRIP : ${STRIP}")
|
||||
MESSAGE("* CITRA_USE_CCACHE : ${CITRA_USE_CCACHE}")
|
||||
MESSAGE("")
|
||||
# So that the debug info only appears once
|
||||
SET(ENV{MINGW_DEBUG_INFO} SHOWN)
|
||||
ENDIF()
|
Loading…
Add table
Add a link
Reference in a new issue