Skip to content

Commit 64e6807

Browse files
authored
First stage of cleeanup in source tree pollution (#2105)
Update build-js.sh to output to `out` directory. This is district from the `bin` directory which is used by the cmake build and may or may not live in the source tree. The `out` directory currently always lives in the source tree. As a followup change I hope to additionally move all test outout into this tree. See #2104
1 parent f86375a commit 64e6807

7 files changed

Lines changed: 33 additions & 56 deletions

File tree

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
*.diff
44

55
# autogenerated during the build
6-
src/passes/WasmIntrinsics.cpp
6+
/src/passes/WasmIntrinsics.cpp
77

8-
# files generated by build-js.sh
9-
WebIDLGrammar.pkl
10-
glue.cpp
11-
glue.js
12-
parser.out
13-
shared.bc
8+
# File generated by build-js.sh
9+
/out/
1410

1511
# autogenerated files by check.py
1612
a.*
@@ -28,39 +24,28 @@ test/validator/*.wasm
2824
*.map
2925

3026
# files related to building in-tree
31-
CMakeFiles/
32-
CMakeCache.txt
33-
Makefile
34-
cmake_install.cmake
35-
*.ninja
36-
.ninja_deps
37-
.ninja_log
38-
bin/wasm-shell
39-
bin/wasm-opt
40-
bin/asm2wasm
41-
bin/wasm2asm
42-
bin/wasm-as
43-
bin/wasm-dis
44-
bin/wasm-ctor-eval
45-
bin/wasm-emscripten-finalize
46-
bin/wasm-merge
47-
bin/wasm-metadce
48-
bin/wasm-reduce
49-
bin/wasm2js
50-
lib/
27+
/CMakeFiles/
28+
/CMakeCache.txt
29+
/Makefile
30+
/cmake_install.cmake
31+
/*.ninja
32+
/.ninja_deps
33+
/.ninja_log
34+
/bin/
35+
/lib/
5136

52-
# files related to windows build
53-
.vs/
54-
*.vcxproj*
55-
*.dir/
56-
*.sln
57-
*.sdf
58-
*.VC.opendb
59-
Win32/
37+
# files related to bulding in-tree on windows
38+
/.vs/
39+
/*.vcxproj*
40+
/*.dir/
41+
/*.sln
42+
/*.sdf
43+
/*.VC.opendb
44+
/Win32/
6045

6146
# macOS
6247
.DS_Store
6348

6449
# files related to VS Code
65-
.history
66-
.vscode
50+
/.history
51+
/.vscode

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
179179

180180
# if binaryen.js was built (using "./build-js.sh", currently
181181
# optional), install it
182-
IF(EXISTS "${PROJECT_SOURCE_DIR}/bin/binaryen.js")
182+
IF(EXISTS "${PROJECT_SOURCE_DIR}/out/binaryen.js")
183183
INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
184184
ENDIF()
185185

bin/readme.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

build-js.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ BINARYEN_SRC="$(dirname $0)/src"
6969
BINARYEN_SCRIPTS="$(dirname $0)/scripts"
7070

7171
# output binaries relative to current working directory
72-
BINARYEN_BIN="$PWD/bin"
72+
OUT="$PWD/out"
7373

7474
echo "generate embedded intrinsics module"
7575

7676
python $BINARYEN_SCRIPTS/embedwast.py $BINARYEN_SRC/passes/wasm-intrinsics.wast $BINARYEN_SRC/passes/WasmIntrinsics.cpp
7777

7878
echo "building shared bitcode"
7979

80+
mkdir -p ${OUT}
8081
"$EMSCRIPTEN/em++" \
8182
$EMCC_ARGS \
8283
$BINARYEN_SRC/asmjs/asm_v_wasm.cpp \
@@ -168,7 +169,7 @@ echo "building shared bitcode"
168169
$BINARYEN_SRC/wasm/wasm-validator.cpp \
169170
$BINARYEN_SRC/wasm/wasm.cpp \
170171
-I$BINARYEN_SRC \
171-
-o shared.bc
172+
-o ${OUT}/shared.bc
172173

173174
echo "building binaryen.js"
174175

@@ -826,10 +827,10 @@ export_function "_BinaryenSetAPITracing"
826827
"$EMSCRIPTEN/em++" \
827828
$EMCC_ARGS \
828829
$BINARYEN_SRC/binaryen-c.cpp \
829-
shared.bc \
830+
$OUT/shared.bc \
830831
-I$BINARYEN_SRC/ \
831832
-s EXPORTED_FUNCTIONS=[${EXPORTED_FUNCTIONS}] \
832-
-o $BINARYEN_BIN/binaryen${OUT_FILE_SUFFIX}.js \
833+
-o $OUT/binaryen${OUT_FILE_SUFFIX}.js \
833834
-s MODULARIZE_INSTANCE=1 \
834835
-s 'EXPORT_NAME="Binaryen"' \
835836
--post-js $BINARYEN_SRC/js/binaryen.js-post.js

scripts/test/shared.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ def warn(text):
106106
else:
107107
options.binaryen_bin = 'bin'
108108

109-
# ensure BINARYEN_ROOT is set up
110-
os.environ['BINARYEN_ROOT'] = os.path.dirname(os.path.abspath(
111-
options.binaryen_bin))
109+
options.binaryen_bin = os.path.normpath(os.path.abspath(options.binaryen_bin))
112110

113-
options.binaryen_bin = os.path.normpath(options.binaryen_bin)
111+
# ensure BINARYEN_ROOT is set up
112+
os.environ['BINARYEN_ROOT'] = os.path.dirname(options.binaryen_bin)
114113

115114
wasm_dis_filenames = ['wasm-dis', 'wasm-dis.exe']
116115
if not any(os.path.isfile(os.path.join(options.binaryen_bin, f))
@@ -173,7 +172,7 @@ def is_exe(fpath):
173172
WASM_METADCE = [os.path.join(options.binaryen_bin, 'wasm-metadce')]
174173
WASM_EMSCRIPTEN_FINALIZE = [os.path.join(options.binaryen_bin,
175174
'wasm-emscripten-finalize')]
176-
BINARYEN_JS = os.path.join(options.binaryen_bin, 'binaryen.js')
175+
BINARYEN_JS = os.path.join(options.binaryen_root, 'out', 'binaryen.js')
177176

178177

179178
def wrap_with_valgrind(cmd):

travis-emcc-tests.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
set -e
2-
echo "travis-test pre-test"
3-
python -c "import check ; check.run_binaryen_js_tests()"
42
echo "travis-test build"
5-
ls -al bin/
63
./build-js.sh -g
7-
ls -al bin/
8-
echo "travis-test post-test"
4+
echo "travis-test test"
95
python -c "import check ; check.run_binaryen_js_tests()"
106
echo "travis-test yay!"
11-

0 commit comments

Comments
 (0)