Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Emscripten/Wasm CI #140

Draft
wants to merge 8 commits into
base: 2.5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
vcpkg_triplet: arm64-osx-min1100-release
vcpkg_host_triplet: x64-osx-min1015-release
check_disk_space: df -h
- os: ubuntu-latest
vcpkg_path: /home/runner/mixxx-vcpkg
vcpkg_bootstrap: ./bootstrap-vcpkg.sh
vcpkg_triplet: wasm32-emscripten-pthread-release
vcpkg_host_triplet: x64-linux-release
check_disk_space: df -h
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.vcpkg_host_triplet }}
Expand Down Expand Up @@ -82,6 +88,16 @@ jobs:
brew update && brew install nasm autoconf-archive
/bin/bash -c "sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer"
xcrun --show-sdk-version

- name: "[Linux] Set up build environment"
if: runner.os == 'Linux'
run: sudo apt-get install -y autoconf-archive nasm '^libxcb.*-dev' libx11-xcb-dev libgl1-mesa-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev mesa-common-dev

- name: "[Emscripten] Install SDK"
if: startsWith(matrix.vcpkg_triplet, 'wasm32-') || startsWith(matrix.vcpkg_triplet, 'wasm64-')
uses: mymindstorm/setup-emsdk@v14
with:
version: '3.1.55'

- name: Check available disk space
run: ${{ matrix.check_disk_space }}
Expand Down
28 changes: 28 additions & 0 deletions overlay/triplets/wasm32-emscripten-pthread-release.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED EMSCRIPTEN_ROOT EMSDK PATH)

if(NOT DEFINED ENV{EMSCRIPTEN_ROOT})
find_path(EMSCRIPTEN_ROOT "emcc")
else()
set(EMSCRIPTEN_ROOT "$ENV{EMSCRIPTEN_ROOT}")
endif()

if(NOT EMSCRIPTEN_ROOT)
if(NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR "The emcc compiler not found in PATH")
endif()
set(EMSCRIPTEN_ROOT "$ENV{EMSDK}/upstream/emscripten")
endif()

if(NOT EXISTS "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
message(FATAL_ERROR "Emscripten.cmake toolchain file not found")
endif()

set(VCPKG_TARGET_ARCHITECTURE wasm32)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Emscripten)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")

set(ENV{EMCC_CFLAGS} "$ENV{EMCC_CFLAGS} -pthread")

set(VCPKG_BUILD_TYPE release)
24 changes: 19 additions & 5 deletions ports/icu/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ vcpkg_extract_source_archive(SOURCE_PATH
mingw-dll-install.patch
disable-static-prefix.patch # https://gitlab.kitware.com/cmake/cmake/-/issues/16617; also mingw.
fix-win-build.patch
vcpkg-cross-data.patch
)

vcpkg_find_acquire_program(PYTHON3)
set(ENV{PYTHON} "${PYTHON3}")

vcpkg_list(SET CONFIGURE_OPTIONS)
vcpkg_list(SET CONFIGURE_OPTIONS_RELEASE)
vcpkg_list(SET CONFIGURE_OPTIONS_DEBUG)
vcpkg_list(SET BUILD_OPTIONS)

