0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

Fix for static build.

Fix for c++11 on apple systems.
This commit is contained in:
Rokas Kupstys 2017-06-13 18:57:53 +03:00
parent ba09dc290e
commit 941f7a4b45
2 changed files with 19 additions and 7 deletions

View File

@ -8,7 +8,7 @@ set(EASY_OPTION_PROFILE_SELF OFF CACHE BOOL "Enable self profilin
set(EASY_OPTION_PROFILE_SELF_BLOCKS_ON OFF CACHE BOOL "Storage expand default status (profiler::ON or profiler::OFF)") set(EASY_OPTION_PROFILE_SELF_BLOCKS_ON OFF CACHE BOOL "Storage expand default status (profiler::ON or profiler::OFF)")
set(EASY_OPTION_LOG OFF CACHE BOOL "Print errors to stderr") set(EASY_OPTION_LOG OFF CACHE BOOL "Print errors to stderr")
set(EASY_OPTION_PREDEFINED_COLORS ON CACHE BOOL "Use predefined set of colors (see profiler_colors.h). If you want to use your own colors palette you can turn this option OFF") set(EASY_OPTION_PREDEFINED_COLORS ON CACHE BOOL "Use predefined set of colors (see profiler_colors.h). If you want to use your own colors palette you can turn this option OFF")
set(EASY_OPTION_LIB_TYPE SHARED CACHE BOOL "easy_profiler library type. SHARED or STATIC") set(EASY_OPTION_LIB_STATIC OFF CACHE BOOL "easy_profiler static library.")
if (WIN32) if (WIN32)
set(EASY_OPTION_EVENT_TRACING ON CACHE BOOL "Enable event tracing by default") set(EASY_OPTION_EVENT_TRACING ON CACHE BOOL "Enable event tracing by default")
set(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING ON CACHE BOOL "Set low priority for event tracing thread") set(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING ON CACHE BOOL "Set low priority for event tracing thread")
@ -43,6 +43,11 @@ if (WIN32)
endif (WIN32) endif (WIN32)
message(STATUS " Log messages = ${EASY_OPTION_LOG}") message(STATUS " Log messages = ${EASY_OPTION_LOG}")
message(STATUS " Use EasyProfiler colors palette = ${EASY_OPTION_PREDEFINED_COLORS}") message(STATUS " Use EasyProfiler colors palette = ${EASY_OPTION_PREDEFINED_COLORS}")
if (EASY_OPTION_LIB_STATIC)
set(EASY_OPTION_LIB_TYPE STATIC)
else ()
set(EASY_OPTION_LIB_TYPE SHARED)
endif ()
message(STATUS " Library type: ${EASY_OPTION_LIB_TYPE}") message(STATUS " Library type: ${EASY_OPTION_LIB_TYPE}")
message(STATUS "------ END EASY_PROFILER OPTIONS -------") message(STATUS "------ END EASY_PROFILER OPTIONS -------")
message(STATUS "") message(STATUS "")
@ -91,6 +96,9 @@ target_compile_definitions(easy_profiler PRIVATE
-D_BUILD_PROFILER=1 -D_BUILD_PROFILER=1
#-DEASY_PROFILER_API_DISABLED # uncomment this to disable profiler api only (you will have to rebuild only easy_profiler) #-DEASY_PROFILER_API_DISABLED # uncomment this to disable profiler api only (you will have to rebuild only easy_profiler)
) )
if (EASY_OPTION_LIB_STATIC)
target_compile_definitions(easy_profiler PUBLIC -DEASY_PROFILER_STATIC=1)
endif ()
target_compile_definitions(easy_profiler PUBLIC target_compile_definitions(easy_profiler PUBLIC
-DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR} -DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR}
-DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR} -DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR}
@ -123,12 +131,16 @@ if (MINGW)
target_compile_definitions(easy_profiler PRIVATE -DSTRSAFE_NO_DEPRECATE) target_compile_definitions(easy_profiler PRIVATE -DSTRSAFE_NO_DEPRECATE)
endif () endif ()
if (CMAKE_VERSION VERSION_LESS "3.1") if (APPLE)
if (NOT MSVC) target_compile_options(easy_profiler PUBLIC -std=gnu++11)
target_compile_options(easy_profiler PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
endif ()
else () else ()
set_target_properties(easy_profiler PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) if (CMAKE_VERSION VERSION_LESS "3.1")
if (NOT MSVC)
target_compile_options(easy_profiler PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
endif ()
else ()
set_target_properties(easy_profiler PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
endif ()
endif () endif ()
#### ####

View File

@ -55,7 +55,7 @@
//#define EASY_CODE_WRAP(Code) Code //#define EASY_CODE_WRAP(Code) Code
#ifdef _WIN32 #if defined(_WIN32) && !defined(EASY_PROFILER_STATIC)
// Visual Studio and MinGW // Visual Studio and MinGW
# ifdef _BUILD_PROFILER # ifdef _BUILD_PROFILER
# define PROFILER_API __declspec(dllexport) # define PROFILER_API __declspec(dllexport)