Skip to content

Commit 073107b

Browse files
committed
Refactor platform source files
1 parent 1f41a90 commit 073107b

12 files changed

+29
-31
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ cd build
5151

5252
# Configure and build
5353
cmake ..
54-
make -j$(nproc) # Linux/macOS
55-
# or
56-
cmake --build . --config Release # Windows
54+
cmake --build . --config Release
5755
```
5856

5957
## Language Bindings

src/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ project(libnativeapi VERSION 0.0.1 LANGUAGES CXX)
77

88
# Enable Objective-C++
99
if(APPLE)
10-
enable_language(OBJCXX)
10+
enable_language(OBJCXX)
1111
endif()
1212

1313
# Set C++ standard
@@ -16,20 +16,20 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1616

1717
# Common source files
1818
file(GLOB COMMON_SOURCES "*.cpp")
19-
list(FILTER COMMON_SOURCES EXCLUDE REGEX "linux.*|macos.*|windows.*")
19+
list(FILTER COMMON_SOURCES EXCLUDE REGEX "platform/*")
2020

2121
# Platform-specific source files
2222
if(LINUX)
23-
file(GLOB PLATFORM_SOURCES "impl/*_linux.cpp")
24-
# Find GTK package for Linux
25-
find_package(PkgConfig REQUIRED)
26-
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
23+
file(GLOB PLATFORM_SOURCES "platform/linux/*_linux.cpp")
24+
# Find GTK package for Linux
25+
find_package(PkgConfig REQUIRED)
26+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
2727
elseif(APPLE)
28-
file(GLOB PLATFORM_SOURCES "impl/*_macos.mm")
28+
file(GLOB PLATFORM_SOURCES "platform/macos/*_macos.mm")
2929
elseif(WIN32)
30-
file(GLOB PLATFORM_SOURCES "impl/*_windows.cpp")
30+
file(GLOB PLATFORM_SOURCES "platform/windows/*_windows.cpp")
3131
else()
32-
set(PLATFORM_SOURCES "")
32+
set(PLATFORM_SOURCES "")
3333
endif()
3434

3535
# Add library target
@@ -50,13 +50,13 @@ target_include_directories(libnativeapi PUBLIC
5050
)
5151

5252
if (LINUX)
53-
target_include_directories(libnativeapi PUBLIC ${GTK_INCLUDE_DIRS})
53+
target_include_directories(libnativeapi PUBLIC ${GTK_INCLUDE_DIRS})
5454
endif ()
5555

5656
# Link required frameworks and libraries
5757
if(APPLE)
58-
target_link_libraries(libnativeapi PUBLIC "-framework Cocoa")
59-
target_compile_options(libnativeapi PRIVATE "-x" "objective-c++")
58+
target_link_libraries(libnativeapi PUBLIC "-framework Cocoa")
59+
target_compile_options(libnativeapi PRIVATE "-x" "objective-c++")
6060
elseif (LINUX)
61-
target_link_libraries(libnativeapi PUBLIC PkgConfig::GTK)
62-
endif ()
61+
target_link_libraries(libnativeapi PUBLIC PkgConfig::GTK)
62+
endif ()

src/impl/display_manager_linux.cpp renamed to src/platform/linux/display_manager_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <gtk/gtk.h>
22
#include <iostream>
3-
#include "../display_manager.h"
3+
#include "../../display_manager.h"
44

55
namespace nativeapi {
66

src/impl/accessibility_manager_macos.mm renamed to src/platform/macos/accessibility_manager_macos.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "../accessibility_manager.h"
1+
#include "../../accessibility_manager.h"
22

33
// Import Cocoa headers
44
#import <Cocoa/Cocoa.h>

src/impl/display_manager_macos.mm renamed to src/platform/macos/display_manager_macos.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include <string>
55
#include <vector>
66

7-
#include "../display.h"
8-
#include "../display_manager.h"
7+
#include "../../display.h"
8+
#include "../../display_manager.h"
99

1010
// Import Cocoa and Core Graphics headers
1111
#import <Cocoa/Cocoa.h>

src/impl/keyboard_monitor_macos.mm renamed to src/platform/macos/keyboard_monitor_macos.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <iostream>
33
#include <string>
44

5-
#include "../keyboard_monitor.h"
5+
#include "../../keyboard_monitor.h"
66

77
// Import Cocoa headers
88
#import <Cocoa/Cocoa.h>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <iostream>
2-
#include "../menu.h"
2+
#include "../../menu.h"
33

44
// Import Cocoa headers
55
#import <Cocoa/Cocoa.h>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <iostream>
2-
#include "../menu.h"
3-
#include "../tray.h"
2+
#include "../../menu.h"
3+
#include "../../tray.h"
44

55
// Import Cocoa headers
66
#import <Cocoa/Cocoa.h>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <iostream>
33
#include <string>
44

5-
#include "../tray.h"
6-
#include "../tray_manager.h"
5+
#include "../../tray.h"
6+
#include "../../tray_manager.h"
77

88
// Import Cocoa headers
99
#import <Cocoa/Cocoa.h>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <iostream>
2-
#include "../window.h"
3-
#include "../window_manager.h"
2+
#include "../../window.h"
3+
#include "../../window_manager.h"
44

55
// Import Cocoa headers
66
#import <Cocoa/Cocoa.h>

0 commit comments

Comments
 (0)