Files
DualFloatingClock/CMakeLists.txt
T
sebastian db02df7ca2 feat: menu-bar-only app (no Dock icon) + macOS app icon
- NSApplicationActivationPolicyAccessory: app hidden from Dock and
  app switcher; lives only in the menu bar tray
- resources/clouck.icns: programmatic icon (green gradient rounded
  square, white dial, 10:10 hands), all sizes 16-1024 incl @2x
- CMake: MACOSX_BUNDLE_ICON_FILE wired, icns shipped in Resources/
2026-08-27 22:31:06 +03:00

112 lines
2.8 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(Clouck)
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 clouck.icns)
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/resources/clouck.icns)
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()
# Create executable
qt6_add_executable(Clouck WIN32 MACOSX_BUNDLE
${SOURCES}
${HEADERS}
${APP_ICON_MACOSX}
)
# Platform-specific sources and libraries
if(APPLE)
target_sources(Clouck PRIVATE window_helper_macos.mm)
target_link_libraries(Clouck PRIVATE "-framework AppKit" "-framework CoreGraphics")
endif()
if(WIN32)
target_sources(Clouck PRIVATE window_helper_windows.cpp)
target_link_libraries(Clouck PRIVATE user32 dwmapi)
endif()
if(UNIX AND NOT APPLE)
target_sources(Clouck PRIVATE window_helper_linux.cpp)
target_link_libraries(Clouck PRIVATE ${X11_LIBRARIES} Xfixes)
endif()
# Link Qt libraries
target_link_libraries(Clouck PRIVATE Qt6::Core Qt6::Widgets)
# Set up install
install(TARGETS Clouck
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()