Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
#
# ##############################################################################

nuttx_add_subdirectory()
nuttx_add_subdirectory(EXCLUDE cxx-oot-build)
nuttx_generate_kconfig(MENUDESC "Testing")
46 changes: 19 additions & 27 deletions testing/cxx-oot-build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,29 @@

cmake_minimum_required(VERSION 3.12...3.31)

# --- Guard option ---
option(BUILD_OOTCPP "Build the Out Of Tree C++ project" OFF)
project(
OOTCpp
VERSION 1.0
DESCRIPTION "Out Of Tree Build C++ NuttX")

if(BUILD_OOTCPP)
project(
OOTCpp
VERSION 1.0
DESCRIPTION "Out Of Tree Build C++ NuttX")
message(STATUS "Building OOTCpp project")

message(STATUS "Building OOTCpp project")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/HelloWorld.cpp
${CMAKE_SOURCE_DIR}/src/main.cpp)

set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/HelloWorld.cpp
${CMAKE_SOURCE_DIR}/src/main.cpp)
set(EXE_NAME oot)

set(EXE_NAME oot)
add_executable(${EXE_NAME} ${SOURCE_FILES})

add_executable(${EXE_NAME} ${SOURCE_FILES})
target_include_directories(${EXE_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)

target_include_directories(${EXE_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)

# Generate a .bin file from the ELF after build
add_custom_command(
TARGET ${EXE_NAME}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -S -O binary ${CMAKE_BINARY_DIR}/${EXE_NAME}
${CMAKE_BINARY_DIR}/${EXE_NAME}.bin
COMMENT "Generating binary image ${EXE_NAME}.bin")

else()
message(STATUS "Skipping OOTCpp project")
endif()
# Generate a .bin file from the ELF after build
add_custom_command(
TARGET ${EXE_NAME}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -S -O binary ${CMAKE_BINARY_DIR}/${EXE_NAME}
${CMAKE_BINARY_DIR}/${EXE_NAME}.bin
COMMENT "Generating binary image ${EXE_NAME}.bin")
Loading