Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bombomby/optick
Browse files Browse the repository at this point in the history
  • Loading branch information
bombomby committed Jul 12, 2019
2 parents 213300d + ba3b698 commit 447ffc0
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 36 deletions.
109 changes: 74 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,87 @@
project (Optick)
cmake_minimum_required (VERSION 3.0)
cmake_minimum_required(VERSION 3.2)
project(Optick LANGUAGES CXX)

# Options: GAPI
option(BUILD_VULKAN "Built-in support for Vulkan" OFF)
option(BUILD_D3D12 "Built-in support for DicrectX 12" OFF)
# Options: Other
option(BUILD_FIBERS "Built-in support for Fibers" OFF)

set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 11)

set (CMAKE_CXX_STANDARD 11)
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Build)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
# hacks for standalone builds with visual studio
if(MSVC AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS "Standalone build")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Build")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(standalone ON)
else()
set(standalone OFF)
endif()


# Sources
file(GLOB OPTICK_SRC "src/*.*")
source_group("OptickCore" FILES ${OPTICK_SRC})


# Enabled
option(OPTICK_ENABLED "Enable profiling with Optick" ON)
if(NOT OPTICK_ENABLED)
message(STATUS "Optick is disabled")
# add dummy target as a replacement
add_library(OptickCore STATIC ${OPTICK_SRC})
target_include_directories(OptickCore PUBLIC "src")
target_compile_definitions(OptickCore PUBLIC USE_OPTICK=0)
return()
endif()


#OptickCore
file(GLOB OPTICK_SOURCE ${PROJECT_SOURCE_DIR}/src/*.*)
SET(OPTICK_SRC ${OPTICK_SOURCE})
source_group("OptickCore" FILES ${OPTICK_SOURCE})
include_directories ("${PROJECT_SOURCE_DIR}/src")
# Options
option(OPTICK_USE_VULKAN "Built-in support for Vulkan" OFF)
option(OPTICK_USE_D3D12 "Built-in support for DirectX 12" OFF)
option(OPTICK_BUILD_GUI_APP "Build Optick gui viewer app" OFF)
option(OPTICK_BUILD_CONSOLE_SAMPLE "Build Optick console sample app" ${standalone})

if(BUILD_VULKAN)
include_directories("$(VULKAN_SDK)/Include")

# OptickCore
add_library(OptickCore SHARED ${OPTICK_SRC})
target_include_directories(OptickCore PUBLIC "src")
target_compile_definitions(OptickCore PUBLIC OPTICK_EXPORTS=1)
if(OPTICK_USE_VULKAN)
message(STATUS "Optick uses Vulkan")
target_include_directories(OptickCore PRIVATE "$(VULKAN_SDK)/Include")
else()
target_compile_definitions(OptickCore PRIVATE OPTICK_ENABLE_GPU_VULKAN=0)
endif()
if(OPTICK_USE_D3D12)
message(STATUS "Optick uses DirectX 12")
else()
target_compile_definitions(OptickCore PRIVATE OPTICK_ENABLE_GPU_D3D12=0)
endif()
if(OPTICK_USE_D3D12 OR OPTICK_USE_VULKAN)
target_compile_definitions(OptickCore PRIVATE OPTICK_ENABLE_GPU=1)
else()
add_definitions(-DBRO_ENABLE_GPU_VULKAN=0)
endif()
target_compile_definitions(OptickCore PRIVATE OPTICK_ENABLE_GPU=0)
endif()


set(EXTRA_LIBS ${EXTRA_LIBS} OptickCore)
if(NOT MSVC)
set(EXTRA_LIBS ${EXTRA_LIBS} pthread)
endif()


if(!BUILD_D3D12)
add_definitions(-DBRO_ENABLE_GPU_D3D12=0)
endif()
# Gui App
if(MSVC AND OPTICK_BUILD_GUI_APP)
add_subdirectory(gui)
endif()

add_library(OptickCore ${OPTICK_SRC})

set (EXTRA_LIBS ${EXTRA_LIBS} OptickCore pthread)
# Console App
if(OPTICK_BUILD_CONSOLE_SAMPLE)
file(GLOB TEST_ENGINE_SRC "samples/Common/TestEngine/*.*")
source_group("TestEngine" FILES ${TEST_ENGINE_SRC})
add_executable(ConsoleApp "samples/ConsoleApp/main.cpp" ${TEST_ENGINE_SRC})
target_include_directories(ConsoleApp PRIVATE "samples/Common/TestEngine")
target_link_libraries(ConsoleApp ${EXTRA_LIBS})
set_target_properties(ConsoleApp PROPERTIES FOLDER Samples)
endif()

#ConsoleApp
file(GLOB TEST_ENGINE_SOURCE ${PROJECT_SOURCE_DIR}/samples/Common/TestEngine/*.*)
SET(TEST_ENGINE_SRC ${TEST_ENGINE_SOURCE})
source_group("TestEngine" FILES ${TEST_ENGINE_SRC})
include_directories("${PROJECT_SOURCE_DIR}/samples/Common/TestEngine")
add_executable(ConsoleApp ${PROJECT_SOURCE_DIR}/samples/ConsoleApp/main.cpp ${TEST_ENGINE_SRC})
target_link_libraries (ConsoleApp ${EXTRA_LIBS})
set_target_properties (ConsoleApp PROPERTIES
FOLDER Samples
)
4 changes: 4 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.8)
enable_language(CSharp)

# TODO
2 changes: 1 addition & 1 deletion src/optick_core.win.h
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ CaptureStatus::Type ETW::Start(Mode::Type mode, int frequency, const ThreadList&
}

ZeroMemory(&logFile, sizeof(EVENT_TRACE_LOGFILE));
logFile.LoggerName = KERNEL_LOGGER_NAME;
logFile.LoggerName = (LPSTR)KERNEL_LOGGER_NAME;
logFile.ProcessTraceMode = (PROCESS_TRACE_MODE_REAL_TIME | PROCESS_TRACE_MODE_EVENT_RECORD | PROCESS_TRACE_MODE_RAW_TIMESTAMP);
logFile.EventRecordCallback = OnRecordEvent;
logFile.BufferCallback = OnBufferRecord;
Expand Down

0 comments on commit 447ffc0

Please sign in to comment.