0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-25 23:40:51 +08:00

CMake script rework

This commit is contained in:
Rokas Kupstys 2017-06-08 17:13:32 +03:00
parent c608665e06
commit f007152d2c
7 changed files with 181 additions and 371 deletions

View File

@ -1,47 +1,32 @@
project(profiling_tool)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.12.1)
project(easy_profiler CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(
EASY_ROOT
${CMAKE_CURRENT_LIST_DIR}
)
set(EASY_PROGRAM_VERSION_MAJOR 1)
set(EASY_PROGRAM_VERSION_MINOR 3)
set(EASY_PROGRAM_VERSION_PATCH 0)
set(EASY_PRODUCT_VERSION_STRING "${EASY_PROGRAM_VERSION_MAJOR}.${EASY_PROGRAM_VERSION_MINOR}.${EASY_PROGRAM_VERSION_PATCH}")
set(OUTPUT_DIR
${EASY_ROOT}/bin
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${OUTPUT_DIR}
)
# set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/sdk)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${OUTPUT_DIR}
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${OUTPUT_DIR}
)
include_directories(
easy_profiler_core/include
)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wno-reorder -Wno-braced-scalar-init -pedantic -O3" )
else()
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
)
endif(UNIX)
#set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/sdk)
macro(easy_define_target_option TARGET SOURCE_OPTION TARGET_DEFINITION)
if (${SOURCE_OPTION})
set(_VALUE 1)
else ()
set(_VALUE 0)
endif ()
target_compile_options(${TARGET} PUBLIC -D${TARGET_DEFINITION}=${_VALUE})
endmacro()
add_subdirectory(easy_profiler_core)
add_subdirectory(profiler_gui)
add_subdirectory(sample)
add_subdirectory(reader)
if (NOT EASY_PROFILER_NO_SAMPLES)
add_subdirectory(sample)
add_subdirectory(reader)
endif ()

View File

