From bb18938d3713f6ae43a6737a344279db22afbc6c Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 14 May 2019 22:34:38 -0700 Subject: [PATCH] First stage of cleeanup in source tree pollution 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 --- .gitattributes | 2 -- .gitignore | 59 ++++++++++++++++-------------------------- CMakeLists.txt | 2 +- bin/readme.txt | 1 - build-js.sh | 9 ++++--- scripts/test/shared.py | 9 +++---- travis-emcc-tests.sh | 7 +---- 7 files changed, 33 insertions(+), 56 deletions(-) delete mode 100644 .gitattributes delete mode 100644 bin/readme.txt diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index ea18558c20b..00000000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.a binary -bin/binaryen.js -diff diff --git a/.gitignore b/.gitignore index 4bb4e054b16..c02064bae76 100644 --- a/.gitignore +++ b/.gitignore @@ -3,14 +3,10 @@ *.diff # autogenerated during the build -src/passes/WasmIntrinsics.cpp +/src/passes/WasmIntrinsics.cpp -# files generated by build-js.sh -WebIDLGrammar.pkl -glue.cpp -glue.js -parser.out -shared.bc +# File generated by build-js.sh +/out/ # autogenerated files by check.py a.* @@ -28,39 +24,28 @@ test/validator/*.wasm *.map # files related to building in-tree -CMakeFiles/ -CMakeCache.txt -Makefile -cmake_install.cmake -*.ninja -.ninja_deps -.ninja_log -bin/wasm-shell -bin/wasm-opt -bin/asm2wasm -bin/wasm2asm -bin/wasm-as -bin/wasm-dis -bin/wasm-ctor-eval -bin/wasm-emscripten-finalize -bin/wasm-merge -bin/wasm-metadce -bin/wasm-reduce -bin/wasm2js -lib/ +/CMakeFiles/ +/CMakeCache.txt +/Makefile +/cmake_install.cmake +/*.ninja +/.ninja_deps +/.ninja_log +/bin/ +/lib/ -# files related to windows build -.vs/ -*.vcxproj* -*.dir/ -*.sln -*.sdf -*.VC.opendb -Win32/ +# files related to bulding in-tree on windows +/.vs/ +/*.vcxproj* +/*.dir/ +/*.sln +/*.sdf +/*.VC.opendb +/Win32/ # macOS .DS_Store # files related to VS Code -.history -.vscode +/.history +/.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt index 092cca01cbb..2e7cb74bb98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,7 +179,7 @@ INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # if binaryen.js was built (using "./build-js.sh", currently # optional), install it -IF(EXISTS "${PROJECT_SOURCE_DIR}/bin/binaryen.js") +IF(EXISTS "${PROJECT_SOURCE_DIR}/out/binaryen.js") INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) ENDIF() diff --git a/bin/readme.txt b/bin/readme.txt deleted file mode 100644 index 7e9c8e5a55a..00000000000 --- a/bin/readme.txt +++ /dev/null @@ -1 +0,0 @@ -This directory is empty until the native tools or .js builds are generated. This file makes sure it exists in git. diff --git a/build-js.sh b/build-js.sh index 42f81bb64c8..c2039c44eb3 100755 --- a/build-js.sh +++ b/build-js.sh @@ -69,7 +69,7 @@ BINARYEN_SRC="$(dirname $0)/src" BINARYEN_SCRIPTS="$(dirname $0)/scripts" # output binaries relative to current working directory -BINARYEN_BIN="$PWD/bin" +OUT="$PWD/out" echo "generate embedded intrinsics module" @@ -77,6 +77,7 @@ python $BINARYEN_SCRIPTS/embedwast.py $BINARYEN_SRC/passes/wasm-intrinsics.wast echo "building shared bitcode" +mkdir -p ${OUT} "$EMSCRIPTEN/em++" \ $EMCC_ARGS \ $BINARYEN_SRC/asmjs/asm_v_wasm.cpp \ @@ -168,7 +169,7 @@ echo "building shared bitcode" $BINARYEN_SRC/wasm/wasm-validator.cpp \ $BINARYEN_SRC/wasm/wasm.cpp \ -I$BINARYEN_SRC \ - -o shared.bc + -o ${OUT}/shared.bc echo "building binaryen.js" @@ -820,10 +821,10 @@ export_function "_BinaryenSetAPITracing" "$EMSCRIPTEN/em++" \ $EMCC_ARGS \ $BINARYEN_SRC/binaryen-c.cpp \ - shared.bc \ + $OUT/shared.bc \ -I$BINARYEN_SRC/ \ -s EXPORTED_FUNCTIONS=[${EXPORTED_FUNCTIONS}] \ - -o $BINARYEN_BIN/binaryen${OUT_FILE_SUFFIX}.js \ + -o $OUT/binaryen${OUT_FILE_SUFFIX}.js \ -s MODULARIZE_INSTANCE=1 \ -s 'EXPORT_NAME="Binaryen"' \ --post-js $BINARYEN_SRC/js/binaryen.js-post.js diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 8624448d9a6..6fb66a21a9d 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -106,11 +106,10 @@ def warn(text): else: options.binaryen_bin = 'bin' -# ensure BINARYEN_ROOT is set up -os.environ['BINARYEN_ROOT'] = os.path.dirname(os.path.abspath( - options.binaryen_bin)) +options.binaryen_bin = os.path.normpath(os.path.abspath(options.binaryen_bin)) -options.binaryen_bin = os.path.normpath(options.binaryen_bin) +# ensure BINARYEN_ROOT is set up +os.environ['BINARYEN_ROOT'] = os.path.dirname(options.binaryen_bin) wasm_dis_filenames = ['wasm-dis', 'wasm-dis.exe'] if not any(os.path.isfile(os.path.join(options.binaryen_bin, f)) @@ -173,7 +172,7 @@ def is_exe(fpath): WASM_METADCE = [os.path.join(options.binaryen_bin, 'wasm-metadce')] WASM_EMSCRIPTEN_FINALIZE = [os.path.join(options.binaryen_bin, 'wasm-emscripten-finalize')] -BINARYEN_JS = os.path.join(options.binaryen_bin, 'binaryen.js') +BINARYEN_JS = os.path.join(options.binaryen_root, 'out', 'binaryen.js') def wrap_with_valgrind(cmd): diff --git a/travis-emcc-tests.sh b/travis-emcc-tests.sh index b2de91abbfa..70507a2aaf2 100755 --- a/travis-emcc-tests.sh +++ b/travis-emcc-tests.sh @@ -1,11 +1,6 @@ set -e -echo "travis-test pre-test" -python -c "import check ; check.run_binaryen_js_tests()" echo "travis-test build" -ls -al bin/ ./build-js.sh -g -ls -al bin/ -echo "travis-test post-test" +echo "travis-test test" python -c "import check ; check.run_binaryen_js_tests()" echo "travis-test yay!" -