if(VCPKG_TARGET_IS_EMSCRIPTEN)
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras)
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--without-assembly -O ../data/icupkg.inc")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND CONFIGURE_OPTIONS --enable-icu-build-win)
endif()
Expand All @@ -33,8 +44,11 @@ list(APPEND CONFIGURE_OPTIONS --disable-samples --disable-tests --disable-layout
list(APPEND CONFIGURE_OPTIONS_RELEASE --disable-debug --enable-release)
list(APPEND CONFIGURE_OPTIONS_DEBUG --enable-debug --disable-release)

set(RELEASE_TRIPLET ${TARGET_TRIPLET}-rel)
set(DEBUG_TRIPLET ${TARGET_TRIPLET}-dbg)
set(CONFIG_TRIPLETS)
list(APPEND CONFIG_TRIPLETS ${TARGET_TRIPLET}-rel)
if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
list(APPEND CONFIG_TRIPLETS ${TARGET_TRIPLET}-dbg)
endif()

if("tools" IN_LIST FEATURES)
list(APPEND CONFIGURE_OPTIONS --enable-tools)
Expand Down Expand Up @@ -89,7 +103,7 @@ if(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
endif()

#31680: Fix @rpath in both debug and release build
foreach(CONFIG_TRIPLE IN ITEMS ${DEBUG_TRIPLET} ${RELEASE_TRIPLET})
foreach(CONFIG_TRIPLE IN LISTS CONFIG_TRIPLETS)
# add ID_PREFIX to libicudata libicui18n libicuio libicutu libicuuc
foreach(LIB_NAME IN ITEMS libicudata libicui18n libicuio ${LIBICUTU_RPATH} libicuuc)
vcpkg_execute_build_process(
Expand Down Expand Up @@ -141,7 +155,7 @@ if(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")

endif()

vcpkg_install_make()
vcpkg_install_make(OPTIONS ${BUILD_OPTIONS})

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/share"
Expand Down Expand Up @@ -178,7 +192,7 @@ file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/icu/debug")

# To cross compile, we need some files at specific positions. So lets copy them
file(GLOB CROSS_COMPILE_DEFS "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}/config/icucross.*")
file(GLOB CROSS_COMPILE_DEFS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config/icucross.*")
file(INSTALL ${CROSS_COMPILE_DEFS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/config")

file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll")
Expand Down
13 changes: 13 additions & 0 deletions ports/icu/vcpkg-cross-data.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/source/configure.ac b/source/configure.ac
index 1bd5871..c508f48 100644
--- a/source/configure.ac
+++ b/source/configure.ac
@@ -1151,7 +1151,7 @@ AC_ARG_ENABLE(fuzzer,
fuzzer=false)
ICU_CONDITIONAL(FUZZER, test "$fuzzer" = true)

-ICU_CONDITIONAL(DATA, test "$tools" = true || test "$cross_compiling" = "yes")
+ICU_CONDITIONAL(DATA, test "$tools" = true || test "$cross_compiling" = "yes" || test -n "$cross_buildroot")

AC_ARG_WITH(data-packaging,
[ --with-data-packaging specify how to package ICU data. Possible values:
1 change: 1 addition & 0 deletions ports/icu/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "icu",
"version": "73.1",
"port-version": 2,
"description": "Mature and widely used Unicode and localization library.",
"homepage": "https://icu.unicode.org/home",
"license": "ICU",
Expand Down
91 changes: 82 additions & 9 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,80 @@
"description": "Build with Qt 6",
"dependencies": [
"qt5compat",
"qtbase",
{
"name": "qtbase",
"default-features": false,
"features": [
"brotli",
"concurrent",
{
"name": "dbus",
"platform": "!emscripten"
},
"default-features",
"doubleconversion",
"freetype",
{
"name": "gles2",
"$comment": "TODO: Use gles3 once we update the Qt port",
"platform": "emscripten"
},
"gui",
"harfbuzz",
"icu",
"jpeg",
"network",
"opengl",
{
"name": "openssl",
"platform": "!emscripten"
},
"pcre2",
"png",
"sql",
{
"name": "sql-psql",
"platform": "!emscripten"
},
"sql-sqlite",
"testlib",
"thread",
"widgets",
"zstd"
]
},
"qtdeclarative",
"qtsvg",
"qttranslations",
"qtkeychain-qt6"
{
"name": "qttranslations",
"platform": "!emscripten"
},
{
"name": "qtkeychain-qt6",
"platform": "!emscripten"
}
]
}
},
"dependencies": [
"ableton-link",
"benchmark",
"chromaprint",
{
"name": "chromaprint",
"platform": "!emscripten"
},
"fdk-aac",
"ffmpeg",
{
"name": "ffmpeg",
"platform": "!emscripten"
},
"fftw3",
"grantlee",
"gtest",
"hidapi",
{
"name": "hidapi",
"platform": "!emscripten"
},
{
"name": "hss1394",
"platform": "windows | osx"
Expand All @@ -63,7 +119,10 @@
"name": "libsndfile",
"default-features": false
},
"libusb",
{
"name": "libusb",
"platform": "!emscripten"
},
"libvorbis",
"lilv",
"mp3lame",
Expand All @@ -72,9 +131,23 @@
"opusfile",
{
"name": "portaudio",
"features": ["asio"]
"default-features": false,
"features": [
{
"name": "asio",
"platform": "!emscripten"
},
{
"name": "jack",
"platform": "!emscripten"
}
]
},
{
"name": "portmidi",
"$comment": "TODO: Depends on https://github.com/PortMidi/portmidi/issues/68 (alternatively libremidi might be an option)",
"platform": "!emscripten"
},
"portmidi",
"protobuf",
"pthreads",
"rubberband",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@
},
"icu": {
"baseline": "73.1",
"port-version": 0
"port-version": 2
},
"ideviceinstaller": {
"baseline": "2023-07-21",
Expand Down
10 changes: 10 additions & 0 deletions versions/i-/icu.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"versions": [
{
"git-tree": "b6ac20c2420a4f7118d5db326c8c599e50b2c5a4",
"version": "73.1",
"port-version": 2
},
{
"git-tree": "deb5694d7965a264d6eb579df49aff4fe6362c24",
"version": "73.1",
"port-version": 1
},
{
"git-tree": "acc3cf9137af5fc8fdd3e8607377026cf88f144d",
"version": "73.1",
Expand Down
Loading