mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-28 01:04:41 +08:00
More convenient build scripts.
This commit is contained in:
parent
80ebd76116
commit
5537eb290d
@ -4,33 +4,12 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
set(
|
set(
|
||||||
ROOT
|
EASY_ROOT
|
||||||
${CMAKE_CURRENT_LIST_DIR}
|
${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
|
set(OUTPUT_DIR
|
||||||
${ROOT}/bin
|
${EASY_ROOT}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
||||||
@ -61,6 +40,8 @@ endif(UNIX)
|
|||||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/sdk)
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/sdk)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(profiler_gui)
|
||||||
|
|
||||||
add_subdirectory(sample)
|
add_subdirectory(sample)
|
||||||
add_subdirectory(reader)
|
add_subdirectory(reader)
|
||||||
add_subdirectory(profiler_gui)
|
|
||||||
|
@ -8,7 +8,23 @@ set(CMAKE_AUTOMOC ON)
|
|||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR 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}
|
||||||
|
-DEASY_PROFILER_PRODUCT_VERSION=\"v${EASY_PRODUCT_VERSION_STRING}\"
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME}
|
add_executable(${PROJECT_NAME}
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -46,3 +62,9 @@ if(UNIX)
|
|||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets easy_profiler ${SPECIAL_LIB})
|
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)
|
||||||
|
|
||||||
|
@ -9,19 +9,55 @@ set(CPP_FILES
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(H_FILES
|
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
|
profile_manager.h
|
||||||
spin_lock.h
|
spin_lock.h
|
||||||
event_trace_win.h
|
event_trace_win.h
|
||||||
current_time.h
|
current_time.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(DEFINED EASY_ROOT)
|
||||||
|
set(INCLUDE_FILES
|
||||||
|
${EASY_ROOT}/include/easy/profiler.h
|
||||||
|
${EASY_ROOT}/include/easy/reader.h
|
||||||
|
${EASY_ROOT}/include/easy/easy_net.h
|
||||||
|
${EASY_ROOT}/include/easy/easy_socket.h
|
||||||
|
)
|
||||||
|
source_group(include FILES ${INCLUDE_FILES})
|
||||||
|
endif(DEFINED EASY_ROOT)
|
||||||
|
|
||||||
|
if(NOT DEFINED EASY_PRODUCT_VERSION_STRING)
|
||||||
|
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}
|
||||||
|
-DEASY_PROFILER_PRODUCT_VERSION=\"v${EASY_PRODUCT_VERSION_STRING}\"
|
||||||
|
)
|
||||||
|
# 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)
|
||||||
|
set(EASY_PRODUCT_VERSION_STRING ${EASY_PRODUCT_VERSION_STRING} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endif(NOT DEFINED EASY_PRODUCT_VERSION_STRING)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
${CPP_FILES}
|
${CPP_FILES}
|
||||||
${H_FILES}
|
${H_FILES}
|
||||||
|
${INCLUDE_FILES}
|
||||||
)
|
)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-D_BUILD_PROFILER
|
-D_BUILD_PROFILER
|
||||||
@ -30,9 +66,9 @@ add_definitions(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
)
|
)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED ${SOURCES} resources.rc)
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} resources.rc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user