Skip to content

Commit 067dc9e

Browse files
committed
save
1 parent fbcf5a1 commit 067dc9e

File tree

5 files changed

+87
-8
lines changed

5 files changed

+87
-8
lines changed

.devcontainer/Taskfile

100644100755
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ set -Eeuo pipefail
44
updateContentCommand() {
55
curl -sS https://webi.sh/zig | sh
66
source ~/.config/envman/PATH.env
7+
8+
pushd ~
9+
git clone https://github.com/emscripten-core/emsdk.git
10+
cd emsdk
11+
./emsdk install latest
12+
./emsdk activate latest
13+
echo 'source ~/emsdk/emsdk_env.sh' >> ~/.bashrc
14+
source ./emsdk_env.sh
15+
popd
716
}
817

918
"$@"

.github/workflows/cmake-workflow-preset-build.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,22 @@ jobs:
7676
with:
7777
key: ${{ runner.os }}-${{ hashFiles("**") }}
7878
path: build/${{ matrix.target }}
79-
- run: cmake --workflow --preset "build-$TARGET"
79+
- run: cmake --workflow --preset "build:$TARGET"
8080
env:
8181
TARGET: ${{ matrix.target }}
82-
- run: cpack --preset "build-$TARGET"
82+
- run: cmake --workflow --preset "package:$TARGET"
83+
env:
84+
TARGET: ${{ matrix.target }}
85+
- run: |
86+
file=$(echo build/"$TARGET"/quickjs-ng-"$TARGET".*)
87+
if [[ $file =~ .zip$ ]]; then
88+
unzip "$file" -d "build/$TARGET"
89+
else
90+
tar -xzf "$file" -C "build/$TARGET"
91+
fi
8392
env:
8493
TARGET: ${{ matrix.target }}
8594
- uses: actions/upload-artifact@v4
8695
with:
8796
name: quickjs-${{ matrix.target }}
88-
path: stage/${{ matrix.target }}
97+
path: build/${{ matrix.target }}/quickjs-ng-${{ matrix.target }}

.github/workflows/cmake-workflow-preset-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ jobs:
7373
with:
7474
key: ${{ runner.os }}-${{ hashFiles("**") }}
7575
path: build/${{ matrix.target }}
76-
- run: cmake --workflow --preset "test-$TARGET"
76+
- run: cmake --workflow --preset "build:$TARGET"
77+
env:
78+
TARGET: ${{ matrix.target }}
79+
- run: cmake --workflow --preset "test:$TARGET"
7780
env:
7881
TARGET: ${{ matrix.target }}

CMakeLists.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
cmake_minimum_required(VERSION 3.9)
1+
cmake_minimum_required(VERSION 3.29)
22

3-
project(quickjs LANGUAGES C)
3+
project(quickjs
4+
VERSION 0.5.0
5+
DESCRIPTION "⚡ The small quick embeddable JavaScript runtime"
6+
HOMEPAGE_URL "https://quickjs-ng.github.io/quickjs-ng/"
7+
LANGUAGES C
8+
)
49

510
include(CheckCCompilerFlag)
611
include(GNUInstallDirs)
@@ -10,6 +15,7 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
1015
set(CMAKE_C_EXTENSIONS ON)
1116
set(CMAKE_C_STANDARD 11)
1217

18+
# If left unset this would be a toolchain-specific default.
1319
if(NOT CMAKE_BUILD_TYPE)
1420
message(STATUS "No build type selected, default to Release")
1521
set(CMAKE_BUILD_TYPE "Release")
@@ -364,3 +370,11 @@ if(NOT IOS)
364370
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
365371
install(DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DOCDIR})
366372
endif()
373+
374+
# CPack
375+
if(WIN32)
376+
set(CPACK_GENERATOR "ZIP")
377+
else()
378+
set(CPACK_GENERATOR "TGZ")
379+
endif()
380+
include(CPack)

CMakePresets.json

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,72 @@
1313
"cacheVariables": {
1414
"ZIG_TARGET": "x86_64-linux-musl"
1515
}
16+
},
17+
{
18+
"name": "wasm32-emscripten",
19+
"binaryDir": "build/wasm32-emscripten",
20+
"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
21+
"cacheVariables": {
22+
"CMAKE_CROSSCOMPILING_EMULATOR": "node"
23+
}
1624
}
1725
],
1826
"buildPresets": [
1927
{
2028
"name": "x86_64-linux-musl",
2129
"configurePreset": "x86_64-linux-musl"
30+
},
31+
{
32+
"name": "wasm32-emscripten",
33+
"configurePreset": "wasm32-emscripten"
2234
}
2335
],
2436
"packagePresets": [
2537
{
2638
"name": "x86_64-linux-musl",
2739
"configurePreset": "x86_64-linux-musl",
28-
"generators": ["TGZ"]
40+
"variables": {
41+
"CPACK_PACKAGE_FILE_NAME": "quickjs-ng-x86_64-linux-musl"
42+
}
43+
},
44+
{
45+
"name": "wasm32-emscripten",
46+
"configurePreset": "wasm32-emscripten",
47+
"variables": {
48+
"CPACK_PACKAGE_FILE_NAME": "quickjs-ng-wasm32-emscripten"
49+
}
2950
}
3051
],
3152
"workflowPresets": [
3253
{
33-
"name": "build-x86_64-linux-musl",
54+
"name": "build:x86_64-linux-musl",
3455
"steps": [
3556
{ "type": "configure", "name": "x86_64-linux-musl" },
3657
{ "type": "build", "name": "x86_64-linux-musl" }
3758
]
59+
},
60+
{
61+
"name": "package:x86_64-linux-musl",
62+
"steps": [
63+
{ "type": "configure", "name": "x86_64-linux-musl" },
64+
{ "type": "build", "name": "x86_64-linux-musl" },
65+
{ "type": "package", "name": "x86_64-linux-musl" }
66+
]
67+
},
68+
{
69+
"name": "build:wasm32-emscripten",
70+
"steps": [
71+
{ "type": "configure", "name": "wasm32-emscripten" },
72+
{ "type": "build", "name": "wasm32-emscripten" }
73+
]
74+
},
75+
{
76+
"name": "package:wasm32-emscripten",
77+
"steps": [
78+
{ "type": "configure", "name": "wasm32-emscripten" },
79+
{ "type": "build", "name": "wasm32-emscripten" },
80+
{ "type": "package", "name": "wasm32-emscripten" }
81+
]
3882
}
3983
]
4084
}

0 commit comments

Comments
 (0)