diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | include/cru/common/format.hpp | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 48 | ||||
-rw-r--r-- | src/ui/CMakeLists.txt | 26 | ||||
-rw-r--r-- | src/win/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/win/graph/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/win/native/CMakeLists.txt | 19 |
7 files changed, 110 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index db155296..9403b9fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,6 @@ project(CruUI) set(CMAKE_CXX_STANDARD 17) +set(CRU_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) + add_subdirectory(src) diff --git a/include/cru/common/format.hpp b/include/cru/common/format.hpp index f085635a..ecc4b30b 100644 --- a/include/cru/common/format.hpp +++ b/include/cru/common/format.hpp @@ -99,6 +99,6 @@ inline std::wstring_view FormatToString(const wchar_t* string, inline std::string_view FormatToString(const char* string, details::TypeTag<std::string>) { - return std::string(string); + return std::string_view(string); } } // namespace cru::util diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b2209bb3..fc5dd99e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,53 @@ -add_subdirectory(ui) +set(CRU_BASE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/common) +add_library(cru_base INTERFACE) +target_sources(cru_base INTERFACE + ${CRU_BASE_INCLUDE_DIR}/auto_delete.hpp + ${CRU_BASE_INCLUDE_DIR}/base.hpp + ${CRU_BASE_INCLUDE_DIR}/endable.hpp + ${CRU_BASE_INCLUDE_DIR}/event.hpp + ${CRU_BASE_INCLUDE_DIR}/format.hpp + ${CRU_BASE_INCLUDE_DIR}/pre_config.hpp + ${CRU_BASE_INCLUDE_DIR}/ui_base.hpp +) +target_include_directories(cru_base INTERFACE ${CRU_INCLUDE_DIR}) + +set(CRU_PLATFORM_BASE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/platform) +add_library(cru_platform_base INTERFACE) +target_sources(cru_platform_base INTERFACE + ${CRU_PLATFORM_BASE_INCLUDE_DIR}/debug.hpp + ${CRU_PLATFORM_BASE_INCLUDE_DIR}/exception.hpp + ${CRU_PLATFORM_BASE_INCLUDE_DIR}/matrix.hpp + ${CRU_PLATFORM_BASE_INCLUDE_DIR}/string_util.hpp +) +target_link_libraries(cru_platform_base INTERFACE cru_base) + +set(CRU_PLATFORM_GRAPH_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/platform/graph) +add_library(cru_platform_graph INTERFACE) +target_sources(cru_platform_graph INTERFACE + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/brush.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/font.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/geometry.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/graph_factory.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/painter.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/text_layout.hpp + ${CRU_PLATFORM_GRAPH_INCLUDE_DIR}/util/painter_util.hpp +) +target_link_libraries(cru_platform_graph INTERFACE cru_platform_base) + +set(CRU_PLATFORM_NATIVE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/platform/native) +add_library(cru_platform_native INTERFACE) +target_sources(cru_platform_native INTERFACE + ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/basic_types.hpp + ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/native_window.hpp + ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/ui_application.hpp +) +target_link_libraries(cru_platform_native INTERFACE cru_platform_graph) if(WIN32) add_subdirectory(win) endif() -add_executable(demo main.cpp) +add_subdirectory(ui) +add_executable(demo main.cpp) target_link_libraries(demo PRIVATE cru_ui) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 900948ca..a725c54b 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,3 +1,5 @@ +file(GLOB CRU_UI_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/ui) + add_library(cru_ui STATIC content_control.cpp control.cpp @@ -12,11 +14,27 @@ add_library(cru_ui STATIC render/flex_layout_render_object.cpp render/render_object.cpp render/text_render_object.cpp - render/window_render_object.cpp) - -target_include_directories(cru_ui PUBLIC ${PROJECT_SOURCE_DIR}/include .) + render/window_render_object.cpp +) +target_sources(cru_ui PUBLIC + ${CRU_UI_INCLUDE_DIR}/content_control.hpp + ${CRU_UI_INCLUDE_DIR}/control.hpp + ${CRU_UI_INCLUDE_DIR}/layout_control.hpp + ${CRU_UI_INCLUDE_DIR}/no_child_control.hpp + ${CRU_UI_INCLUDE_DIR}/ui_manager.hpp + ${CRU_UI_INCLUDE_DIR}/window.hpp + ${CRU_UI_INCLUDE_DIR}/controls/button.hpp + ${CRU_UI_INCLUDE_DIR}/controls/flex_layout.hpp + ${CRU_UI_INCLUDE_DIR}/controls/text_block.hpp + ${CRU_UI_INCLUDE_DIR}/event/ui_event.hpp + ${CRU_UI_INCLUDE_DIR}/render/border_render_object.hpp + ${CRU_UI_INCLUDE_DIR}/render/flex_layout_render_object.hpp + ${CRU_UI_INCLUDE_DIR}/render/render_object.hpp + ${CRU_UI_INCLUDE_DIR}/render/text_render_object.hpp + ${CRU_UI_INCLUDE_DIR}/render/window_render_object.hpp +) +target_link_libraries(cru_ui PUBLIC cru_base) if(WIN32) target_link_libraries(cru_ui PUBLIC cru_win_native) endif() - diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 1ca1f544..0076b3b2 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -1,10 +1,17 @@ +set(CRU_WIN_BASE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/win/) + add_library(cru_win_base STATIC debug.cpp exception.cpp string_util.cpp ) +target_sources(cru_win_base PUBLIC + ${CRU_WIN_BASE_INCLUDE_DIR}/exception.hpp + ${CRU_WIN_BASE_INCLUDE_DIR}/win_pre_config.hpp +) target_compile_definitions(cru_win_base PUBLIC UNICODE _UNICODE) # use unicode -target_include_directories(cru_win_base PUBLIC ${PROJECT_SOURCE_DIR}/include .) +target_include_directories(cru_win_base PUBLIC .) +target_link_libraries(cru_win_base PUBLIC cru_base) add_subdirectory(graph) add_subdirectory(native) diff --git a/src/win/graph/CMakeLists.txt b/src/win/graph/CMakeLists.txt index d326eb2b..03cd4566 100644 --- a/src/win/graph/CMakeLists.txt +++ b/src/win/graph/CMakeLists.txt @@ -1,8 +1,20 @@ +set(CRU_WIN_GRAPH_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/win/graph) + add_library(cru_win_graph STATIC win_brush.cpp win_font.cpp win_geometry.cpp win_graph_factory.cpp win_painter.cpp - win_text_layout.cpp) + win_text_layout.cpp +) +target_sources(cru_win_graph PUBLIC + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_brush.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_font.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_geometry.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_graph_factory.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_native_factory.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_painter.hpp + ${CRU_WIN_GRAPH_INCLUDE_DIR}/win_text_layout.hpp +) target_link_libraries(cru_win_graph PUBLIC D3D11 D2d1 DWrite cru_win_base) diff --git a/src/win/native/CMakeLists.txt b/src/win/native/CMakeLists.txt index 421f7515..a9ee84e7 100644 --- a/src/win/native/CMakeLists.txt +++ b/src/win/native/CMakeLists.txt @@ -1,4 +1,12 @@ +set(CRU_WIN_NATIVE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/win/native) + add_library(cru_win_native STATIC + dpi_util.hpp + god_window_message.hpp + timer.hpp + window_manager.hpp + window_painter.hpp + god_window.cpp timer.cpp win_application.cpp @@ -6,5 +14,14 @@ add_library(cru_win_native STATIC window_class.cpp window_manager.cpp window_painter.cpp - window_render_target.cpp) + window_render_target.cpp +) +target_sources(cru_win_native PUBLIC + ${CRU_WIN_NATIVE_INCLUDE_DIR}/god_window.hpp + ${CRU_WIN_NATIVE_INCLUDE_DIR}/win_application.hpp + ${CRU_WIN_NATIVE_INCLUDE_DIR}/win_native_window.hpp + ${CRU_WIN_NATIVE_INCLUDE_DIR}/window_class.hpp + ${CRU_WIN_NATIVE_INCLUDE_DIR}/window_native_message_event_args.hpp + ${CRU_WIN_NATIVE_INCLUDE_DIR}/window_render_target.hpp +) target_link_libraries(cru_win_native PUBLIC cru_win_graph) |