mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2024-11-25 00:53:43 +00:00
Detect compiler to use.
For example if you run the script from dindexer/clang_debug you will tell cmake to make a debug build using clang. You can also use gcc_debug but there is no way to specify a particular version.
This commit is contained in:
parent
a10982533e
commit
08a6c0d73d
2 changed files with 20 additions and 4 deletions
|
@ -10,4 +10,6 @@ exec "$script_path/export_compile_commands" \
|
||||||
-DDINDEXER_WITH_NICE_MEDIA_TYPES=OFF \
|
-DDINDEXER_WITH_NICE_MEDIA_TYPES=OFF \
|
||||||
-DDINDEXER_NATIVE_RELEASE=ON \
|
-DDINDEXER_NATIVE_RELEASE=ON \
|
||||||
-DDINDEXER_CXX11_ABI=OFF \
|
-DDINDEXER_CXX11_ABI=OFF \
|
||||||
-DDINDEXER_DB_OWNER_NAME=dindexer-user
|
-DDINDEXER_DB_OWNER_NAME=dindexer-user \
|
||||||
|
-DDINDEXER_ENABLED_BACKENDS=redis,postgresql \
|
||||||
|
-DDINDEXER_CONFIG_FILE=$(realpath --no-symlinks --canonicalize-missing $PWD/..)/dindexer.yml
|
||||||
|
|
|
@ -22,16 +22,30 @@ if [ -z "$project_path" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_name=$(pwd | sed -r "s_$build_dir/$project_name/([^/]+).*\$_\1_")
|
config_name=$(pwd | sed -r "s@$build_dir/$project_name/([^/_]+_)?([^/]+).*\$@\2@")
|
||||||
|
compiler_name=$(pwd | sed -r "s@$build_dir/$project_name/([^/_]+_)?([^/]+).*\$@\1@")
|
||||||
|
compiler_option=""
|
||||||
|
if [ -n "$compiler_name" ]; then
|
||||||
|
compiler_name="${compiler_name%?}"
|
||||||
|
case "$compiler_name" in
|
||||||
|
"clang")
|
||||||
|
compiler_option="CXX=clang++ CC=clang"
|
||||||
|
;;
|
||||||
|
"gcc")
|
||||||
|
compiler_option="CXX=g++ CC=gcc"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
config_option=""
|
config_option=""
|
||||||
if [ -n "$config_name" ]; then
|
if [ -n "$config_name" ]; then
|
||||||
config_name="$(tr '[:lower:]' '[:upper:]' <<< ${config_name:0:1})${config_name:1}"
|
config_name="$(tr '[:lower:]' '[:upper:]' <<< ${config_name:0:1})${config_name:1}"
|
||||||
config_option="-DCMAKE_BUILD_TYPE=$config_name"
|
config_option="-DCMAKE_BUILD_TYPE=$config_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$config_option" $@ "$project_path"
|
eval $compiler_option cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$config_option" $@ "$project_path"
|
||||||
|
|
||||||
if [ -f "$project_path/$json_file" ]; then
|
if [ -h "$project_path/$json_file" ]; then
|
||||||
unlink "$project_path/$json_file"
|
unlink "$project_path/$json_file"
|
||||||
fi
|
fi
|
||||||
work_dir="$PWD"
|
work_dir="$PWD"
|
||||||
|
|
Loading…
Reference in a new issue