Skip to content

Commit 5b1e708

Browse files
authored
Emscripten - ci fix (#397)
* Emscripten make sure to pipe ci variable * apothecary variable -y for pthreads
1 parent 0215000 commit 5b1e708

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

apothecary/apothecary

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ if [ -z "${CPP_STANDARD+x}" ]; then
193193
export CPP_STANDARD=23
194194
fi
195195

196-
if [ -z "${PTHREADS_ENABLED+x}" ]; then
197-
export PTHREADS_ENABLED=0
198-
fi
199196

200197
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-}
201198

@@ -275,6 +272,8 @@ options:
275272
276273
-e use visual studio enterprise instead of community
277274
275+
-y use pthreads
276+
278277
-p dont build dependencies
279278
280279
-h print this usage guide
@@ -382,7 +381,7 @@ trapError() {
382381
#### PARSE COMMANDLINE
383382

384383
# from http://www.mkssoftware.com/docs/man1/getopts.1.asp
385-
while getopts t:a:b:d:s:j:m:c:x:hgvfpew opt ; do
384+
while getopts t:a:b:d:s:j:y:m:c:x:hgvfpew opt ; do
386385
case "$opt" in
387386
t) # set the library build type
388387
export TYPE="$OPTARG" ;;
@@ -408,6 +407,8 @@ while getopts t:a:b:d:s:j:m:c:x:hgvfpew opt ; do
408407
export VS_TYPE=Enterprise ;;
409408
f) # force download
410409
export FORCE_DOWNLOAD=1 ;;
410+
y) # use pthreads
411+
export PTHREADS_ENABLED=1 ;;
411412
p) # Dont build dependencies
412413
export BUILD_DEPENDENCIES=0 ;;
413414
w) # win11
@@ -781,6 +782,9 @@ if [ "$TYPE" = "emscripten" ]; then
781782
PLATFORM="WASM"
782783
PLATFORM_FLAG=""
783784
fi
785+
if [ -z "${PTHREADS_ENABLED+x}" ]; then
786+
export PTHREADS_ENABLED=0
787+
fi
784788
if [ "$PTHREADS_ENABLED" == "1" ] ; then
785789
PTHREADS_FLAG="-DUSE_PTHREADS=1 -pthread"
786790
else

scripts/build.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,21 @@ else
99
export FORCE=""
1010
fi
1111

12+
if [ -z "${PTHREADS_ENABLED+x}" ]; then
13+
export PTHREADS_ENABLED=0
14+
fi
15+
16+
# Print the value to verify it's set
17+
echo "PTHREADS_ENABLED is set to: $PTHREADS_ENABLED"
1218

19+
# Your existing build logic here
1320

21+
# Example of using the variable
22+
if [ "$PTHREADS_ENABLED" -eq 1 ]; then
23+
echo "pThreads is enabled"
24+
else
25+
echo "pThreads is not enabled"
26+
fi
1427

1528
# trap any script errors and exit
1629
# trap "trapError" ERR
@@ -226,7 +239,11 @@ function build(){
226239
if [ "$GITHUB_ACTIONS" = true ] && [ "$TARGET" == "vs" ]; then
227240
ARGS="-e $ARGS"
228241
fi
229-
242+
243+
if [ "$PTHREADS_ENABLED" -eq 1 ]; then
244+
ARGS="$ARGS -y "
245+
fi
246+
230247
if [ "$ARCH" != "" ] ; then
231248
ARGS="$ARGS -a$ARCH"
232249
fi

scripts/emscripten/build_emscripten_64.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export TARGET=emscripten
2121
export PLATFORM=emscripten
2222
export ARCH=64
2323
export NO_FORCE=ON
24+
export PTHREADS_ENABLED=1
2425

2526
echo "Target: $TARGET"
2627
echo "Architecture: $ARCH"

0 commit comments

Comments
 (0)