diff --git a/cmake/modules/SetUpWindows.cmake b/cmake/modules/SetUpWindows.cmake index 09879e526b2af..a2ddaa23f49cf 100644 --- a/cmake/modules/SetUpWindows.cmake +++ b/cmake/modules/SetUpWindows.cmake @@ -31,14 +31,17 @@ elseif(MSVC) math(EXPR VC_MINOR "${MSVC_VERSION} % 100") #---Select compiler flags---------------------------------------------------------------- + if(winrtdebug AND dev) + set(ROOT_RTC_FLAGS "-RTC1") + endif() set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-MD -O2 -Ob2 -Z7 -DNDEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-MD -O1 -Ob1 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-MD -O2 -Ob2 -DNDEBUG") - set(CMAKE_CXX_FLAGS_DEBUG "-MDd -Od -Ob0 -Z7") + set(CMAKE_CXX_FLAGS_DEBUG "-MDd -Od -Ob0 -Z7 ${ROOT_RTC_FLAGS}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-MD -O2 -Ob2 -Z7 -DNDEBUG") set(CMAKE_C_FLAGS_MINSIZEREL "-MD -O1 -Ob1 -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE "-MD -O2 -Ob2 -DNDEBUG") - set(CMAKE_C_FLAGS_DEBUG "-MDd -Od -Ob0 -Z7") + set(CMAKE_C_FLAGS_DEBUG "-MDd -Od -Ob0 -Z7 ${ROOT_RTC_FLAGS}") if(winrtdebug) if (CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/cmake/scripts/compiledata.win32.in b/cmake/scripts/compiledata.win32.in index cff8d4d3558f5..2f64008f983ed 100644 --- a/cmake/scripts/compiledata.win32.in +++ b/cmake/scripts/compiledata.win32.in @@ -7,8 +7,8 @@ #define COMPILERVERSSTR "@CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@" #define MAKESHAREDLIB "cl $Opt -nologo -TP -c @CMAKE_CXX_FLAGS@ @BLDCXXFLAGS@ $IncludePath $SourceFiles -Fo$ObjectFiles && bindexplib $LibName $ObjectFiles > $BuildDir\\$LibName.def && lib -nologo -MACHINE:@MACHINE_ARCH@ -out:$BuildDir\\$LibName.lib $ObjectFiles -def:$BuildDir\\$LibName.def && link -nologo $ObjectFiles -DLL -out:$BuildDir\\$LibName.dll $BuildDir\\$LibName.exp -LIBPATH:%ROOTSYS%\\lib $LinkedLibs libCore.lib kernel32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib && if EXIST \"$BuildDir\\$LibName.dll.manifest\" ( mt -nologo -manifest \"$BuildDir\\$LibName.dll.manifest\" \"-outputresource:$BuildDir\\$LibName.dll;2\" && del \"$BuildDir\\$LibName.dll.manifest\" )" #define MAKEEXE "cl -nologo -TP -Iinclude -I..\\include -c $Opt @CMAKE_CXX_FLAGS@ @BLDCXXFLAGS@ $IncludePath $SourceFiles && link -opt:ref @CMAKE_EXE_FLAGS@ $ObjectFiles $LinkedLibs advapi32.lib -out:$ExeName && if EXIST \"$ExeName.exe.manifest\" ( mt -nologo -manifest \"$ExeName.exe.manifest\" \"-outputresource:$ExeName.exe;1\" && del \"$ExeName.exe.manifest\" )" -#define CXXOPT "@CMAKE_CXX_FLAGS_RELEASE@" -#define CXXDEBUG "@CMAKE_CXX_FLAGS_DEBUG@" +#define CXXOPT "@CMAKE_CXX_FLAGS_RELEASE@ @BLDCXXFLAGS@" +#define CXXDEBUG "@CMAKE_CXX_FLAGS_DEBUG@ @BLDCXXFLAGS@" #define ROOTBUILD "release" #define LINKEDLIBS "-LIBPATH:%ROOTSYS%\\lib libCore.lib " #define INCLUDEPATH "-I%ROOTSYS%\\include" diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index a02fba94e1c5b..7b169455ccab3 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -2885,6 +2885,12 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, mode = kDebug; } } +#if defined(_MSC_VER) && defined(_DEBUG) + // if ROOT is build in debug mode, ACLiC must also build in debug mode + // for compatibility reasons + if (!(mode & kDebug)) + mode |= kDebug; +#endif UInt_t verboseLevel = verbose ? 7 : gDebug; Bool_t flatBuildDir = (fAclicProperties & kFlatBuildDir) || (opt && strchr(opt,'-')!=nullptr); @@ -3729,12 +3735,18 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, TString optdebFlags; if (mode & kDebug) optdebFlags = fFlagsDebug + " "; +#ifdef WIN32 + else +#endif if (mode & kOpt) optdebFlags += fFlagsOpt; cmd.ReplaceAll("$Opt", optdebFlags); #ifdef WIN32 R__FixLink(cmd); cmd.ReplaceAll("-std=", "-std:"); + if (mode & kDebug) { + cmd.ReplaceAll(" && link ", "&& link /DEBUG "); + } #endif TString testcmd = fMakeExe; diff --git a/core/dictgen/src/rootcling_impl.cxx b/core/dictgen/src/rootcling_impl.cxx index e6e56da005292..32faf06421946 100644 --- a/core/dictgen/src/rootcling_impl.cxx +++ b/core/dictgen/src/rootcling_impl.cxx @@ -2135,6 +2135,10 @@ void AddPlatformDefines(std::vector &clingArgs) clingArgs.push_back(platformDefines); snprintf(platformDefines, 64, "-DG__VISUAL=%ld", (long)_MSC_VER); clingArgs.push_back(platformDefines); +#if defined(_WIN64) && defined(_DEBUG) + snprintf(platformDefines, 64, "-D_ITERATOR_DEBUG_LEVEL=0"); + clingArgs.push_back(platformDefines); +#endif #endif } diff --git a/graf2d/win32gdk/gdk/src/glib/gmessages.c b/graf2d/win32gdk/gdk/src/glib/gmessages.c index ac1fef072dc15..c915f4e8fbd13 100644 --- a/graf2d/win32gdk/gdk/src/glib/gmessages.c +++ b/graf2d/win32gdk/gdk/src/glib/gmessages.c @@ -544,7 +544,8 @@ g_logv (const gchar *log_domain, #endif # if defined (_MSC_VER) && defined (_DEBUG) /* let's see the call stack ... */ - __asm int 3 + /* __asm int 3 */ + __debugbreak(); # endif abort (); #endif /* !G_ENABLE_DEBUG || !SIGTRAP */ diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index 7131b1453dcf8..dbcdf669b9d3f 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -176,8 +176,12 @@ if(builtin_llvm) if(CMAKE_BUILD_TYPE MATCHES "Debug" OR LLVM_BUILD_TYPE MATCHES "(Debug|RelWithDebInfo)") set(LLVM_ENABLE_ASSERTIONS TRUE) + if(NOT DEFINED LLVM_ENABLE_DUMP) + set(LLVM_ENABLE_DUMP TRUE) + endif() else() set(LLVM_ENABLE_ASSERTIONS FALSE) + set(LLVM_ENABLE_DUMP FALSE) endif() endif() diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp index 3d7fcf58231bf..594df5b62243e 100644 --- a/interpreter/cling/lib/Interpreter/CIFactory.cpp +++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp @@ -849,6 +849,9 @@ namespace { PPOpts.addMacroDef("__CLING__GNUC_MINOR__=" ClingStringify(__GNUC_MINOR__)); #elif defined(_MSC_VER) PPOpts.addMacroDef("__CLING__MSVC__=" ClingStringify(_MSC_VER)); +#if defined(_WIN64) && defined(_DEBUG) + PPOpts.addMacroDef("_ITERATOR_DEBUG_LEVEL=0"); +#endif #endif // https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html diff --git a/io/io/src/TFile.cxx b/io/io/src/TFile.cxx index 4565fa1f45019..a4162bffbe56c 100644 --- a/io/io/src/TFile.cxx +++ b/io/io/src/TFile.cxx @@ -3222,6 +3222,11 @@ void TFile::MakeProject(const char *dirname, const char * /*classes*/, } else { sOpt = gSystem->GetFlagsDebug(); } +#if defined(_MSC_VER) && defined(_DEBUG) + // if ROOT is build in debug mode, ACLiC must also build in debug mode + // for compatibility reasons + sOpt = gSystem->GetFlagsDebug(); +#endif cmd.ReplaceAll("$Opt", sOpt); if (genreflex) {