@ -1,142 +1,51 @@
cmake_minimum_required(VERSION 2.8)
project(easy_profiler CXX)
IF (NOT DEFINED LIB_NAME)
SET(LIB_NAME ${PROJECT_NAME})
ENDIF()
if(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR)
file (STRINGS ${CMAKE_CURRENT_LIST_DIR}/version.info EASY_PRODUCT_VERSION_STRING)
string(REPLACE "." ";" VERSION_LIST ${EASY_PRODUCT_VERSION_STRING})
list(GET VERSION_LIST 0 EASY_PROGRAM_VERSION_MAJOR)
list(GET VERSION_LIST 1 EASY_PROGRAM_VERSION_MINOR)
list(GET VERSION_LIST 2 EASY_PROGRAM_VERSION_PATCH)
# EasyProfiler version
add_definitions(
-DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR}
-DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR}
-DEASY_PROFILER_VERSION_PATCH=${EASY_PROGRAM_VERSION_PATCH}
)
# EasyProfiler version
set(EASY_PROGRAM_VERSION_MAJOR ${EASY_PROGRAM_VERSION_MAJOR} PARENT_SCOPE)
set(EASY_PROGRAM_VERSION_MINOR ${EASY_PROGRAM_VERSION_MINOR} PARENT_SCOPE)
set(EASY_PROGRAM_VERSION_PATCH ${EASY_PROGRAM_VERSION_PATCH} PARENT_SCOPE)
endif(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR)
message(STATUS "")
message(STATUS "EASY_PROFILER.Core version = ${EASY_PROGRAM_VERSION_MAJOR}.${EASY_PROGRAM_VERSION_MINOR}.${EASY_PROGRAM_VERSION_PATCH}")
message(STATUS "EASY_PROFILER.Core version = ${EASY_PRODUCT_VERSION_STRING}")
message(STATUS "")
set(EASY_DEFAULT_PORT 28077 CACHE STRING "Default listening port")
set(EASY_OPTION_LISTEN OFF CACHE BOOL "Enable automatic startListen on startup")
set(EASY_OPTION_PROFILE_SELF OFF CACHE BOOL "Enable self profiling (measure time for internal storage expand)")
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_PREDEFINED_COLORS OFF 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")
if (WIN32)
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")
endif (WIN32)
set(BUILD_WITH_CHRONO_STEADY_CLOCK OFF CACHE BOOL "Use std::chrono::steady_clock as a timer" )
set(BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK OFF CACHE BOOL "Use std::chrono::high_resolution_clock as a timer")
# EasyProfiler options:----------------------------------------------
set(EASY_DEFAULT_PORT 28077) # Default listening port
set(EASY_OPTION_LISTEN OFF) # Enable automatic startListen on startup
set(EASY_OPTION_PROFILE_SELF OFF) # Enable self profiling (measure time for internal storage expand)
set(EASY_OPTION_PROFILE_SELF_BLOCKS_ON OFF) # Storage expand default status (profiler::ON or profiler::OFF)
set(EASY_OPTION_LOG OFF) # Print errors to stderr
set(EASY_OPTION_PREDEFINED_COLORS ON) # Use predefined set of colors (see profiler_colors.h)
# If you want to use your own colors palette you can turn this option OFF
message(STATUS "-------- EASY_PROFILER OPTIONS: --------")
if (BUILD_WITH_CHRONO_STEADY_CLOCK)
message(STATUS " Use std::chrono::steady_clock as a timer")
elseif (BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK)
message(STATUS " Use std::chrono::high_resolution_clock as a timer")
else ()
if (WIN32)
message(STATUS " Use QueryPerformanceCounter as a timer")
else ()
message(STATUS " Use rtdsc as a timer")
endif ()
endif ()
option(BUILD_WITH_CHRONO_STEADY_CLOCK "Use std::chrono::steady_clock as a timer" OFF)
option(BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK "Use std::chrono::high_resolution_clock as a timer" OFF)
if(BUILD_WITH_CHRONO_STEADY_CLOCK)
add_definitions(
-DEASY_CHRONO_STEADY_CLOCK
)
endif(BUILD_WITH_CHRONO_STEADY_CLOCK)
if(BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK)
add_definitions(
-DEASY_CHRONO_HIGHRES_CLOCK
)
endif(BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK)
if(WIN32)
set(EASY_OPTION_EVENT_TRACING ON) # Enable event tracing by default
set(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING ON) # Set low priority for event tracing thread
endif(WIN32)
MESSAGE(STATUS "EASY_PROFILER OPTIONS:--------------")
if(BUILD_WITH_CHRONO_STEADY_CLOCK)
MESSAGE(STATUS " Use std::chrono::steady_clock as a timer")
elseif(BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK)
MESSAGE(STATUS " Use std::chrono::high_resolution_clock as a timer")
else()
if(WIN32)
MESSAGE(STATUS " Use QueryPerformanceCounter as a timer")
else()
MESSAGE(STATUS " Use rtdsc as a timer")
endif(WIN32)
endif(BUILD_WITH_CHRONO_STEADY_CLOCK)
MESSAGE(STATUS " Default listening port = ${EASY_DEFAULT_PORT}")
MESSAGE(STATUS " Auto-start listening = ${EASY_OPTION_LISTEN}")
MESSAGE(STATUS " Profile self = ${EASY_OPTION_PROFILE_SELF}")
MESSAGE(STATUS " Profile self blocks initial status = ${EASY_OPTION_PROFILE_SELF_BLOCKS_ON}")
if(WIN32)
MESSAGE(STATUS " Event tracing = ${EASY_OPTION_EVENT_TRACING}")
if(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
MESSAGE(STATUS " Event tracing has low priority = Yes")
else()
MESSAGE(STATUS " Event tracing has low priority = No")
endif(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
endif(WIN32)
MESSAGE(STATUS " Log messages = ${EASY_OPTION_LOG}")
MESSAGE(STATUS " Use EasyProfiler colors palette = ${EASY_OPTION_PREDEFINED_COLORS}")
MESSAGE(STATUS "END EASY_PROFILER OPTIONS.----------")
MESSAGE(STATUS "")
# END EasyProfiler options.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
add_definitions(-DEASY_DEFAULT_PORT=${EASY_DEFAULT_PORT})
if(EASY_OPTION_LISTEN)
add_definitions(-DEASY_OPTION_START_LISTEN_ON_STARTUP=1)
else()
add_definitions(-DEASY_OPTION_START_LISTEN_ON_STARTUP=0)
endif(EASY_OPTION_LISTEN)
if(EASY_OPTION_PROFILE_SELF)
add_definitions(-DEASY_OPTION_MEASURE_STORAGE_EXPAND=1)
if(EASY_OPTION_PROFILE_SELF_BLOCKS_ON)
add_definitions(-DEASY_OPTION_STORAGE_EXPAND_BLOCKS_ON=true)
else()
add_definitions(-DEASY_OPTION_STORAGE_EXPAND_BLOCKS_ON=false)
endif(EASY_OPTION_PROFILE_SELF_BLOCKS_ON)
else()
add_definitions(-DEASY_OPTION_MEASURE_STORAGE_EXPAND=0)
endif(EASY_OPTION_PROFILE_SELF)
if(WIN32)
if(EASY_OPTION_EVENT_TRACING)
add_definitions(-DEASY_OPTION_EVENT_TRACING_ENABLED=true)
else()
add_definitions(-DEASY_OPTION_EVENT_TRACING_ENABLED=false)
endif(EASY_OPTION_EVENT_TRACING)
if(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
add_definitions(-DEASY_OPTION_LOW_PRIORITY_EVENT_TRACING=true)
else()
add_definitions(-DEASY_OPTION_LOW_PRIORITY_EVENT_TRACING=false)
endif(EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
endif(WIN32)
if(EASY_OPTION_LOG)
add_definitions(-DEASY_OPTION_LOG_ENABLED=1)
else()
add_definitions(-DEASY_OPTION_LOG_ENABLED=0)
endif(EASY_OPTION_LOG)
if(EASY_OPTION_PREDEFINED_COLORS)
add_definitions(-DEASY_OPTION_BUILTIN_COLORS=1)
else()
add_definitions(-DEASY_OPTION_BUILTIN_COLORS=0)
endif(EASY_OPTION_PREDEFINED_COLORS)
message(STATUS " Default listening port = ${EASY_DEFAULT_PORT}")
message(STATUS " Auto-start listening = ${EASY_OPTION_LISTEN}")
message(STATUS " Profile self = ${EASY_OPTION_PROFILE_SELF}")
message(STATUS " Profile self blocks initial status = ${EASY_OPTION_PROFILE_SELF_BLOCKS_ON}")
if (WIN32)
message(STATUS " Event tracing = ${EASY_OPTION_EVENT_TRACING}")
if (EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
message(STATUS " Event tracing has low priority = Yes")
else ()
message(STATUS " Event tracing has low priority = No")
endif (EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
endif (WIN32)
message(STATUS " Log messages = ${EASY_OPTION_LOG}")
message(STATUS " Use EasyProfiler colors palette = ${EASY_OPTION_PREDEFINED_COLORS}")
message(STATUS " Library type: ${EASY_OPTION_LIB_TYPE}")
message(STATUS "------ END EASY_PROFILER OPTIONS -------")
message(STATUS "")
set(CPP_FILES
block.cpp
@ -147,27 +56,24 @@ set(CPP_FILES
)
set(H_FILES
profile_manager.h
spin_lock.h
event_trace_win.h
current_time.h
)
include_directories(
include
)
set(INCLUDE_FILES
include/easy/profiler.h
include/easy/reader.h
include/easy/easy_net.h
include/easy/easy_socket.h
include/easy/easy_compiler_support.h
include/easy/profiler_aux.h
include/easy/profiler_colors.h
include/easy/reader.h
include/easy/serialized_block.h
include/easy/profiler.h
include/easy/reader.h
include/easy/easy_net.h
include/easy/easy_socket.h
include/easy/easy_compiler_support.h
include/easy/profiler_aux.h
include/easy/profiler_colors.h
include/easy/reader.h
include/easy/serialized_block.h
)
source_group(include FILES ${INCLUDE_FILES})
set(SOURCES
@ -175,44 +81,55 @@ set(SOURCES
${H_FILES}
${INCLUDE_FILES}
)
add_definitions(
-D_BUILD_PROFILER
-DBUILD_WITH_EASY_PROFILER
add_library(easy_profiler ${EASY_OPTION_LIB_TYPE} ${SOURCES} resources.rc)
target_include_directories(easy_profiler PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> # <prefix>/include
)
target_compile_definitions(easy_profiler PRIVATE
-D_BUILD_PROFILER=1
#-DEASY_PROFILER_API_DISABLED # uncomment this to disable profiler api only (you will have to rebuild only easy_profiler)
)
target_compile_definitions(easy_profiler PUBLIC
-DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR}
-DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR}
-DEASY_PROFILER_VERSION_PATCH=${EASY_PROGRAM_VERSION_PATCH}
-DEASY_DEFAULT_PORT=${EASY_DEFAULT_PORT}
-DBUILD_WITH_EASY_PROFILER=1
)
if(WIN32)
add_definitions(
-D_WINSOCK_DEPRECATED_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS
)
endif(WIN32)
easy_define_target_option(easy_profiler BUILD_WITH_CHRONO_STEADY_CLOCK EASY_CHRONO_STEADY_CLOCK)
easy_define_target_option(easy_profiler BUILD_WITH_CHRONO_HIGH_RESOLUTION_CLOCK EASY_CHRONO_HIGHRES_CLOCK)
easy_define_target_option(easy_profiler EASY_OPTION_LISTEN EASY_OPTION_START_LISTEN_ON_STARTUP)
easy_define_target_option(easy_profiler EASY_OPTION_PROFILE_SELF EASY_OPTION_MEASURE_STORAGE_EXPAND)
easy_define_target_option(easy_profiler EASY_OPTION_PROFILE_SELF_BLOCKS_ON EASY_OPTION_STORAGE_EXPAND_BLOCKS_ON)
if (WIN32)
easy_define_target_option(easy_profiler EASY_OPTION_EVENT_TRACING EASY_OPTION_EVENT_TRACING_ENABLED)
easy_define_target_option(easy_profiler EASY_OPTION_LOW_PRIORITY_EVENT_TRACING EASY_OPTION_LOW_PRIORITY_EVENT_TRACING)
endif ()
easy_define_target_option(easy_profiler EASY_OPTION_LOG EASY_OPTION_LOG_ENABLED)
easy_define_target_option(easy_profiler EASY_OPTION_PREDEFINED_COLORS EASY_OPTION_BUILTIN_COLORS)
add_library(${LIB_NAME} SHARED ${SOURCES} resources.rc)
if (UNIX)
target_compile_options(easy_profiler PRIVATE -Wall -Wno-long-long -Wno-reorder -Wno-braced-scalar-init -pedantic -O3)
target_link_libraries(easy_profiler pthread)
elseif (WIN32)
target_compile_definitions(easy_profiler PRIVATE -D_WIN32_WINNT=0x0600 -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_link_libraries(easy_profiler ws2_32 psapi)
endif ()
if (MINGW)
add_definitions(
-D_WIN32_WINNT=0x0600
-DSTRSAFE_NO_DEPRECATE
)
set (PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32 psapi)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (CMAKE_VERSION VERSION_LESS "3.1")
if (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_definitions(easy_profiler PRIVATE -DSTRSAFE_NO_DEPRECATE)
endif ()
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(${LIB_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
endif (MINGW)
if(UNIX)
set(PLATFORM_LIBS ${PLATFORM_LIBS} pthread)
endif(UNIX)
target_link_libraries(${LIB_NAME} ${PLATFORM_LIBS})
set_target_properties(easy_profiler PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
endif ()
####
# Installation
@ -230,11 +147,11 @@ include(CMakePackageConfigHelpers)
include(InstallRequiredSystemLibraries)
write_basic_package_version_file(
"${version_config}"
VERSION
${EASY_PRODUCT_VERSION_STRING}
COMPATIBILITY
SameMajorVersion
"${version_config}"
VERSION
${EASY_PRODUCT_VERSION_STRING}
COMPATIBILITY
SameMajorVersion
)
configure_package_config_file(
@ -266,12 +183,12 @@ install(
install(
TARGETS
${LIB_NAME}
EXPORT
${targets_export_name}
easy_profiler
EXPORT
${targets_export_name}
DESTINATION
bin
INCLUDES DESTINATION "${include_install_dir}"
INCLUDES DESTINATION "${include_install_dir}"
)
install(
@ -279,4 +196,4 @@ install(
DESTINATION "${config_install_dir}"
)
target_compile_definitions(easy_profiler PUBLIC BUILD_WITH_EASY_PROFILER)
target_compile_definitions(easy_profiler PUBLIC )

View File

@ -48,18 +48,18 @@ The Apache License, Version 2.0 (the "License");
#if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER <= 1800
// std::chrono for MSVC2013 is broken - it has very low resolution of 16ms
// restrict usage of std::chrono
# ifdef EASY_CHRONO_HIGHRES_CLOCK
# if EASY_CHRONO_HIGHRES_CLOCK
# undef EASY_CHRONO_HIGHRES_CLOCK
# endif
# ifdef EASY_CHRONO_STEADY_CLOCK
# if EASY_CHRONO_STEADY_CLOCK
# undef EASY_CHRONO_STEADY_CLOCK
# endif
#endif
#if defined(EASY_CHRONO_HIGHRES_CLOCK)
#if EASY_CHRONO_HIGHRES_CLOCK
# include <chrono>
# define EASY_CHRONO_CLOCK std::chrono::high_resolution_clock
#elif defined(EASY_CHRONO_STEADY_CLOCK)
#elif EASY_CHRONO_STEADY_CLOCK
# include <chrono>
# define EASY_CHRONO_CLOCK std::chrono::steady_clock
#elif defined(_WIN32)
@ -74,7 +74,7 @@ The Apache License, Version 2.0 (the "License");
static inline profiler::timestamp_t getCurrentTime()
{
#if defined(EASY_CHRONO_HIGHRES_CLOCK) || defined(EASY_CHRONO_STEADY_CLOCK)
#if EASY_CHRONO_HIGHRES_CLOCK || EASY_CHRONO_STEADY_CLOCK
return (profiler::timestamp_t)EASY_CHRONO_CLOCK::now().time_since_epoch().count();
#elif defined(_WIN32)
//see https://msdn.microsoft.com/library/windows/desktop/dn553408(v=vs.85).aspx

View File

@ -1 +0,0 @@
1.3.0

View File

@ -1,7 +1,3 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
project(profiler_gui CXX)
#set(CMAKE_PREFIX_PATH f:/qt/5.5/5.6/msvc2013_64/lib/cmake)
set(CMAKE_AUTOMOC ON)
@ -10,78 +6,48 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets)
if(Qt5Widgets_FOUND)
if(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR)
set(EASY_PROGRAM_VERSION_MAJOR 1)
set(EASY_PROGRAM_VERSION_MINOR 0)
set(EASY_PROGRAM_VERSION_PATCH 0)
set(EASY_PRODUCT_VERSION_STRING "1.0.0")
endif(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR)
add_definitions(
-DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR}
-DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR}
-DEASY_PROFILER_VERSION_PATCH=${EASY_PROGRAM_VERSION_PATCH}
)
add_executable(${PROJECT_NAME}
main.cpp
blocks_graphics_view.h
blocks_graphics_view.cpp
blocks_tree_widget.h
blocks_tree_widget.cpp
descriptors_tree_widget.h
descriptors_tree_widget.cpp
easy_chronometer_item.h
easy_chronometer_item.cpp
easy_frame_rate_viewer.h
easy_frame_rate_viewer.cpp
easy_graphics_item.h
easy_graphics_item.cpp
easy_graphics_scrollbar.h
easy_graphics_scrollbar.cpp
easy_qtimer.h
easy_qtimer.cpp
globals.h
globals.cpp
globals_qobjects.cpp
main_window.h
main_window.cpp
tree_widget_item.h
tree_widget_item.cpp
tree_widget_loader.h
tree_widget_loader.cpp
resources.qrc
resources.rc
)
if (MINGW)
add_definitions(
-D_WIN32_WINNT=0x0600
-DSTRSAFE_NO_DEPRECATE
if (Qt5Widgets_FOUND)
if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") AND WIN32)
set(APPLICATION_PLATFORM WIN32)
endif ()
add_executable(profiler_gui ${APPLICATION_PLATFORM}
main.cpp
blocks_graphics_view.h
blocks_graphics_view.cpp
blocks_tree_widget.h
blocks_tree_widget.cpp
descriptors_tree_widget.h
descriptors_tree_widget.cpp
easy_chronometer_item.h
easy_chronometer_item.cpp
easy_frame_rate_viewer.h
easy_frame_rate_viewer.cpp
easy_graphics_item.h
easy_graphics_item.cpp
easy_graphics_scrollbar.h
easy_graphics_scrollbar.cpp
easy_qtimer.h
easy_qtimer.cpp
globals.h
globals.cpp
globals_qobjects.cpp
main_window.h
main_window.cpp
tree_widget_item.h
tree_widget_item.cpp
tree_widget_loader.h
tree_widget_loader.cpp
resources.qrc
resources.rc
)
set (SPECIAL_LIB ${SPECIAL_LIB} ws2_32 psapi)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (CMAKE_VERSION VERSION_LESS "3.1")
if (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(profiler_gui Qt5::Widgets easy_profiler)
if (WIN32)
target_compile_definitions(profiler_gui PRIVATE -D_WIN32_WINNT=0x0600)
endif ()
if (MINGW)
target_compile_definitions(profiler_gui PRIVATE -DSTRSAFE_NO_DEPRECATE)
endif ()
else ()
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
endif (MINGW)
if(UNIX)
set(SPECIAL_LIB ${SPECIAL_LIB} pthread)
endif(UNIX)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets easy_profiler ${SPECIAL_LIB})
else()
message(STATUS "INFO\n\n\tQt5 not found! Generating EasyProfiler projects without GUI.\n")
endif(Qt5Widgets_FOUND)
message(STATUS "INFO\n\n\tQt5 not found! Generating EasyProfiler projects without GUI.\n")
endif ()

View File

@ -1,21 +1,3 @@
project(profiler_reader)
set(CPP_FILES
main.cpp
)
set(SOURCES
${CPP_FILES}
)
add_executable(${PROJECT_NAME} ${SOURCES})
if(MINGW OR UNIX)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif(MINGW OR UNIX)
if(UNIX)
set(SPEC_LIB ${SPEC_LIB} pthread)
endif(UNIX)
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
add_executable(profiler_reader main.cpp)
target_link_libraries(profiler_reader easy_profiler)

View File

@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(profiler_sample CXX)
set(CPP_FILES
main.cpp
)
@ -9,47 +6,11 @@ set(SOURCES
${CPP_FILES}
)
include_directories(
../easy_profiler_core/include
)
link_directories(${CMAKE_SOURCE_DIR}/../bin)
add_executable(${PROJECT_NAME} ${SOURCES})
add_executable(profiler_sample ${SOURCES})
target_link_libraries(profiler_sample easy_profiler)
set(DISABLED_PROFILER_NAME
"${PROJECT_NAME}_disabled_profiler"
)
add_executable(${DISABLED_PROFILER_NAME} ${SOURCES})
if (MINGW)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (CMAKE_VERSION VERSION_LESS "3.1")
if (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif (UNIX OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
else ()
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
set_target_properties(${DISABLED_PROFILER_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
endif (MINGW)
if(UNIX)
set(SPEC_LIB ${SPEC_LIB} pthread)
endif(UNIX)
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
target_link_libraries(${DISABLED_PROFILER_NAME} easy_profiler ${SPEC_LIB})
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_WITH_EASY_PROFILER)
add_executable(profiler_sample_disabled_profiler ${SOURCES})
target_link_libraries(profiler_sample_disabled_profiler easy_profiler)
target_compile_definitions(profiler_sample_disabled_profiler PRIVATE DISABLE_EASY_PROFILER)