-
Notifications
You must be signed in to change notification settings - Fork 669
oot ci build test #3185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
trns1997
wants to merge
1
commit into
apache:master
Choose a base branch
from
trns1997:oot-build-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+95
−0
Open
oot ci build test #3185
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
build/ | ||
nuttx-export* |
This file contains hidden or 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 @@ | ||
cmake_minimum_required(VERSION 3.12...3.31) | ||
|
||
# --- Guard option --- | ||
option(BUILD_OOTCPP "Build the Out Of Tree C++ project" OFF) | ||
|
||
if(BUILD_OOTCPP) | ||
project( | ||
OOTCpp | ||
VERSION 1.0 | ||
DESCRIPTION "Out Of Tree Build C++ NuttX") | ||
|
||
message(STATUS "Building OOTCpp project") | ||
|
||
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(EXE_NAME oot) | ||
|
||
add_executable(${EXE_NAME} ${SOURCE_FILES}) | ||
|
||
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() |
This file contains hidden or 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 @@ | ||
#pragma once | ||
|
||
class CHelloWorld | ||
{ | ||
public: | ||
CHelloWorld(); | ||
~CHelloWorld() = default; | ||
|
||
bool HelloWorld(); | ||
|
||
private: | ||
int mSecret; | ||
}; |
This file contains hidden or 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,30 @@ | ||
#include <cstdio> | ||
#include <string> | ||
|
||
#include "HelloWorld.hpp" | ||
|
||
CHelloWorld::CHelloWorld() | ||
{ | ||
mSecret = 42; | ||
std::printf("Constructor: mSecret=%d\n",mSecret); | ||
} | ||
|
||
|
||
bool CHelloWorld::HelloWorld() | ||
{ | ||
std::printf("HelloWorld: mSecret=%d\n",mSecret); | ||
|
||
std::string sentence = "Hello"; | ||
std::printf("TEST=%s\n",sentence.c_str()); | ||
|
||
if (mSecret == 42) | ||
{ | ||
std::printf("CHelloWorld: HelloWorld: Hello, world!\n"); | ||
return true; | ||
} | ||
else | ||
{ | ||
std::printf("CHelloWorld: HelloWorld: CONSTRUCTION FAILED!\n"); | ||
return false; | ||
} | ||
} |
This file contains hidden or 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,14 @@ | ||
#include <memory> | ||
|
||
#include "HelloWorld.hpp" | ||
|
||
int main(int, char*[]) | ||
{ | ||
auto pHelloWorld = std::make_shared<CHelloWorld>(); | ||
pHelloWorld->HelloWorld(); | ||
|
||
CHelloWorld helloWorld; | ||
helloWorld.HelloWorld(); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need add Kconfig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this cannot be built using using classical apporaches. The aim to to build only out of tree using the export
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about people using Make and Kconfig? Would it build for them? Please provide steps how to reproduce in Testing section. Thanks :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the aim was just to have add a out of tree ci test, and not necessarily expose this as a testing app, but if you guys want i can look into it, but keep in mind the build via Kconfig and make is not a representative test for what we intended to do. It's a simple oot of tree build test to prevent regressions when packaging nuttx export, the app itself doesn't do much :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cederom where is the testing section. I'll add a link in the section orienting users to the doc in nuttx, Once i address this comment apache/nuttx#17017 (comment) from @acassis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @cederom