Skip to content

Commit 4015f46

Browse files
authored
Adding a new flag to tell Visual Studio to include debugging information (simdjson#1026)
in the release builds. This makes it easier to profile inside Intel VTune when needed.
1 parent 770cee7 commit 4015f46

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/simdjson-flags.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
7575
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
7676
#endif()
7777

78-
78+
option(SIMDJSON_VISUAL_STUDIO_BUILD_WITH_DEBUG_INFO_FOR_PROFILING "Under Visual Studio, add Zi to the compile flag and DEBUG to the link file to add debugging information to the release build for easier profiling inside tools like VTune" OFF)
7979
if(MSVC)
8080
if("${MSVC_TOOLSET_VERSION}" STREQUAL "140")
8181
# Visual Studio 2015 issues warnings and we tolerate it, cmake -G"Visual Studio 14" ..
@@ -84,6 +84,10 @@ else()
8484
# Recent version of Visual Studio expected (2017, 2019...). Prior versions are unsupported.
8585
target_compile_options(simdjson-internal-flags INTERFACE /WX /W3 /sdl /w34714) # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4714?view=vs-2019
8686
endif()
87+
if(SIMDJSON_VISUAL_STUDIO_BUILD_WITH_DEBUG_INFO_FOR_PROFILING)
88+
target_link_options(simdjson-flags INTERFACE /DEBUG )
89+
target_compile_options(simdjson-flags INTERFACE /Zi )
90+
endif()
8791
else()
8892
target_compile_options(simdjson-internal-flags INTERFACE -fPIC)
8993
target_compile_options(simdjson-internal-flags INTERFACE -Werror -Wall -Wextra -Weffc++)

0 commit comments

Comments
 (0)