diff --git a/configure.py b/configure.py index cc7c2a78a77..6c88df094ad 100755 --- a/configure.py +++ b/configure.py @@ -2185,6 +2185,8 @@ def test_exe_extra_ldflags(): 'os': options.os, 'arch': options.arch, 'compiler': options.compiler, + 'compiler_is_gcc_or_clang': options.compiler == 'gcc' or options.compiler == 'clang', + 'compiler_is_msvc': options.compiler == 'msvc', 'cpu_family': arch.family, 'endian': options.with_endian, 'cpu_is_64bit': arch.wordsize == 64, diff --git a/src/build-data/ninja.in b/src/build-data/ninja.in index 6214287e050..9bfc8ea0d91 100644 --- a/src/build-data/ninja.in +++ b/src/build-data/ninja.in @@ -22,13 +22,55 @@ SCRIPTS_DIR = %{scripts_dir} INSTALLED_LIB_DIR = %{libdir} rule compile_lib - command = %{cxx} %{lib_flags} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} -DBOTAN_IS_BEING_BUILT ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $in %{dash_o}$out +%{if compiler_is_gcc_or_clang} + depfile = $out.d + deps = gcc +%{endif} +%{if compiler_is_msvc} + deps = msvc +%{endif} + command = %{cxx} %{lib_flags} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} -DBOTAN_IS_BEING_BUILT ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $ +%{if compiler_is_gcc_or_clang} + -MD -MF $out.d $ +%{endif} +%{if compiler_is_msvc} + /showIncludes $ +%{endif} + $in %{dash_o}$out rule compile_exe - command = %{cxx} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} -DBOTAN_IS_BEING_BUILT ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $in %{dash_o}$out +%{if compiler_is_gcc_or_clang} + depfile = $out.d + deps = gcc +%{endif} +%{if compiler_is_msvc} + deps = msvc +%{endif} + command = %{cxx} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} -DBOTAN_IS_BEING_BUILT ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $ +%{if compiler_is_gcc_or_clang} + -MD -MF $out.d $ +%{endif} +%{if compiler_is_msvc} + /showIncludes $ +%{endif} + $in %{dash_o}$out rule compile_example_exe - command = %{cxx} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $in %{dash_o}$out +%{if compiler_is_gcc_or_clang} + depfile = $out.d + deps = gcc +%{endif} +%{if compiler_is_msvc} + deps = msvc +%{endif} + command = %{cxx} ${ABI_FLAGS} ${LANG_FLAGS} ${CXXFLAGS} ${WARN_FLAGS} ${isa_flags} %{include_paths} %{dash_c} $ +%{if compiler_is_gcc_or_clang} + -MD -MF $out.d $ +%{endif} +%{if compiler_is_msvc} + /showIncludes $ +%{endif} + $in %{dash_o}$out # The primary target build all: phony %{all_targets} diff --git a/src/editors/vscode/tasks.json b/src/editors/vscode/tasks.json index b13653e8d6b..2df051477d5 100644 --- a/src/editors/vscode/tasks.json +++ b/src/editors/vscode/tasks.json @@ -6,7 +6,7 @@ "detail": "Default ./configure.py invocation for gcc. Run your own if you want.", "group": "build", "type": "shell", - "command": "python3 ./configure.py --cc gcc --compiler-cache=ccache --without-documentation --debug-mode --build-targets=\"static,tests,bogo_shim\"", + "command": "python3 ./configure.py --cc gcc --compiler-cache=ccache --build-tool=ninja --without-documentation --debug-mode --build-targets=\"static,tests,bogo_shim\"", "presentation": { "reveal": "always", "panel": "shared", @@ -22,7 +22,7 @@ "args": [ ] }, - "command": "python ./configure.py --cc msvc --compiler-cache=sccache.exe --without-documentation --debug-mode --build-targets=\"static,tests\"", + "command": "python ./configure.py --cc msvc --compiler-cache=sccache.exe --build-tool=ninja --link-method=hardlink --without-documentation --debug-mode --build-targets=\"static,tests\"", "presentation": { "reveal": "always", "panel": "shared",