Skip to content

Commit 297e733

Browse files
committed
Add CMakeLists.txt
This commit adds CMakeLists.txt, allowing users to build libcsp against FreeRTOS with CMake. Unlike Meson, CMake doesn't enforce placing libcsp under subprojects/. However, this CMakeLists.txt assumes that you have it there. This is done to align with the setup in meson.build, not due to a limitation in CMake. Signed-off-by: Yasushi SHOJI <[email protected]>
1 parent 027e140 commit 297e733

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
project(libcsp-freertos)
3+
4+
add_executable(demo)
5+
target_sources(demo PRIVATE
6+
main.c
7+
hooks.c
8+
freertos/list.c
9+
freertos/queue.c
10+
freertos/tasks.c
11+
freertos/timers.c
12+
freertos/portable/ThirdParty/GCC/Posix/port.c
13+
freertos/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c)
14+
target_include_directories(demo PRIVATE
15+
.
16+
freertos/include
17+
freertos/portable/ThirdParty/GCC/Posix)
18+
target_link_libraries(demo PRIVATE csp)
19+
20+
add_subdirectory(subprojects/libcsp)

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ FreeRTOS Posix/Linux Simulator.
55

66
# How to build
77

8+
## With Meson
9+
810
```
911
git clone https://github.com/libcsp/libcsp-freertos
1012
cd libcsp-freertos
@@ -14,3 +16,15 @@ git clone https://github.com/libcsp/libcsp subprojects/libcsp
1416
meson setup builddir
1517
ninja -C builddir
1618
```
19+
20+
## With CMake
21+
22+
```
23+
git clone https://github.com/libcsp/libcsp-freertos
24+
cd libcsp-freertos
25+
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel freertos
26+
mkdir subprojects
27+
git clone https://github.com/libcsp/libcsp subprojects/libcsp
28+
cmake -B builddir -GNinja
29+
ninja -C builddir
30+
```

0 commit comments

Comments
 (0)