summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-10-02 10:42:44 -0400
committerGitHub <[email protected]>2026-10-02 10:42:44 -0400
commit93387b0a60382a29579bbad5045c68328e3751df (patch)
tree42be790d602cb76f55090e5a7c418df7ea2b3428 /CMakeLists.txt
parent44d7c95c582d415c4ad84527180b29c93c3bf664 (diff)
parent28281cd5647d4671236ca08d19bd18ed15b2265a (diff)
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f6be6d2..940717df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,10 +24,24 @@ endif()
option(THREADX_SMP "Build ThreadX SMP version" OFF)
+# Enable testing at the top level so that tests registered by ports and
+# example builds further down the tree are discoverable with ctest from the
+# build root. Without this, add_test() in a subdirectory still generates a
+# CTestTestfile.cmake there, but the root does not reference it and
+# "ctest --test-dir <build>" reports no tests at all.
+enable_testing()
+
if(THREADX_SMP)
set(TX_PORT_DIR "ports_smp")
set(TX_COMMON_DIR "common_smp")
set(TX_ARCH_DIR "${THREADX_ARCH}_smp")
+ # Most SMP ports are named <arch>_smp, but ports_smp/linux and
+ # ports_smp/win64 predate that convention and carry no suffix. Fall back to
+ # the bare name for them. The check only fires when the suffixed directory
+ # is absent, so no port that already resolves changes.
+ if(NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${TX_PORT_DIR}/${TX_ARCH_DIR}")
+ set(TX_ARCH_DIR "${THREADX_ARCH}")
+ endif()
message(STATUS "Building ThreadX SMP version")
else()
set(TX_PORT_DIR "ports")
@@ -59,6 +73,7 @@ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/${TX_COMMON_DIR})
# Define the FreeRTOS adaptation layer
add_library(freertos-threadx EXCLUDE_FROM_ALL)
target_include_directories(freertos-threadx
+ SYSTEM
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/utility/rtos_compatibility_layers/FreeRTOS
)
@@ -68,6 +83,24 @@ target_sources(freertos-threadx
)
target_link_libraries(freertos-threadx PUBLIC threadx)
+# Define the POSIX compatibility layer. It supplies its own errno.h, fcntl.h,
+# pthread.h, sched.h, signal.h and time.h, so it cannot be combined with the
+# hosted simulation ports: those build against a full C library that already
+# provides those headers, and the layer's pthread.h even shares the _PTHREAD_H
+# include guard with glibc's. Skip it there rather than offering a target that
+# could never build.
+#
+# It is also single-core by construction: px_int.h declares
+# _tx_thread_current_ptr as a plain pointer, which is a per-core array in an SMP
+# build, and the layer has no notion of which core it is running on.
+if(THREADX_ARCH MATCHES "^(linux|win32|win64)$")
+ message(STATUS "POSIX compatibility layer not available for ${THREADX_ARCH}")
+elseif(THREADX_SMP)
+ message(STATUS "POSIX compatibility layer not available for SMP builds")
+else()
+ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/utility/rtos_compatibility_layers/posix)
+endif()
+
# If the user provided an override, copy it to the custom directory
if (NOT TX_USER_FILE)
message(STATUS "Using default tx_user.h file")
@@ -77,6 +110,7 @@ else()
endif()
configure_file(${TX_USER_FILE} ${CUSTOM_INC_DIR}/tx_user.h COPYONLY)
target_include_directories(${PROJECT_NAME}
+ SYSTEM
PUBLIC
${CUSTOM_INC_DIR}
)