diff --git a/.gitignore b/.gitignore index 9b361656aa..0fe6d5985e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ Makefile.Debug Makefile.Release object_script.*.Debug object_script.*.Release +compile_commands.json stxxl.errlog stxxl.log diff --git a/tools/unix/build_omim.sh b/tools/unix/build_omim.sh index c50f6ddacf..fea88c396c 100755 --- a/tools/unix/build_omim.sh +++ b/tools/unix/build_omim.sh @@ -10,8 +10,8 @@ OPT_GCC= OPT_TARGET= OPT_PATH= OPT_STANDALONE= - -while getopts ":cdrstagp:" opt; do +OPT_COMPILE_DATABASE= +while getopts ":cdrstagjp:" opt; do case $opt in d) OPT_DEBUG=1 @@ -35,12 +35,16 @@ while getopts ":cdrstagp:" opt; do g) OPT_GCC=1 ;; + j) + OPT_COMPILE_DATABASE=1 + CMAKE_CONFIG="${CMAKE_CONFIG:-} -DCMAKE_EXPORT_COMPILE_COMMANDS=YES" + ;; p) OPT_PATH="$OPTARG" ;; *) echo "This tool builds omim" - echo "Usage: $0 [-d] [-r] [-c] [-s] [-t] [-a] [-g] [-p PATH] [target1 target2 ...]" + echo "Usage: $0 [-d] [-r] [-c] [-s] [-t] [-a] [-g] [-j] [-p PATH] [target1 target2 ...]" echo echo -e "-d\tBuild omim-debug" echo -e "-r\tBuild omim-release" @@ -50,6 +54,7 @@ while getopts ":cdrstagp:" opt; do echo -e "-a\tBuild standalone desktop app (only for MacOS X platform)" echo -e "-g\tForce use GCC (only for MacOS X platform)" echo -e "-p\tDirectory for built binaries" + echo -e "-j\tGenerate compile_commands.json" echo "By default both configurations is built." exit 1 ;; @@ -78,7 +83,7 @@ if ! grep "DEFAULT_URLS_JSON" "$OMIM_PATH/private.h" >/dev/null 2>/dev/null; the exit 2 fi -DEVTOOLSET_PATH=/opt/rh/devtoolset-6 +DEVTOOLSET_PATH=/opt/rh/devtoolset-7 if [ -d "$DEVTOOLSET_PATH" ]; then export MANPATH= source "$DEVTOOLSET_PATH/enable" @@ -147,6 +152,9 @@ build() exit 1 fi fi + if [ -n "$OPT_COMPILE_DATABASE" ]; then + cp "$DIRNAME/compile_commands.json" "$OMIM_PATH" + fi } [ -n "$OPT_DEBUG" ] && build Debug