vcpkg: support building on Linux

This commit is contained in:
Nadia Holmquist Pedersen 2024-09-06 22:50:12 +02:00
parent d18524d5ac
commit 268c4f14c1
3 changed files with 45 additions and 2 deletions

View File

@ -25,6 +25,11 @@ else()
option(USE_QT6 "Build using Qt 6 instead of 5" OFF) option(USE_QT6 "Build using Qt 6 instead of 5" OFF)
endif() endif()
# Since the Linux build pulls in glib anyway, we can just use upstream libslirp
if (UNIX AND NOT APPLE)
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" ON)
endif()
if (NOT USE_QT6) if (NOT USE_QT6)
list(APPEND VCPKG_MANIFEST_FEATURES qt5) list(APPEND VCPKG_MANIFEST_FEATURES qt5)
set(VCPKG_MANIFEST_NO_DEFAULT_FEATURES ON) set(VCPKG_MANIFEST_NO_DEFAULT_FEATURES ON)
@ -62,6 +67,14 @@ if (USE_RECOMMENDED_TRIPLETS)
# TODO Windows arm64 if possible # TODO Windows arm64 if possible
set(_CAN_TARGET_AS_HOST ON) set(_CAN_TARGET_AS_HOST ON)
set(_WANTED_TRIPLET x64-mingw-static-release) set(_WANTED_TRIPLET x64-mingw-static-release)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
# Can't really detect cross compiling here.
set(_CAN_TARGET_AS_HOST ON)
if (_HOST_PROCESSOR STREQUAL x86_64)
set(_WANTED_TRIPLET x64-linux-release)
elseif(_HOST_PROCESSOR STREQUAL "aarch64")
set(_WANTED_TRIPLET arm64-linux-release)
endif()
endif() endif()
# Don't override it if the user set something else # Don't override it if the user set something else

View File

@ -160,8 +160,13 @@ if (BUILD_STATIC)
if (WIN32 AND USE_QT6) if (WIN32 AND USE_QT6)
qt_import_plugins(melonDS INCLUDE Qt::QModernWindowsStylePlugin) qt_import_plugins(melonDS INCLUDE Qt::QModernWindowsStylePlugin)
endif() endif()
if (USE_VCPKG AND UNIX AND NOT APPLE)
pkg_check_modules(ALSA REQUIRED IMPORTED_TARGET alsa)
target_link_libraries(melonDS PRIVATE PkgConfig::ALSA)
else()
target_link_options(melonDS PRIVATE -static) target_link_options(melonDS PRIVATE -static)
endif() endif()
endif()
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")

View File

@ -2,9 +2,22 @@
"default-features": ["qt6"], "default-features": ["qt6"],
"dependencies": [ "dependencies": [
"sdl2", "sdl2",
{
"name": "sdl2",
"platform": "linux",
"features": [ "alsa" ]
},
"libarchive", "libarchive",
"zstd", "zstd",
"enet" "enet",
{
"name": "ecm",
"platform": "linux"
},
{
"name": "libslirp",
"platform": "linux"
}
], ],
"features": { "features": {
"qt6": { "qt6": {
@ -15,6 +28,12 @@
"default-features": false, "default-features": false,
"features": ["gui", "png", "thread", "widgets", "opengl", "zstd", "harfbuzz"] "features": ["gui", "png", "thread", "widgets", "opengl", "zstd", "harfbuzz"]
}, },
{
"name": "qtbase",
"platform": "linux",
"default-features": false,
"features": ["dbus", "xcb", "xkb", "xcb-xlib", "freetype", "fontconfig"]
},
{ {
"name": "qtbase", "name": "qtbase",
"host": true, "host": true,
@ -24,6 +43,12 @@
"name": "qtmultimedia", "name": "qtmultimedia",
"default-features": false "default-features": false
}, },
{
"name": "qtmultimedia",
"platform": "linux",
"features": ["gstreamer"],
"default-features": false
},
"qtsvg" "qtsvg"
] ]
}, },