aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore19
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/CMakeLists.txt41
-rw-r--r--src/main.cpp5
-rw-r--r--src/ui/events/ui_event.cpp3
-rw-r--r--src/ui/events/window_event.cpp3
6 files changed, 69 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 4d13c548..bcdf653f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -332,3 +332,22 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/
+
+### CMake ###
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+
+### CMake Patch ###
+# External projects
+*-prefix/
+
+build
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..db155296
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.14)
+
+project(CruUI)
+
+set(CMAKE_CXX_STANDARD 17)
+
+add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..bc33c29d
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,41 @@
+add_library(cru_ui STATIC
+ application.cpp
+ cru_debug.cpp
+ exception.cpp
+ timer.cpp
+ graph/graph_manager.cpp
+ graph/window_render_target.cpp
+ ui/content_control.cpp
+ ui/control.cpp
+ ui/input_util.cpp
+ ui/layout_control.cpp
+ ui/no_child_control.cpp
+ ui/ui_manager.cpp
+ ui/window_class.cpp
+ ui/window.cpp
+ ui/animations/animation.cpp
+ ui/controls/button.cpp
+ ui/controls/flex_layout.cpp
+ ui/controls/text_block.cpp
+ ui/render/border_render_object.cpp
+ ui/render/flex_layout_render_object.cpp
+ ui/render/render_object.cpp
+ ui/render/text_render_object.cpp
+ ui/render/window_render_object.cpp
+ util/string_util.cpp)
+
+
+target_include_directories(cru_ui PUBLIC .)
+
+if(WIN32)
+find_library(D3D11_LIB D3D11)
+find_library(D2D1_LIB D2d1)
+find_library(DWRITE_LIB DWrite)
+
+target_link_libraries(cru_ui PRIVATE ${D3D11_LIB} ${D2D1_LIB} ${DWRITE_LIB})
+
+target_compile_definitions(cru_ui PUBLIC UNICODE _UNICODE)
+endif()
+
+add_executable(demo main.cpp)
+target_link_libraries(demo PRIVATE cru_ui)
diff --git a/src/main.cpp b/src/main.cpp
index c35213f7..a787fbca 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,13 +16,12 @@ using cru::ui::controls::Button;
using cru::ui::controls::FlexLayout;
using cru::ui::controls::TextBlock;
-int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPWSTR lpCmdLine, int nCmdShow) {
+int main() {
#ifdef CRU_DEBUG
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
- Application application(hInstance);
+ Application application(::GetModuleHandleW(nullptr));
const auto window = Window::CreateOverlapped();
diff --git a/src/ui/events/ui_event.cpp b/src/ui/events/ui_event.cpp
deleted file mode 100644
index 78d56a83..00000000
--- a/src/ui/events/ui_event.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "ui_event.hpp"
-
-namespace cru::ui::events {}
diff --git a/src/ui/events/window_event.cpp b/src/ui/events/window_event.cpp
deleted file mode 100644
index a217136c..00000000
--- a/src/ui/events/window_event.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "window_event.hpp"
-
-namespace cru::ui::events {}