diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..b044f920d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/microprofile/microprofile"] + path = external/microprofile/microprofile + url = https://github.com/jonasmr/microprofile.git diff --git a/CMakeLists.txt b/CMakeLists.txt index ee3345e18..2d5fa3449 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,8 @@ endif() # Create a rw_interface TARGET that holds all compiler options include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake") +add_subdirectory(external) + add_subdirectory(rwcore) add_subdirectory(rwengine) add_subdirectory(rwgame) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 000000000..de3bbe458 --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,3 @@ +if(ENABLE_PROFILING) + add_subdirectory(microprofile) +endif() diff --git a/external/microprofile/CMakeLists.txt b/external/microprofile/CMakeLists.txt new file mode 100644 index 000000000..3552df525 --- /dev/null +++ b/external/microprofile/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(microprofile STATIC + microprofile/microprofile.h + microprofile/microprofile_html.h + microprofile/microprofile.cpp +) + +target_include_directories(microprofile + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/microprofile" +) + +target_compile_definitions(microprofile + PUBLIC + MICROPROFILE_GPU_TIMERS=0 +) + +find_package(Threads REQUIRED) +target_link_libraries(microprofile + PUBLIC + Threads::Threads +) + +add_library(microprofile::microprofile ALIAS microprofile) diff --git a/external/microprofile/microprofile b/external/microprofile/microprofile new file mode 160000 index 000000000..b49ae8026 --- /dev/null +++ b/external/microprofile/microprofile @@ -0,0 +1 @@ +Subproject commit b49ae80262b206a579808dc3e442f0d8aafe81e9 diff --git a/rwengine/CMakeLists.txt b/rwengine/CMakeLists.txt index 546f090ab..07c132e73 100644 --- a/rwengine/CMakeLists.txt +++ b/rwengine/CMakeLists.txt @@ -151,6 +151,13 @@ target_link_libraries(rwengine OpenAL::OpenAL ) +if (ENABLE_PROFILING) + target_link_libraries(rwengine + PUBLIC + microprofile::microprofile + ) +endif() + target_include_directories(rwengine PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src"