Skip to content

Commit 75aae35

Browse files
committed
Add a cross-platform example using SDL
1 parent bffdabb commit 75aae35

File tree

6 files changed

+471
-3
lines changed

6 files changed

+471
-3
lines changed

bindings/c/examples/sdl/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(sdl_example)
4+
5+
find_package(SDL2 REQUIRED)
6+
include_directories(${SDL2_INCLUDE_DIRS})
7+
find_package(ACCESSKIT REQUIRED)
8+
include_directories(windows_example ${ACCESSKIT_INCLUDE_DIR})
9+
10+
add_executable(hello_world hello_world.c)
11+
target_link_libraries(hello_world PUBLIC ${SDL2_LIBRARIES})
12+
target_link_libraries(hello_world PUBLIC accesskit)
13+
target_compile_definitions(hello_world PRIVATE -DUNICODE -D_UNICODE)

bindings/c/examples/sdl/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AccessKit cross-platform SDL example
2+
3+
This example demonstrates how to make use of the C bindings to create cross-platform applications.
4+
5+
## Building
6+
7+
The process will vary based on your operating system.
8+
9+
### On Windows:
10+
11+
First download a copy of SDL2 and extract it.
12+
13+
```bash
14+
cmake -S . -B build -DACCESSKIT_DIR="../.." -DSDL2_ROOT="<PATH_TO_SDL2_INSTALLATION>/cmake"
15+
cmake --build build --config Release
16+
```
17+
18+
You will then need to copy `SDL2.dll` into the `build/Release` folder.
19+
20+
### On Linux
21+
22+
Make sure to install SDL2 and its development package.
23+
24+
```bash
25+
cmake -S . -B build -DACCESSKIT_DIR="../.." -DCMAKE_BUILD_TYPE=Release
26+
cmake --build build
27+
```

0 commit comments

Comments
 (0)