Skip to content

Commit 48094c6

Browse files
committed
wasm
1 parent 5c09c2b commit 48094c6

File tree

4 files changed

+90
-5
lines changed

4 files changed

+90
-5
lines changed

.github/workflows/ci.yml

+49
Original file line numberDiff line numberDiff line change
@@ -572,3 +572,52 @@ jobs:
572572
conan upload --check --remote cppfw $PACKAGE_NAME/$PACKAGE_VERSION@$MYCI_CONAN_USER/main
573573
if: startsWith(github.ref, 'refs/tags/')
574574

575+
##### conan - emscripten #####
576+
conan-emscripten:
577+
strategy:
578+
fail-fast: false
579+
matrix:
580+
include:
581+
# - {os: ubuntu, codename: noble, image_owner: }
582+
- {os: debian, codename: bookworm, image_owner: }
583+
# - {os: debian, codename: bookworm, image_owner: i386/, labels: [i386,docker]}
584+
# - {os: debian, codename: bookworm, image_owner: , labels: [arm32,docker]}
585+
# - {os: debian, codename: bookworm, image_owner: , labels: [arm64,docker]}
586+
runs-on: ${{ (matrix.labels == '' && 'ubuntu-latest') || matrix.labels }}
587+
container: ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }}
588+
name: conan - emscripten | ${{ matrix.labels[0] }}
589+
steps:
590+
- name: add cppfw deb repo
591+
uses: myci-actions/add-deb-repo@main
592+
with:
593+
repo: deb https://gagis.hopto.org/repo/cppfw/${{ matrix.os }} ${{ matrix.codename }} main
594+
repo-name: cppfw
595+
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg
596+
install: devscripts equivs myci pipx cmake git nodejs
597+
- name: add ~/.local/bin to PATH
598+
uses: myci-actions/export-env-var@main
599+
with: {name: PATH, value: "$PATH:$HOME/.local/bin"}
600+
- name: install conan
601+
run: pipx install conan
602+
- name: create default conan profile
603+
run: |
604+
conan profile detect --name default
605+
sed -i -E "s/compiler.cppstd=.*$/compiler.cppstd=17/g" ~/.conan2/profiles/default
606+
- name: git clone
607+
uses: myci-actions/checkout@main
608+
with:
609+
submodules: false
610+
- name: set PACKAGE_VERSION
611+
uses: myci-actions/export-env-var@main
612+
with: {name: PACKAGE_VERSION, value: $(myci-deb-version.sh debian/changelog)}
613+
if: startsWith(github.ref, 'refs/tags/')
614+
- name: build
615+
run: |
616+
conan remote add cppfw $MYCI_CONAN_REMOTE
617+
# NOTE: specifying empty test folder to skip the test stage
618+
conan create conan --profile:build default --profile:host emscripten/conan.profile --build=missing --user $MYCI_CONAN_USER --channel main --version $PACKAGE_VERSION --test-folder ""
619+
- name: deploy conan package
620+
run: |
621+
conan remote login --password $MYCI_CONAN_PASSWORD cppfw $MYCI_CONAN_USER
622+
conan upload --check --remote cppfw $PACKAGE_NAME/$PACKAGE_VERSION@$MYCI_CONAN_USER/main
623+
if: startsWith(github.ref, 'refs/tags/')

conan/conanfile.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def requirements(self):
2121
self.requires("papki/[>=0.0.0]@cppfw/main", transitive_headers=True, transitive_libs=True)
2222

2323
def build_requirements(self):
24-
self.requires("tst/[>=0.3.29]@cppfw/main", visible=False)
24+
if self.settings.os != "Emscripten":
25+
self.requires("tst/[>=0.3.29]@cppfw/main", visible=False)
2526
self.tool_requires("prorab/[>=2.0.27]@cppfw/main")
2627
self.tool_requires("prorab-extra/[>=0.2.57]@cppfw/main")
2728

@@ -49,16 +50,22 @@ def source(self):
4950
git.run("submodule update --init --remote --depth 1")
5051

5152
def build(self):
52-
self.run("make $MAKE_INCLUDE_DIRS_ARG lint=off")
53-
self.run("make $MAKE_INCLUDE_DIRS_ARG lint=off test")
53+
if self.settings.os == "Emscripten":
54+
self.run("make $MAKE_INCLUDE_DIRS_ARG config=wasm --directory=src")
55+
else:
56+
self.run("make $MAKE_INCLUDE_DIRS_ARG lint=off")
57+
self.run("make $MAKE_INCLUDE_DIRS_ARG lint=off test")
5458

5559
def package(self):
60+
if self.settings.os == "Emscripten":
61+
src_rel_dir = os.path.join(self.build_folder, "src/out/wasm")
62+
else:
63+
src_rel_dir = os.path.join(self.build_folder, "src/out/rel")
64+
5665
src_dir = os.path.join(self.build_folder, "src")
57-
src_rel_dir = os.path.join(self.build_folder, "src/out/rel")
5866
dst_include_dir = os.path.join(self.package_folder, "include")
5967
dst_lib_dir = os.path.join(self.package_folder, "lib")
6068
dst_bin_dir = os.path.join(self.package_folder, "bin")
61-
6269
copy(conanfile=self, pattern="*.h", dst=dst_include_dir, src=src_dir, keep_path=True)
6370
copy(conanfile=self, pattern="*.hpp", dst=dst_include_dir, src=src_dir, keep_path=True)
6471

config/wasm.mk

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
include $(config_dir)base/base.mk
2+
3+
this_cxxflags += -O3
4+
5+
this_cxx := em++
6+
this_cc := emcc
7+
this_ar := emar
8+
9+
this_static_lib_only = : true
10+
11+
# TODO: remove the warning suppression when the PR is merged
12+
# Suppress version-check warning due to https://github.com/conan-io/conan-center-index/pull/26247
13+
this_cxxflags += -Wno-version-check
14+
15+
this_cxxflags += -fwasm-exceptions
16+
this_ldflags += -fwasm-exceptions
17+
18+
this_cxxflags += -pthread
19+
this_ldflags += -pthread

emscripten/conan.profile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[settings]
2+
os=Emscripten
3+
arch=wasm
4+
compiler=clang
5+
compiler.version=15
6+
compiler.libcxx=libc++
7+
build_type=Release
8+
9+
[tool_requires]
10+
emsdk/[>=3.1.72]

0 commit comments

Comments
 (0)