Skip to content

Commit 8f3233e

Browse files
chinglee-iotaggarg
andauthored
Adding CMakeList.txt in posix GCC demos (FreeRTOS#1020)
* Add cmake for posix GCC demo --------- Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 parent 1277ba1 commit 8f3233e

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
project( posix_demo )
4+
5+
add_compile_options( -D_WINDOWS_ )
6+
7+
if( TRACE_ON_ENTER )
8+
add_compile_options( -DTRACE_ON_ENTER=1 )
9+
else()
10+
add_compile_options( -DTRACE_ON_ENTER=0 )
11+
endif()
12+
13+
if( COVERAGE_TEST )
14+
set( COVERAGE_TEST 1 )
15+
add_compile_options( -DprojCOVERAGE_TEST=1 )
16+
else()
17+
set( COVERAGE_TEST 0 )
18+
add_compile_options( -DprojCOVERAGE_TEST=0 )
19+
endif()
20+
21+
if( PROFILE )
22+
set( CMAKE_BUILD_TYPE "release" )
23+
else()
24+
set( CMAKE_BUILD_TYPE "debug" )
25+
endif()
26+
27+
if( SANITIZE_ADDRESS )
28+
add_compile_options( -fsanitize=address -fsanitize=alignment )
29+
endif()
30+
31+
if( SANITIZE_LEAK )
32+
add_compile_options( -fsanitize=leak )
33+
endif()
34+
35+
set( FREERTOS_KERNEL_PATH "../../Source" )
36+
set( FREERTOS_PLUS_TRACE_PATH "../../../FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace" )
37+
38+
# Add the freertos_config for FreeRTOS-Kernel
39+
add_library( freertos_config INTERFACE )
40+
41+
target_include_directories( freertos_config
42+
INTERFACE
43+
./
44+
./Trace_Recorder_Configuration
45+
${FREERTOS_PLUS_TRACE_PATH}/Include
46+
)
47+
48+
# Select the heap port
49+
set( FREERTOS_HEAP "4" CACHE STRING "" FORCE)
50+
51+
# Select the native compile PORT
52+
set( FREERTOS_PORT "GCC_POSIX" CACHE STRING "" FORCE)
53+
54+
# Adding the FreeRTOS-Kernel subdirectory
55+
add_subdirectory( ${FREERTOS_KERNEL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/FreeRTOS-Kernel )
56+
57+
target_compile_options( freertos_kernel
58+
PRIVATE
59+
# Trace macro cast pointer to int to store memory management event
60+
$<IF:${COVERAGE_TEST},,-Wno-pointer-to-int-cast>
61+
)
62+
63+
file( GLOB FREERTOS_PLUS_TRACE_SOURCES ${FREERTOS_PLUS_TRACE_PATH}/*.c )
64+
65+
add_executable( posix_demo
66+
code_coverage_additions.c
67+
console.c
68+
main.c
69+
main_blinky.c
70+
main_full.c
71+
run-time-stats-utils.c
72+
$<$<NOT:${COVERAGE_TEST}>:${FREERTOS_PLUS_TRACE_SOURCES}>
73+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/AbortDelay.c
74+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/BlockQ.c
75+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/blocktim.c
76+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/countsem.c
77+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/death.c
78+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/dynamic.c
79+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/EventGroupsDemo.c
80+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/flop.c
81+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/GenQTest.c
82+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/integer.c
83+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/IntSemTest.c
84+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/MessageBufferAMP.c
85+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/MessageBufferDemo.c
86+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/PollQ.c
87+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/QPeek.c
88+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/QueueOverwrite.c
89+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/QueueSet.c
90+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/QueueSetPolling.c
91+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/recmutex.c
92+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/semtest.c
93+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/StaticAllocation.c
94+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/StreamBufferDemo.c
95+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/StreamBufferInterrupt.c
96+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/TaskNotify.c
97+
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/TimerDemo.c
98+
)
99+
100+
target_include_directories( posix_demo
101+
PRIVATE
102+
${CMAKE_CURRENT_LIST_DIR}
103+
${CMAKE_CURRENT_LIST_DIR}/../Common/include
104+
${FREERTOS_PLUS_TRACE_PATH}/Include
105+
${FREERTOS_PLUS_TRACE_PATH}/streamports/File/include
106+
${FREERTOS_PLUS_TRACE_PATH}/streamports/File/config
107+
)
108+
109+
target_compile_definitions( posix_demo
110+
PRIVATE
111+
$<IF:$<STREQUAL:${USER_DEMO},BLINKY_DEMO>,USER_DEMO=0,>
112+
$<IF:$<STREQUAL:${USER_DEMO},FULL_DEMO>,USER_DEMO=1,>
113+
)
114+
115+
target_link_libraries( posix_demo freertos_kernel freertos_config )

0 commit comments

Comments
 (0)