Skip to content

Commit 151f891

Browse files
committed
Examples: tray_stats_example, a system monitor laid out with native views in the menu bar
1 parent 298d0d6 commit 151f891

3 files changed

Lines changed: 535 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ add_subdirectory(examples/storage_c_example)
2929
add_subdirectory(examples/tray_icon_example)
3030
add_subdirectory(examples/tray_icon_c_example)
3131
add_subdirectory(examples/tray_view_example)
32+
add_subdirectory(examples/tray_stats_example)
3233
add_subdirectory(examples/url_opener_c_example)
3334
add_subdirectory(examples/window_c_example)
3435
add_subdirectory(examples/window_example)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(tray_stats_example)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
# Include the nativeapi headers
7+
include_directories(${CMAKE_SOURCE_DIR}/../../include)
8+
9+
# Add the executable
10+
add_executable(tray_stats_example main.cpp)
11+
12+
# Link against the nativeapi library
13+
target_link_libraries(tray_stats_example nativeapi)
14+
if(NATIVEAPI_ENABLE_WINUI3)
15+
target_sources(tray_stats_example PRIVATE "../../cmake/winui3-example.manifest")
16+
nativeapi_deploy_winui3(tray_stats_example)
17+
endif()
18+
19+
# Platform-specific settings
20+
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
21+
# iOS uses UIKit, Foundation, CoreGraphics (already linked by nativeapi)
22+
elseif(APPLE)
23+
find_library(COCOA_LIBRARY Cocoa)
24+
target_link_libraries(tray_stats_example ${COCOA_LIBRARY})
25+
elseif(WIN32)
26+
target_link_libraries(tray_stats_example user32 kernel32)
27+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
28+
find_package(PkgConfig REQUIRED)
29+
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
30+
target_include_directories(tray_stats_example PRIVATE ${GTK3_INCLUDE_DIRS})
31+
target_link_libraries(tray_stats_example ${GTK3_LIBRARIES})
32+
elseif(ANDROID)
33+
target_link_libraries(tray_stats_example log android)
34+
endif()

0 commit comments

Comments
 (0)