Files
DualFloatingClock/CMakeLists.txt
T
sebastian 45fc172fc8
Build and Release DualFloatingClock / build-linux (push) Failing after 32s
CI Build / build (macos-latest) (push) Canceled after 0s
CI Build / build (windows-latest) (push) Canceled after 0s
Build and Release DualFloatingClock / build-macos (push) Canceled after 0s
Build and Release DualFloatingClock / build-windows (push) Canceled after 0s
Build and Release DualFloatingClock / generate-changelog (push) Canceled after 0s
Build and Release DualFloatingClock / create-release (push) Canceled after 0s
feat: rename project to DualFloatingClock, add README, public release
- Full rename: CMake target, bundle, LaunchAgent label
  (com.dualfloatingclock.clock), QSettings org/app, tray tooltip,
  icns resource, build scripts, CI workflows, sample config
- Config XML: new root DualFloatingClockConfig; reader accepts legacy
  ClouckConfig root for painless migration of existing settings
- README rewritten: fork provenance (ivaquero/clouck), features, build,
  tests, usage
- Drop stale README-CN.md
2026-08-27 22:36:05 +03:00

112 lines
2.9 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(DualFloatingClock)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CTest)
# Find Qt6
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
# Platform-specific dependencies
if(WIN32)
# Windows-specific libraries
set(PLATFORM_LIBS user32 dwmapi gdi32 kernel32)
elseif(UNIX AND NOT APPLE)
# Linux-specific libraries
find_package(X11 REQUIRED)
set(PLATFORM_LIBS ${X11_LIBRARIES} Xfixes)
endif()
# Set up Qt6
qt6_standard_project_setup()
# Sources
set(SOURCES
main.cpp
autostart_manager.cpp
clock_widget.cpp
config_manager.cpp
window_helper.cpp
)
set(HEADERS
autostart_manager.h
clock_widget.h
config_manager.h
window_helper.h
)
# Platform-specific headers
if(WIN32)
list(APPEND HEADERS window_helper_windows.h)
elseif(UNIX AND NOT APPLE)
list(APPEND HEADERS window_helper_linux.h)
elseif(APPLE)
list(APPEND HEADERS window_helper_macos.h)
endif()
# macOS app icon
if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE dualfloatingclock.icns)
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/resources/dualfloatingclock.icns)
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()
# Create executable
qt6_add_executable(DualFloatingClock WIN32 MACOSX_BUNDLE
${SOURCES}
${HEADERS}
${APP_ICON_MACOSX}
)
# Platform-specific sources and libraries
if(APPLE)
target_sources(DualFloatingClock PRIVATE window_helper_macos.mm)
target_link_libraries(DualFloatingClock PRIVATE "-framework AppKit" "-framework CoreGraphics")
endif()
if(WIN32)
target_sources(DualFloatingClock PRIVATE window_helper_windows.cpp)
target_link_libraries(DualFloatingClock PRIVATE user32 dwmapi)
endif()
if(UNIX AND NOT APPLE)
target_sources(DualFloatingClock PRIVATE window_helper_linux.cpp)
target_link_libraries(DualFloatingClock PRIVATE ${X11_LIBRARIES} Xfixes)
endif()
# Link Qt libraries
target_link_libraries(DualFloatingClock PRIVATE Qt6::Core Qt6::Widgets)
# Set up install
install(TARGETS DualFloatingClock
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin
)
if(BUILD_TESTING)
find_package(Qt6 REQUIRED COMPONENTS Test)
qt6_add_executable(ConfigManagerTest
tests/config_manager_test.cpp
config_manager.cpp
config_manager.h
)
target_include_directories(ConfigManagerTest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ConfigManagerTest PRIVATE Qt6::Core Qt6::Gui Qt6::Test)
add_test(NAME ConfigManagerTest COMMAND ConfigManagerTest)
qt6_add_executable(AutoStartManagerTest
tests/autostart_manager_test.cpp
autostart_manager.cpp
autostart_manager.h
)
target_include_directories(AutoStartManagerTest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(AutoStartManagerTest PRIVATE Qt6::Core Qt6::Test)
add_test(NAME AutoStartManagerTest COMMAND AutoStartManagerTest)
endif()