mirror of
https://github.com/yse/easy_profiler.git
synced 2025-01-14 00:27:55 +08:00
Merge branch 'develop' of https://github.com/yse/easy_profiler into develop
This commit is contained in:
commit
e388c8e08e
@ -4,33 +4,12 @@ cmake_minimum_required(VERSION 2.8)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
set(
|
||||
ROOT
|
||||
EASY_ROOT
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
|
||||
file (STRINGS ${ROOT}/version.info PRODUCT_VERSION_STRING)
|
||||
string(REPLACE "." ";" VERSION_LIST ${PRODUCT_VERSION_STRING})
|
||||
|
||||
list(GET VERSION_LIST 0 PROGRAM_VERSION_MAJOR)
|
||||
list(GET VERSION_LIST 1 PROGRAM_VERSION_MINOR)
|
||||
list(GET VERSION_LIST 2 PROGRAM_VERSION_PATCH)
|
||||
|
||||
message(STATUS "PROGRAM_VERSION_MAJOR: ${PROGRAM_VERSION_MAJOR}")
|
||||
message(STATUS "PROGRAM_VERSION_MINOR: ${PROGRAM_VERSION_MINOR}")
|
||||
message(STATUS "PROGRAM_VERSION_PATCH: ${PROGRAM_VERSION_PATCH}")
|
||||
|
||||
# EasyProfiler version
|
||||
add_definitions(
|
||||
-DEASY_PROFILER_VERSION_MAJOR=${PROGRAM_VERSION_MAJOR}
|
||||
-DEASY_PROFILER_VERSION_MINOR=${PROGRAM_VERSION_MINOR}
|
||||
-DEASY_PROFILER_VERSION_PATCH=${PROGRAM_VERSION_PATCH}
|
||||
-DEASY_PROFILER_PRODUCT_VERSION=\"v${PRODUCT_VERSION_STRING}\"
|
||||
)
|
||||
# EasyProfiler version
|
||||
|
||||
set(OUTPUT_DIR
|
||||
${ROOT}/bin
|
||||
${EASY_ROOT}/bin
|
||||
)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
||||
@ -46,7 +25,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
|
||||
)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
easy_profiler_core/include
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
@ -60,7 +39,9 @@ endif(UNIX)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/sdk)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(easy_profiler_core)
|
||||
add_subdirectory(profiler_gui)
|
||||
|
||||
add_subdirectory(sample)
|
||||
add_subdirectory(reader)
|
||||
add_subdirectory(profiler_gui)
|
||||
|
||||
|
94
easy_profiler_core/CMakeLists.txt
Normal file
94
easy_profiler_core/CMakeLists.txt
Normal file
@ -0,0 +1,94 @@
|
||||
project(easy_profiler)
|
||||
|
||||
set(CPP_FILES
|
||||
block.cpp
|
||||
profile_manager.cpp
|
||||
reader.cpp
|
||||
event_trace_win.cpp
|
||||
easy_socket.cpp
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
source_group(include FILES ${INCLUDE_FILES})
|
||||
|
||||
|
||||
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)
|
||||
|
||||
message(STATUS "EASY_PROGRAM_VERSION_MAJOR: ${EASY_PROGRAM_VERSION_MAJOR}")
|
||||
message(STATUS "EASY_PROGRAM_VERSION_MINOR: ${EASY_PROGRAM_VERSION_MINOR}")
|
||||
message(STATUS "EASY_PROGRAM_VERSION_PATCH: ${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)
|
||||
|
||||
set(SOURCES
|
||||
${CPP_FILES}
|
||||
${H_FILES}
|
||||
${INCLUDE_FILES}
|
||||
)
|
||||
add_definitions(
|
||||
-D_BUILD_PROFILER
|
||||
-DBUILD_WITH_EASY_PROFILER
|
||||
#-DEASY_PROFILER_API_DISABLED # uncomment this to disable profiler api only (you will have to rebuild only easy_profiler)
|
||||
)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if (UNIX)
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
|
||||
endif (UNIX)
|
||||
else ()
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
endif (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES} resources.rc)
|
||||
|
||||
if(UNIX)
|
||||
set(PLATFORM_LIBS pthread)
|
||||
endif(UNIX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${PLATFORM_LIBS})
|
@ -47,6 +47,7 @@
|
||||
#include "event_trace_win.h"
|
||||
#include "current_time.h"
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <signal.h>
|
||||
#endif
|
||||
@ -66,6 +67,10 @@ using namespace profiler;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH)
|
||||
|
||||
# define EASY_VERSION_INT(v_major, v_minor, v_patch) ((static_cast<uint32_t>(v_major) << 24) | (static_cast<uint32_t>(v_minor) << 16) | static_cast<uint32_t>(v_patch))
|
||||
extern const uint32_t PROFILER_SIGNATURE = ('E' << 24) | ('a' << 16) | ('s' << 8) | 'y';
|
||||
extern const uint32_t EASY_CURRENT_VERSION = EASY_VERSION_INT(EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH);
|
@ -1,4 +1,12 @@
|
||||
1 VERSIONINFO
|
||||
|
||||
# define EASY_STRINGIFY(a) #a
|
||||
# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a)
|
||||
|
||||
#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH)
|
||||
|
||||
FILEVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH
|
||||
PRODUCTVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH
|
||||
BEGIN
|
@ -8,7 +8,22 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Widgets)
|
||||
|
||||
if(Qt5Widgets_FOUND)
|
||||
|
||||
if( NOT DEFINED EASY_PRODUCT_VERSION_STRING)
|
||||
set(EASY_PROGRAM_VERSION_MAJOR 0)
|
||||
set(EASY_PROGRAM_VERSION_MINOR 0)
|
||||
set(EASY_PROGRAM_VERSION_PATCH 0)
|
||||
set(EASY_PRODUCT_VERSION_STRING "0.0.0")
|
||||
endif()
|
||||
|
||||
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
|
||||
@ -48,3 +63,9 @@ if(UNIX)
|
||||
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)
|
||||
|
||||
|
@ -2,6 +2,14 @@ IDI_ICON1 ICON DISCARDABLE "icons/logo.ico"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH
|
||||
PRODUCTVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH
|
||||
|
||||
# define EASY_STRINGIFY(a) #a
|
||||
# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a)
|
||||
|
||||
#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \
|
||||
EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH)
|
||||
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
|
@ -1,44 +0,0 @@
|
||||
project(easy_profiler)
|
||||
|
||||
set(CPP_FILES
|
||||
block.cpp
|
||||
profile_manager.cpp
|
||||
reader.cpp
|
||||
event_trace_win.cpp
|
||||
easy_socket.cpp
|
||||
)
|
||||
|
||||
set(H_FILES
|
||||
${ROOT}/include/easy/profiler.h
|
||||
${ROOT}/include/easy/reader.h
|
||||
${ROOT}/include/easy/easy_net.h
|
||||
${ROOT}/include/easy/easy_socket.h
|
||||
profile_manager.h
|
||||
spin_lock.h
|
||||
event_trace_win.h
|
||||
current_time.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
${CPP_FILES}
|
||||
${H_FILES}
|
||||
)
|
||||
add_definitions(
|
||||
-D_BUILD_PROFILER
|
||||
-DBUILD_WITH_EASY_PROFILER
|
||||
#-DEASY_PROFILER_API_DISABLED # uncomment this to disable profiler api only (you will have to rebuild only easy_profiler)
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES} resources.rc)
|
||||
|
||||
if(UNIX)
|
||||
set(PLATFORM_LIBS pthread)
|
||||
endif(UNIX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${PLATFORM_LIBS})
|
Loading…
x
Reference in New Issue
Block a user