From 7397d460f67540f5feb3dbf72d95fc207cd9425d Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 26 Mar 2024 13:30:30 -0300 Subject: [PATCH] Migrate clip module from aseprite to laf --- .gitmodules | 3 +++ CMakeLists.txt | 11 +++++++++++ clip | 1 + os/CMakeLists.txt | 5 +++++ 4 files changed, 20 insertions(+) create mode 160000 clip diff --git a/.gitmodules b/.gitmodules index e830ca9dc..0a6790ce2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "clip"] + path = clip + url = https://github.com/aseprite/clip.git [submodule "third_party/googletest"] path = third_party/googletest url = https://github.com/aseprite/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 697db422d..b846431aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ endif() option(LAF_WITH_EXAMPLES "Enable LAF examples" ON) option(LAF_WITH_TESTS "Enable LAF tests" ON) +option(LAF_WITH_CLIP "Enable clip module (required for future drag-and-drop feature)" ON) set(LAF_BACKEND ${LAF_DEFAULT_BACKEND} CACHE STRING "Select laf backend") set_property(CACHE LAF_BACKEND PROPERTY STRINGS "none" "skia") @@ -51,6 +52,16 @@ else() endif() endif() +if(LAF_WITH_CLIP) + # Disable clip examples and tests + set(CLIP_EXAMPLES OFF CACHE BOOL "Compile clip examples") + set(CLIP_TESTS OFF CACHE BOOL "Compile clip tests") + if(PNG_LIBRARY) + set(CLIP_X11_PNG_LIBRARY "${PNG_LIBRARY}") + endif() + add_subdirectory(clip) +endif() + add_subdirectory(third_party) add_subdirectory(base) add_subdirectory(gfx) diff --git a/clip b/clip new file mode 160000 index 000000000..835cd0f7e --- /dev/null +++ b/clip @@ -0,0 +1 @@ +Subproject commit 835cd0f7e7a964bb969482117856bc56a0ac12bf diff --git a/os/CMakeLists.txt b/os/CMakeLists.txt index d8c3f0f49..4c7f802a8 100644 --- a/os/CMakeLists.txt +++ b/os/CMakeLists.txt @@ -89,6 +89,11 @@ endif() add_library(laf-os ${LAF_OS_SOURCES}) target_link_libraries(laf-os laf-gfx laf-base) +if(LAF_WITH_CLIP) + target_link_libraries(laf-os clip) + target_compile_definitions(laf-os PUBLIC + LAF_WITH_CLIP) +endif() if(FREETYPE_LIBRARIES AND HARFBUZZ_LIBRARIES) target_link_libraries(laf-os laf-ft) target_compile_definitions(laf-os PRIVATE