-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add an SDL example to the C bindings (#250)
- Loading branch information
Showing
6 changed files
with
478 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
project(sdl_example) | ||
|
||
find_package(SDL2 REQUIRED) | ||
include_directories(${SDL2_INCLUDE_DIRS}) | ||
find_package(ACCESSKIT REQUIRED) | ||
include_directories(windows_example ${ACCESSKIT_INCLUDE_DIR}) | ||
|
||
add_executable(hello_world hello_world.c) | ||
target_link_libraries(hello_world PUBLIC ${SDL2_LIBRARIES}) | ||
target_link_libraries(hello_world PUBLIC accesskit) | ||
target_compile_definitions(hello_world PRIVATE -DUNICODE -D_UNICODE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# AccessKit cross-platform SDL example | ||
|
||
This example demonstrates how to make use of the C bindings to create cross-platform applications. | ||
|
||
## Building | ||
|
||
The process will vary based on your operating system. | ||
|
||
### Windows: | ||
|
||
First download an SDL2 development package from the project's [GitHub release page](https://github.com/libsdl-org/SDL/releases) (SDL2-devel-2.x.y-VC.zip for MSVC) and extract it. | ||
|
||
```bash | ||
cmake -S . -B build -DACCESSKIT_DIR="../.." -DSDL2_DIR="<PATH_TO_SDL2_PACKAGE>/cmake" | ||
cmake --build build --config Release | ||
``` | ||
|
||
You will then need to copy `SDL2.dll` into the `build/Release` folder. | ||
|
||
### Linux | ||
|
||
Make sure to install SDL2 and its development package. | ||
|
||
```bash | ||
cmake -S . -B build -DACCESSKIT_DIR="../.." -DCMAKE_BUILD_TYPE=Release | ||
cmake --build build | ||
``` | ||
|
||
### macOS | ||
|
||
First download an SDL2 package from the project's [GitHub release page](https://github.com/libsdl-org/SDL/releases) (SDL2-2.x.y.dmg) and copy `SDL2.framework` to `/Library/Frameworks`. | ||
|
||
```bash | ||
cmake -S . -B build -DACCESSKIT_DIR="../.." -DCMAKE_BUILD_TYPE=Release | ||
cmake --build build | ||
``` |
Oops, something went wrong.