144 lines
4.6 KiB
CMake
144 lines
4.6 KiB
CMake
|
|
cmake_minimum_required(VERSION 3.20)
|
||
|
|
project(hcie-qt-app VERSION 0.1.0 LANGUAGES CXX)
|
||
|
|
|
||
|
|
set(CMAKE_CXX_STANDARD 17)
|
||
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||
|
|
set(CMAKE_AUTOMOC ON)
|
||
|
|
set(CMAKE_AUTORCC ON)
|
||
|
|
set(CMAKE_AUTOUIC ON)
|
||
|
|
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_SOURCE_DIR}/ui)
|
||
|
|
|
||
|
|
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets OpenGL OpenGLWidgets)
|
||
|
|
|
||
|
|
# ── Engine static library (built by Cargo) ──────────────────────────────────
|
||
|
|
# The Rust engine produces a C-compatible static library at:
|
||
|
|
# ../target/debug/libhcie_engine_api.a (Linux/macOS)
|
||
|
|
# ../target/debug/hcie_engine_api.lib (Windows MSVC)
|
||
|
|
# Build it first with: cargo build -p hcie-engine-api
|
||
|
|
set(ENGINE_LIB_DIR "${CMAKE_SOURCE_DIR}/../target/debug")
|
||
|
|
|
||
|
|
if(WIN32)
|
||
|
|
set(ENGINE_STATIC_LIB "${ENGINE_LIB_DIR}/hcie_engine_api.lib")
|
||
|
|
set(ENGINE_DLL_DIR "${ENGINE_LIB_DIR}")
|
||
|
|
else()
|
||
|
|
set(ENGINE_STATIC_LIB "${ENGINE_LIB_DIR}/libhcie_engine_api.a")
|
||
|
|
endif()
|
||
|
|
|
||
|
|
# ── Sources ─────────────────────────────────────────────────────────────────
|
||
|
|
set(HCIE_QT_SOURCES
|
||
|
|
src/main.cpp
|
||
|
|
src/mainwindow.cpp
|
||
|
|
src/canvas_widget.cpp
|
||
|
|
src/hcie_engine_wrapper.cpp
|
||
|
|
src/panels/tools_panel.cpp
|
||
|
|
src/panels/layers_panel.cpp
|
||
|
|
src/panels/colors_panel.cpp
|
||
|
|
src/panels/brushes_panel.cpp
|
||
|
|
src/panels/history_panel.cpp
|
||
|
|
src/panels/properties_panel.cpp
|
||
|
|
src/panels/filters_panel.cpp
|
||
|
|
src/panels/ai_chat_panel.cpp
|
||
|
|
src/panels/layer_styles_panel.cpp
|
||
|
|
src/panels/layer_details_panel.cpp
|
||
|
|
src/dialogs/new_image_dialog.cpp
|
||
|
|
src/dialogs/filter_dialog.cpp
|
||
|
|
src/dialogs/preferences_dialog.cpp
|
||
|
|
)
|
||
|
|
|
||
|
|
set(HCIE_QT_HEADERS
|
||
|
|
src/mainwindow.h
|
||
|
|
src/canvas_widget.h
|
||
|
|
src/hcie_engine_wrapper.h
|
||
|
|
src/panels/tools_panel.h
|
||
|
|
src/panels/layers_panel.h
|
||
|
|
src/panels/colors_panel.h
|
||
|
|
src/panels/brushes_panel.h
|
||
|
|
src/panels/history_panel.h
|
||
|
|
src/panels/properties_panel.h
|
||
|
|
src/panels/filters_panel.h
|
||
|
|
src/panels/ai_chat_panel.h
|
||
|
|
src/panels/layer_styles_panel.h
|
||
|
|
src/panels/layer_details_panel.h
|
||
|
|
src/dialogs/new_image_dialog.h
|
||
|
|
src/dialogs/filter_dialog.h
|
||
|
|
src/dialogs/preferences_dialog.h
|
||
|
|
)
|
||
|
|
|
||
|
|
set(HCIE_QT_UIS
|
||
|
|
ui/mainwindow.ui
|
||
|
|
ui/new_image_dialog.ui
|
||
|
|
ui/filter_dialog.ui
|
||
|
|
ui/preferences_dialog.ui
|
||
|
|
# Panel UI files (Qt Designer editable)
|
||
|
|
ui/layers_panel.ui
|
||
|
|
ui/brushes_panel.ui
|
||
|
|
ui/filters_panel.ui
|
||
|
|
ui/history_panel.ui
|
||
|
|
ui/properties_panel.ui
|
||
|
|
)
|
||
|
|
|
||
|
|
set(HCIE_QT_RESOURCES
|
||
|
|
resources/resources.qrc
|
||
|
|
)
|
||
|
|
|
||
|
|
# ── Target ──────────────────────────────────────────────────────────────────
|
||
|
|
add_executable(hcie-qt
|
||
|
|
${HCIE_QT_SOURCES}
|
||
|
|
${HCIE_QT_HEADERS}
|
||
|
|
${HCIE_QT_UIS}
|
||
|
|
${HCIE_QT_RESOURCES}
|
||
|
|
)
|
||
|
|
|
||
|
|
target_include_directories(hcie-qt PRIVATE
|
||
|
|
${CMAKE_SOURCE_DIR}/src
|
||
|
|
${CMAKE_CURRENT_BINARY_DIR} # for AUTOUIC generated headers
|
||
|
|
)
|
||
|
|
|
||
|
|
target_link_libraries(hcie-qt PRIVATE
|
||
|
|
Qt6::Core
|
||
|
|
Qt6::Gui
|
||
|
|
Qt6::Widgets
|
||
|
|
Qt6::OpenGL
|
||
|
|
Qt6::OpenGLWidgets
|
||
|
|
${ENGINE_STATIC_LIB}
|
||
|
|
)
|
||
|
|
|
||
|
|
# ── Platform-specific link flags ────────────────────────────────────────────
|
||
|
|
if(UNIX AND NOT APPLE)
|
||
|
|
target_link_libraries(hcie-qt PRIVATE
|
||
|
|
pthread dl m rt
|
||
|
|
)
|
||
|
|
# dav1d (AVIF codec) — may need explicit versioned .so link
|
||
|
|
set(DAV1D_LIB_PATH "/usr/lib/x86_64-linux-gnu/libdav1d.so.7")
|
||
|
|
if(EXISTS "${DAV1D_LIB_PATH}")
|
||
|
|
target_link_libraries(hcie-qt PRIVATE ${DAV1D_LIB_PATH})
|
||
|
|
else()
|
||
|
|
target_link_libraries(hcie-qt PRIVATE dav1d)
|
||
|
|
endif()
|
||
|
|
target_link_options(hcie-qt PRIVATE -rdynamic)
|
||
|
|
endif()
|
||
|
|
|
||
|
|
if(APPLE)
|
||
|
|
target_link_libraries(hcie-qt PRIVATE
|
||
|
|
pthread dl m
|
||
|
|
"-framework OpenGL"
|
||
|
|
"-framework CoreFoundation"
|
||
|
|
"-framework Security"
|
||
|
|
"-framework SystemConfiguration"
|
||
|
|
"-framework CoreGraphics"
|
||
|
|
"-framework CoreText"
|
||
|
|
"-framework AppKit"
|
||
|
|
)
|
||
|
|
endif()
|
||
|
|
|
||
|
|
if(WIN32)
|
||
|
|
target_link_libraries(hcie-qt PRIVATE
|
||
|
|
ws2_32 userenv bcrypt ntdll advapi32
|
||
|
|
opengl32
|
||
|
|
)
|
||
|
|
# Copy Qt DLLs to output directory (handled by windeployqt at install time)
|
||
|
|
endif()
|
||
|
|
|
||
|
|
# ── Install ─────────────────────────────────────────────────────────────────
|
||
|
|
install(TARGETS hcie-qt RUNTIME DESTINATION bin)
|