Diese Änderung stellt sicher, dass alle relevanten Windows API-Aufrufe und Datenstrukturen die Wide-Character (W-) Versionen verwenden. Dies gewährleistet eine konsistente und robuste Behandlung von Unicode-Zeichen, insbesondere nach der Einführung der UTF-8-Unterstützung für Menütexte und Tooltips. Zusätzlich wird die erzwungene statische Verlinkung der C-Laufzeitbibliothek (`/MT`) entfernt, um die Kompatibilität zu verbessern und die Binärgröße zu reduzieren, indem die standardmäßige dynamische Verlinkung ermöglicht wird.
62 lines
1.9 KiB
CMake
62 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.13 FATAL_ERROR) # target_link_directories
|
|
|
|
project(tray C)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
# Generate 'compile_commands.json' for clang_complete
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
file(GLOB SRCS
|
|
${CMAKE_CURRENT_LIST_DIR}/*.h
|
|
${CMAKE_CURRENT_LIST_DIR}/*.ico
|
|
${CMAKE_CURRENT_LIST_DIR}/*.png)
|
|
|
|
if(WIN32)
|
|
list(APPEND SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tray_windows.c)
|
|
else()
|
|
if(UNIX)
|
|
if(APPLE)
|
|
find_library(COCOA Cocoa REQUIRED)
|
|
list(APPEND SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tray_darwin.m)
|
|
else()
|
|
FIND_PACKAGE(PkgConfig)
|
|
PKG_CHECK_MODULES(APPINDICATOR REQUIRED appindicator3-0.1)
|
|
list(APPEND SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tray_linux.c)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
add_library(tray STATIC ${SRCS})
|
|
set_property(TARGET tray PROPERTY C_STANDARD 99)
|
|
if(WIN32)
|
|
target_compile_definitions(tray PRIVATE TRAY_WINAPI=1 WIN32_LEAN_AND_MEAN NOMINMAX)
|
|
else()
|
|
if(UNIX)
|
|
if(APPLE)
|
|
target_compile_definitions(tray PRIVATE TRAY_APPKIT=1)
|
|
target_link_libraries(tray PRIVATE ${COCOA})
|
|
else()
|
|
target_compile_options(tray PRIVATE ${APPINDICATOR_CFLAGS})
|
|
target_link_directories(tray PRIVATE ${APPINDICATOR_LIBRARY_DIRS})
|
|
target_compile_definitions(tray PRIVATE TRAY_APPINDICATOR=1)
|
|
target_link_libraries(tray PRIVATE ${APPINDICATOR_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
add_library(tray::tray ALIAS tray)
|
|
|
|
add_executable(tray_example ${CMAKE_CURRENT_SOURCE_DIR}/example.c)
|
|
target_link_libraries(tray_example tray::tray)
|
|
|
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/icon.ico ${CMAKE_BINARY_DIR}/icon.ico COPYONLY)
|
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/icon.png ${CMAKE_BINARY_DIR}/icon.png COPYONLY)
|
|
|
|
INSTALL(TARGETS tray tray DESTINATION lib)
|
|
|
|
IF(NOT WIN32)
|
|
INSTALL(FILES tray.h DESTINATION include)
|
|
ENDIF()
|
|
|