build: Change build path to 'build/<compiler>/<build_type>'
This commit is contained in:
1 parent
3be4c57530
commit
7bec8a103b
20 files changed
+408
-83
No files matched your search
Vendored
+33
-5
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"name": "Linux (clang)",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/src/server/sparkd/cmds/spartan",
|
||||
"${workspaceRoot}/externals/linux/include",
|
||||
"${workspaceRoot}/build/clang_debug/src"
|
||||
"${workspaceRoot}/build/clang/debug/src"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
@@ -19,14 +19,42 @@
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/src/server/sparkd/cmds/spartan",
|
||||
"${workspaceRoot}/externals/linux/include",
|
||||
"${workspaceRoot}/build/clang_debug/src"
|
||||
"${workspaceRoot}/build/clang/debug/src"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "${workspaceFolder}/build/clang_debug/compile_commands.json"
|
||||
"compileCommands": "${workspaceFolder}/build/clang/debug/compile_commands.json"
|
||||
},
|
||||
{
|
||||
"name": "Linux (gcc)",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/src/server/sparkd/cmds/spartan",
|
||||
"${workspaceRoot}/externals/linux/include",
|
||||
"${workspaceRoot}/build/gcc/debug/src"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/src/server/sparkd/cmds/spartan",
|
||||
"${workspaceRoot}/externals/linux/include",
|
||||
"${workspaceRoot}/build/gcc/debug/src"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": "${workspaceFolder}/build/gcc/debug/compile_commands.json"
|
||||
},
|
||||
{
|
||||
"name": "Windows",
|
||||
@@ -78,7 +106,7 @@
|
||||
"includePath": [
|
||||
"${workspaceRoot}/src",
|
||||
"${workspaceRoot}/build/src",
|
||||
"${workspaceRoot}/build/ninja_debug/src",
|
||||
"${workspaceRoot}/build/gcc/debug/src",
|
||||
"${workspaceRoot}/externals/windows/include",
|
||||
"${workspaceRoot}/externals/linux/include",
|
||||
"${workspaceRoot}/externals/windows/vscode/usr/include/c++/6",
|
||||
|
||||
Vendored
+22
-22
@@ -5,7 +5,7 @@
|
||||
"name": "Spark Local",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/build/ninja_debug/server/sparkd",
|
||||
"program": "${workspaceRoot}/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"run",
|
||||
"test",
|
||||
@@ -13,7 +13,7 @@
|
||||
"OutrightVanillaOrder"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceRoot}/build/ninja_debug/server/",
|
||||
"cwd": "${workspaceRoot}/build/gcc/debug/server/",
|
||||
"environment": [
|
||||
{
|
||||
"name": "TZ",
|
||||
@@ -34,14 +34,14 @@
|
||||
"name": "SparkVM Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"-a",
|
||||
"[ilink3]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -82,12 +82,12 @@
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/build/ninja_debug/server/sparkd/sparkd",
|
||||
"program": "${workspaceRoot}/build/gcc/debug/server/sparkd/sparkd",
|
||||
"args": [
|
||||
"run"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceRoot}/build/ninja_debug/src/server/sparkd",
|
||||
"cwd": "${workspaceRoot}/build/gcc/debug/src/server/sparkd",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -166,13 +166,13 @@
|
||||
"name": "Spreader Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[spreader]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -203,13 +203,13 @@
|
||||
"name": "MD Synthetic Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[md][synthetic]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -240,13 +240,13 @@
|
||||
"name": "Spartan Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[spartan_md]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -277,13 +277,13 @@
|
||||
"name": "Matcher Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[matcher]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -314,13 +314,13 @@
|
||||
"name": "Admin Service Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/src/server/sparkd/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/src/server/sparkd/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[admin_service]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/src/server/sparkd/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/src/server/sparkd/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -351,13 +351,13 @@
|
||||
"name": "Limiter Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/src/server/sparkd/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/src/server/sparkd/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[limiter]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/src/server/sparkd/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/src/server/sparkd/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -388,13 +388,13 @@
|
||||
"name": "MD Tests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/server/sparkd",
|
||||
"args": [
|
||||
"test",
|
||||
"[algo]"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server/",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server/",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
@@ -430,7 +430,7 @@
|
||||
"name": "SparkVM attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "/home/bts/spark/build/ninja_debug/src/server/sparkd/sparkd",
|
||||
"program": "/home/bts/spark/build/gcc/debug/src/server/sparkd/sparkd",
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"MIMode": "gdb",
|
||||
"pipeTransport": {
|
||||
@@ -494,7 +494,7 @@
|
||||
"test_join_create_and_takeout_market"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/server",
|
||||
"cwd": "/home/bts/spark/build/gcc/debug/server",
|
||||
"pipeTransport": {
|
||||
"pipeProgram": "c:\\program files\\git\\usr\\bin\\ssh.exe",
|
||||
"pipeArgs": [
|
||||
|
||||
Vendored
+11
-1
@@ -50,7 +50,7 @@
|
||||
{
|
||||
"label": "linux_build",
|
||||
"type": "shell",
|
||||
"command": "docker exec -i ${USER}s_docker bash -c \"cd build/ninja_${input:build_configuration} && ninja\"",
|
||||
"command": "docker exec -i ${USER}s_docker bash -c \"cd build/${input:compiler}/${input:build_configuration} && ninja\"",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -78,6 +78,16 @@
|
||||
"debug",
|
||||
"release"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "compiler",
|
||||
"type": "pickString",
|
||||
"default": "gcc",
|
||||
"description": "Compiler",
|
||||
"options": [
|
||||
"clang",
|
||||
"gcc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+10
-5
@@ -9,16 +9,21 @@ fi
|
||||
export OUT=${BUILD_DIR:-../../../build}/web
|
||||
MODE=manual
|
||||
case "$OUT" in
|
||||
*ninja_release*)
|
||||
*release*)
|
||||
MODE=release;;
|
||||
*ninja_debug*)
|
||||
*debug*)
|
||||
MODE=debug;;
|
||||
*clang_debug*)
|
||||
MODE=clang_debug;;
|
||||
esac
|
||||
COMPILER=gcc
|
||||
case "$OUT" in
|
||||
*clang*)
|
||||
COMPILER=clang;;
|
||||
esac
|
||||
echo MODE=$MODE
|
||||
echo OUT=$OUT
|
||||
|
||||
echo "web build mode is $MODE"
|
||||
echo "web build out is $OUT"
|
||||
# clean
|
||||
rm -rf $OUT/api
|
||||
mkdir -p $OUT/api
|
||||
@@ -53,7 +58,7 @@ $PROTOC --plugin=protoc-gen-service=../../lib/api/service_compiler/plugin.py \
|
||||
|
||||
# run typescript compiler to convert typescript to javascript
|
||||
echo -e \* ${ORANGE} tsc ${NOCOLOR}
|
||||
npx --no-install tsc -p tsconfig.$MODE.json
|
||||
npx --no-install tsc -p tsconfig.$COMPILER.$MODE.json
|
||||
|
||||
# cleanup
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "../../../build/clang_debug/web/api",
|
||||
"outDir": "../../../build/clang/debug/web/api",
|
||||
"removeComments": true,
|
||||
"paths": {
|
||||
"proto": ["../../../../build/clang_debug/web/api/proto"]
|
||||
"proto": ["../../../../build/clang/debug/web/api/proto"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
@@ -2,10 +2,10 @@
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "../../../build/ninja_debug/web/api",
|
||||
"outDir": "../../../build/gcc/debug/web/api",
|
||||
"removeComments": true,
|
||||
"paths": {
|
||||
"proto": ["../../../../build/ninja_debug/web/api/proto"]
|
||||
"proto": ["../../../../build/gcc/debug/web/api/proto"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
@@ -2,10 +2,10 @@
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "../../../build/ninja_release/web/api",
|
||||
"outDir": "../../../build/gcc/release/web/api",
|
||||
"removeComments": true,
|
||||
"paths": {
|
||||
"proto": ["../../../../build/ninja_release/web/api/proto"]
|
||||
"proto": ["../../../../build/gcc/release/web/api/proto"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
@@ -10,5 +10,5 @@ echo %build_type%
|
||||
if "%SPARKVM_PORT%"=="" set SPARKVM_PORT=22
|
||||
python %~dp0\replicator\replicate_to_linux_vm.py
|
||||
echo.
|
||||
ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark/build/ninja_%build_type%/ && touch ../../CMakeLists.txt && time ninja"
|
||||
ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark/build/gcc/%build_type%/ && touch ../../../CMakeLists.txt && time ninja"
|
||||
ENDLOCAL
|
||||
@@ -2,6 +2,5 @@
|
||||
LAST_CORE=`ls -1t /tmp/core_dump_* | head -n1`
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
cgdb --core=$LAST_CORE $SCRIPTPATH/../../build/ninja_debug/src/server/sparkd/sparkd
|
||||
|
||||
|
||||
BUILD_PATH=$(../sparkd_path.sh build gcc debug)
|
||||
cgdb --core=$LAST_CORE $BUILD_PATH
|
||||
@@ -2,19 +2,19 @@
|
||||
DIR="$(dirname "$(readlink -f "$0")")"
|
||||
SRC_ROOT=$DIR/../..
|
||||
|
||||
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
|
||||
|
||||
compiler="gcc"
|
||||
build_type="debug"
|
||||
case "$1" in
|
||||
clang)
|
||||
BUILD_TYPE=clang_debug
|
||||
compiler="clang"
|
||||
;;
|
||||
release)
|
||||
BUILD_TYPE=ninja_release
|
||||
build_type="release"
|
||||
;;
|
||||
*)
|
||||
BUILD_TYPE=ninja_debug
|
||||
;;
|
||||
esac
|
||||
BUILD_CMD="ninja -C $BUILD_ROOT/$BUILD_TYPE"
|
||||
build_path="$(../sparkd_path.sh build $compiler $build_type)"
|
||||
BUILD_CMD="ninja -C $build_path"
|
||||
touch $SRC_ROOT/CMakeLists.txt
|
||||
$DIR/execute_in_docker $BUILD_CMD
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
DIR="$(dirname "$(readlink -f "$0")")"
|
||||
SRC_ROOT=$DIR/../..
|
||||
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
|
||||
cgdb -- -ex start --cd=$BUILD_ROOT/ninja_debug/server --args ./sparkd run
|
||||
SRC_ROOT="$($DIR/../sparkd_path.sh repot-root)"
|
||||
build_path="$(../sparkd_path.sh build gcc debug)"
|
||||
cgdb -- -ex start --cd=$build_path/server --args ./sparkd run
|
||||
@@ -2,6 +2,21 @@
|
||||
DIR="$(dirname "$(readlink -f "$0")")"
|
||||
SRC_ROOT=$DIR/../..
|
||||
|
||||
compiler="gcc"
|
||||
build_type="debug"
|
||||
case "$1" in
|
||||
clang)
|
||||
compiler="clang"
|
||||
;;
|
||||
release)
|
||||
build_type="release"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
build_path="$(../sparkd_path.sh build $compiler $build_type)"
|
||||
BUILD_CMD="ninja -C $build_path"
|
||||
|
||||
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
|
||||
case "$1" in
|
||||
debug)
|
||||
|
||||
@@ -21,14 +21,14 @@ pushd %~dp0\..\src\client\sparkcmd
|
||||
|
||||
dotnet publish -f netcoreapp2.1
|
||||
cd ..\..\..\build\Debug\bin\netcoreapp2.1\publish
|
||||
bash -c "scp * bts@sparkvm:~/spark/build/ninja_%build_type%/server/"
|
||||
bash -c "scp * bts@sparkvm:~/spark/build/gcc/%build_type%/server/"
|
||||
|
||||
copy /Y %~dp0\..\src\client\spark_test\system_test_scripts\*.sh ..\..\net471\
|
||||
|
||||
cd ../../net471
|
||||
bash -c "scp *.sh bts@sparkvm:~/spark/build/ninja_%build_type%/server/"
|
||||
bash -c "scp *.sh bts@sparkvm:~/spark/build/gcc/%build_type%/server/"
|
||||
|
||||
ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark/build/ninja_%build_type%/server && ./%1 %2"
|
||||
ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark/build/gcc/%build_type%/server && ./%1 %2"
|
||||
ENDLOCAL
|
||||
|
||||
popd
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
@if "%SPARKVM_PORT%"=="" set SPARKVM_PORT=22
|
||||
@if "%SPARKVM_RUNMODE%"=="" set SPARKVM_RUNMODE=debug
|
||||
@ssh bts@sparkvm -p %SPARKVM_PORT% "cd /home/bts/spark/build/ninja_%SPARKVM_RUNMODE%/server/ && ./sparkd %*"
|
||||
@ssh bts@sparkvm -p %SPARKVM_PORT% "cd /home/bts/spark/build/gcc/%SPARKVM_RUNMODE%/server/ && ./sparkd %*"
|
||||
+168
-22
@@ -1,29 +1,175 @@
|
||||
#!/bin/bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SRC_ROOT=$DIR/../
|
||||
mkdir -p $SRC_ROOT/build/
|
||||
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
|
||||
|
||||
rm -f $SRC_ROOT/src/web/ui/node_modules
|
||||
rm -f $SRC_ROOT/src/web/api/node_modules
|
||||
ln -s $SRC_ROOT/externals/npm/node_modules $SRC_ROOT/src/web/ui/node_modules
|
||||
ln -s $SRC_ROOT/externals/npm/node_modules $SRC_ROOT/src/web/api/node_modules
|
||||
function print_help_and_exit() {
|
||||
cat <<EOF
|
||||
Usage: setup_builds.sh [OPTIONS] compiler build-type
|
||||
|
||||
rm -rf $BUILD_ROOT/clang_debug
|
||||
mkdir $BUILD_ROOT/clang_debug
|
||||
cd $BUILD_ROOT/clang_debug
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ $SRC_ROOT
|
||||
Positionals:
|
||||
gcc Compile with gcc
|
||||
clang Compile with clang
|
||||
debug Build debug
|
||||
release Build release
|
||||
|
||||
Options:
|
||||
--compiler <clang|gcc> Specify the compiler
|
||||
--type <debug|release> Specify the type of build
|
||||
-f,--force Overwrite existing build directories
|
||||
-h,--help Print this help message and exit
|
||||
|
||||
rm -rf $BUILD_ROOT/ninja_debug
|
||||
mkdir $BUILD_ROOT/ninja_debug
|
||||
cd $BUILD_ROOT/ninja_debug
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ $SRC_ROOT
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
rm -rf $BUILD_ROOT/ninja_release
|
||||
mkdir $BUILD_ROOT/ninja_release
|
||||
cd $BUILD_ROOT/ninja_release
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=g++ $SRC_ROOT
|
||||
function assert_dir() {
|
||||
if [[ ! -d "$1" ]]; then
|
||||
if [[ -n "$2" ]]; then
|
||||
echo "Invalid variable $2: '$1' is not a directory"
|
||||
else
|
||||
echo "'$1' is not a directory"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
rm -f $SRC_ROOT/compile_commands.json
|
||||
ln -s $BUILD_ROOT/clang_debug/compile_commands.json $SRC_ROOT/compile_commands.json
|
||||
# common variables
|
||||
|
||||
tools_path=$(dirname $(readlink -f $0))
|
||||
sparkd_path_cmd=$tools_path/sparkd_path.sh
|
||||
repot_root="$(eval $sparkd_path_cmd repot-root)"
|
||||
externals_root=$repot_root/externals
|
||||
build_root=$(readlink -f $repot_root/build)
|
||||
mkdir -p $repot_root/build/
|
||||
externals_linked=""
|
||||
|
||||
# Link sub dirs in externals to spark repot
|
||||
function ensure_externals_linked() {
|
||||
if [[ -z "$externals_linked" ]]; then
|
||||
assert_dir $repot_root
|
||||
assert_dir $externals_root
|
||||
ext_node_modules=$externals_root/npm/node_modules
|
||||
echo "Initialize sym links to dirs in externals"
|
||||
set -x
|
||||
rm -f $repot_root/src/web/ui/node_modules
|
||||
rm -f $repot_root/src/web/api/node_modules
|
||||
ln -s $ext_node_modules $repot_root/src/web/ui/node_modules
|
||||
ln -s $ext_node_modules $repot_root/src/web/api/node_modules
|
||||
set +x
|
||||
externals_linked=1
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the build directory. Expected arguments: <compiler>, <build_type>
|
||||
# Note: this method assumes the variables 'repot_root' and 'build_root' have
|
||||
# already been properly initialized
|
||||
function setup_build() {
|
||||
assert_dir $repot_root
|
||||
assert_dir $build_root
|
||||
compiler=$1
|
||||
build_type=$2
|
||||
declare -A build_type_args=([debug]="Debug" [release]="Release")
|
||||
|
||||
if [[ (-z "$build_type" || ! ${build_type_args[${build_type}]+1}) ]]; then
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
|
||||
declare -A compiler_args
|
||||
|
||||
if [[ "$build_type" == "debug" ]]; then
|
||||
compiler_args["gcc"]="/usr/lib/ccache/g++"
|
||||
compiler_args["clang"]="/usr/lib/ccache/clang++"
|
||||
elif [[ "$build_type" == "release" ]]; then
|
||||
compiler_args["gcc"]="g++"
|
||||
compiler_args["clang"]="clang++"
|
||||
fi
|
||||
|
||||
if [[ (-z "$compiler" || ! ${compiler_args[$compiler]+1}) ]]; then
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
|
||||
build_dest="$build_root/$compiler/$build_type"
|
||||
|
||||
echo "Set up build: ${compiler} ${build_type}"
|
||||
|
||||
if [[ -z ${force+1} && -d ${build_dest} ]]; then
|
||||
echo "The build directory '${build_dest}' already exists (use -f to overwrite)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ensure_externals_linked
|
||||
|
||||
rm -rf $build_dest
|
||||
mkdir -p $build_dest
|
||||
cd $build_dest
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=${build_type_args[$build_type]} -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=${compiler_args[$compiler]} $repot_root
|
||||
}
|
||||
|
||||
# The while loop below removes arguments (via shift) as it parses them.
|
||||
# Additional information that needs to be extracted from the arguments must be
|
||||
# done so before the loop is executed.
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
declare -l arg="$1"
|
||||
case "$arg" in
|
||||
--compiler)
|
||||
compiler=$2
|
||||
shift 2
|
||||
;;
|
||||
--type)
|
||||
build_type=$2
|
||||
shift 2
|
||||
;;
|
||||
clang)
|
||||
compiler="clang"
|
||||
shift
|
||||
;;
|
||||
gcc)
|
||||
compiler="gcc"
|
||||
shift
|
||||
;;
|
||||
debug)
|
||||
build_type="debug"
|
||||
shift
|
||||
;;
|
||||
release)
|
||||
build_type="release"
|
||||
shift
|
||||
;;
|
||||
-f)
|
||||
force=1
|
||||
shift
|
||||
;;
|
||||
--force)
|
||||
force=1
|
||||
shift
|
||||
;;
|
||||
-h)
|
||||
print_help_and_exit 0
|
||||
;;
|
||||
--help)
|
||||
print_help_and_exit 0
|
||||
;;
|
||||
*)
|
||||
print_help_and_exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$compiler" ]]; then
|
||||
if [[ -n "$build_type" ]]; then
|
||||
setup_build $compiler $build_type
|
||||
else
|
||||
# all builds for the specified compiler
|
||||
setup_build $compiler "debug"
|
||||
setup_build $compiler "release"
|
||||
fi
|
||||
elif [[ -n "$build_type" ]]; then
|
||||
# all builds for the specified build type
|
||||
setup_build "gcc" $build_type
|
||||
setup_build "clang" $build_type
|
||||
else
|
||||
# all builds
|
||||
setup_build "gcc" "debug"
|
||||
setup_build "gcc" "release"
|
||||
setup_build "clang" "debug"
|
||||
setup_build "clang" "release"
|
||||
fi
|
||||
@@ -1 +1 @@
|
||||
setx VS_LINUX_OUTPUT_PATH "/bts/build/gcc_debug/src/server/sparkd/sparkd"
|
||||
setx VS_LINUX_OUTPUT_PATH "/bts/build/gcc/debug/src/server/sparkd/sparkd"
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
#!/bin/bash
|
||||
|
||||
function print_help_and_exit() {
|
||||
cat <<EOF
|
||||
Print paths to core parts of the repository
|
||||
Usage: sparkd_path.sh SUBCOMMAND
|
||||
|
||||
Subcommands:
|
||||
build Print build path
|
||||
repo-root Print repo root path
|
||||
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
function print_build_help_and_exit() {
|
||||
cat <<EOF
|
||||
Print build path
|
||||
Usage: sparkd_path.sh build [OPTIONS] compiler build-type
|
||||
|
||||
Positionals:
|
||||
gcc Print gcc build path
|
||||
clang Print clang build path
|
||||
debug Print debug build path
|
||||
release Print release build path
|
||||
|
||||
Options:
|
||||
--compiler <clang|gcc> Specify the compiler
|
||||
--type <debug|release> Specify the type of build
|
||||
-h,--help Print this help message and exit
|
||||
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
function print_repo_root() {
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd)"
|
||||
}
|
||||
|
||||
function run_repo_root() {
|
||||
print_repo_root
|
||||
}
|
||||
|
||||
function run_build() {
|
||||
compiler="gcc"
|
||||
build_type="release"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--compiler)
|
||||
compiler=$2
|
||||
shift 2
|
||||
;;
|
||||
--type)
|
||||
build_type=$2
|
||||
shift 2
|
||||
;;
|
||||
clang)
|
||||
compiler="clang"
|
||||
shift
|
||||
;;
|
||||
gcc)
|
||||
compiler="gcc"
|
||||
shift
|
||||
;;
|
||||
debug)
|
||||
build_type="debug"
|
||||
shift
|
||||
;;
|
||||
release)
|
||||
build_type="release"
|
||||
shift
|
||||
;;
|
||||
-f)
|
||||
force=1
|
||||
shift
|
||||
;;
|
||||
--force)
|
||||
force=1
|
||||
shift
|
||||
;;
|
||||
-h)
|
||||
print_build_help_and_exit 0
|
||||
;;
|
||||
--help)
|
||||
print_build_help_and_exit 0
|
||||
;;
|
||||
*)
|
||||
print_build_help_and_exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
declare -A compilers=([gcc]="$(which gcc)" [clang]="$(which clang)")
|
||||
declare -A build_types=([debug]="debug" [release]="release")
|
||||
|
||||
if [[ ${compilers[$compiler]+1} ]]; then
|
||||
comp_path=${compilers[$compiler]}
|
||||
else
|
||||
print_build_help_and_exit 1
|
||||
fi
|
||||
|
||||
if [[ ${build_types[$build_type]+1} ]]; then
|
||||
build_type=${build_types[$build_type]}
|
||||
else
|
||||
print_build_help_and_exit 1
|
||||
fi
|
||||
|
||||
src_root="$(print_repo_root)"
|
||||
build_root=$(readlink -f $src_root/build)
|
||||
build_dest="$build_root/$compiler/$build_type"
|
||||
|
||||
echo $build_dest
|
||||
}
|
||||
|
||||
if [[ $1 == "repot-root" ]]; then
|
||||
shift
|
||||
print_repo_root $@
|
||||
elif [[ $1 == "build" ]]; then
|
||||
shift
|
||||
run_build $@
|
||||
else
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
+1
-1
@@ -27,7 +27,7 @@ let build _ =
|
||||
Process.directExec (fun config ->
|
||||
{ config with
|
||||
FileName = "ssh"
|
||||
Arguments = "bts@sparkvm -o StrictHostKeyChecking=no -t \"cd /home/bts/spark/build/ninja_debug/ && touch ../../CMakeLists.txt && time ninja\" "
|
||||
Arguments = "bts@sparkvm -o StrictHostKeyChecking=no -t \"cd /home/bts/spark/build/gcc/debug/ && touch ../../../CMakeLists.txt && time ninja\" "
|
||||
}) |> ignore
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
objdump -d -M intel -S ninja_release/src/server/sparkd/CMakeFiles/sparkd.dir/main.cpp.o
|
||||
objdump -d -M intel -S gcc/release/src/server/sparkd/CMakeFiles/sparkd.dir/main.cpp.o
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||
cd $DIR/../build/ninja_debug/server/
|
||||
cd $(sparkd_path.sh build gcc debug)
|
||||
if [ "$1" = "-b" ]
|
||||
then
|
||||
echo "Waiting..."
|
||||
|
||||
Reference in new issue
Block a user