diff --git a/examples/physics_2d.cpp b/examples/physics_2d.cpp index be688e36..0267e52e 100644 --- a/examples/physics_2d.cpp +++ b/examples/physics_2d.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include @@ -198,7 +198,7 @@ struct physics_2d_app ~physics_2d_app() { - util::profiler::dump(); + prof::profiler::dump(); } void on_resize(int width, int height) override @@ -265,7 +265,7 @@ struct physics_2d_app void update() override { - util::profiler prof("update"); + prof::profiler prof("update"); float MOTOR = 15.f; diff --git a/libs/gfx/CMakeLists.txt b/libs/gfx/CMakeLists.txt index 10318061..d9b7e32e 100644 --- a/libs/gfx/CMakeLists.txt +++ b/libs/gfx/CMakeLists.txt @@ -9,7 +9,7 @@ file(GLOB_RECURSE PSEMEK_GFX_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "sou psemek_add_library(psemek-gfx ${PSEMEK_GFX_HEADERS} ${PSEMEK_GFX_SOURCES}) target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(psemek-gfx PUBLIC psemek-util psemek-geom psemek-cg psemek-random OpenGL::GL PNG::PNG) +target_link_libraries(psemek-gfx PUBLIC psemek-util psemek-geom psemek-cg psemek-random psemek-io psemek-log OpenGL::GL PNG::PNG) if(NOT KHR_PLATFORM_FILE) message(STATUS "KHR/khrplatform.h not found, using a substitute header") target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/extra/khr/include") diff --git a/libs/gfx/source/painter.cpp b/libs/gfx/source/painter.cpp index ccc6c16d..81f8c25f 100644 --- a/libs/gfx/source/painter.cpp +++ b/libs/gfx/source/painter.cpp @@ -5,7 +5,6 @@ #include #include #include -#include static const char vertex_source[] = R"(#version 330 diff --git a/libs/phys/CMakeLists.txt b/libs/phys/CMakeLists.txt index db5c6437..253ce54b 100644 --- a/libs/phys/CMakeLists.txt +++ b/libs/phys/CMakeLists.txt @@ -3,4 +3,4 @@ file(GLOB_RECURSE PSEMEK_PHYS_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "so psemek_add_library(psemek-phys ${PSEMEK_PHYS_HEADERS} ${PSEMEK_PHYS_SOURCES}) target_include_directories(psemek-phys PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(psemek-phys PUBLIC psemek-util psemek-geom psemek-cg) +target_link_libraries(psemek-phys PUBLIC psemek-util psemek-geom psemek-cg psemek-prof) diff --git a/libs/phys/source/engine_2d.cpp b/libs/phys/source/engine_2d.cpp index e8452b27..42f4f88e 100644 --- a/libs/phys/source/engine_2d.cpp +++ b/libs/phys/source/engine_2d.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/libs/prof/CMakeLists.txt b/libs/prof/CMakeLists.txt new file mode 100644 index 00000000..dff881bd --- /dev/null +++ b/libs/prof/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB_RECURSE PSEMEK_PROF_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp") +file(GLOB_RECURSE PSEMEK_PROF_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp") + +psemek_add_library(psemek-prof ${PSEMEK_PROF_HEADERS} ${PSEMEK_PROF_SOURCES}) +target_include_directories(psemek-prof PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_link_libraries(psemek-prof PUBLIC psemek-log psemek-util) diff --git a/libs/util/include/psemek/util/profiler.hpp b/libs/prof/include/psemek/prof/profiler.hpp similarity index 87% rename from libs/util/include/psemek/util/profiler.hpp rename to libs/prof/include/psemek/prof/profiler.hpp index 758a2662..8db78d97 100644 --- a/libs/util/include/psemek/util/profiler.hpp +++ b/libs/prof/include/psemek/prof/profiler.hpp @@ -4,7 +4,7 @@ #include -namespace psemek::util +namespace psemek::prof { struct profiler @@ -28,4 +28,4 @@ namespace psemek::util } -#define profile_function [[maybe_unused]] ::psemek::util::profiler prof ## __LINE__ (__PRETTY_FUNCTION__) +#define profile_function [[maybe_unused]] ::psemek::prof::profiler prof ## __LINE__ (__PRETTY_FUNCTION__) diff --git a/libs/util/source/profiler.cpp b/libs/prof/source/profiler.cpp similarity index 97% rename from libs/util/source/profiler.cpp rename to libs/prof/source/profiler.cpp index 2dced95c..23808c5a 100644 --- a/libs/util/source/profiler.cpp +++ b/libs/prof/source/profiler.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -11,7 +11,7 @@ #include #include -namespace psemek::util +namespace psemek::prof { namespace @@ -22,7 +22,7 @@ namespace psemek::util profiler_tree * parent = nullptr; std::mutex * mutex = nullptr; - statistics execution_time; + util::statistics execution_time; std::map children; std::vector::iterator> children_list; diff --git a/libs/util/CMakeLists.txt b/libs/util/CMakeLists.txt index 0cbaeed7..7821099f 100644 --- a/libs/util/CMakeLists.txt +++ b/libs/util/CMakeLists.txt @@ -6,6 +6,6 @@ file(GLOB_RECURSE PSEMEK_UTIL_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "so psemek_add_library(psemek-util ${PSEMEK_UTIL_HEADERS} ${PSEMEK_UTIL_SOURCES}) target_include_directories(psemek-util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(psemek-util PUBLIC psemek-log ${CMAKE_THREAD_LIBS_INIT} Boost::boost) +target_link_libraries(psemek-util PUBLIC ${CMAKE_THREAD_LIBS_INIT} Boost::boost) psemek_glob_tests(psemek-util tests)