-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/bombomby/optick
- Loading branch information
Showing
3 changed files
with
79 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
enable_language(CSharp) | ||
|
||
# TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters