-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first add code and doc files(imcomplete)
- Loading branch information
Showing
309 changed files
with
90,012 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,10 @@ | ||
|
||
# !!! This file is auto generated by MaixCDK, don't modify it manually !!! | ||
|
||
cmake_minimum_required(VERSION 3.13) | ||
|
||
# cmake used vars defined in MaixCDK/tools/cmake/project.py's get_configs function | ||
|
||
include(${SDK_PATH}/tools/cmake/compile.cmake) | ||
project(${PROJECT_ID}) | ||
|
This file contains 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,69 @@ | ||
------------------------- MaixPy ------------------------- | ||
Apache 2.0 License | ||
|
||
Copyright (c) 2023- Sipeed Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
------------------------- MaixCDK end ------------------------- | ||
|
||
|
||
------------------------- MaixCDK ------------------------- | ||
Apache 2.0 License | ||
|
||
Copyright (c) 2023- Sipeed Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
------------------------- MaixCDK end ------------------------- | ||
|
||
----------------- c_cpp_project_framework ----------------- | ||
|
||
The project framework is based on c_cpp_project_framework(https://github.com/neutree/c_cpp_project_framework) | ||
|
||
MIT License | ||
|
||
Copyright (c) 2019- Neucrack([email protected]) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
----------------- c_cpp_project_framework end ----------------- | ||
|
||
|
||
And more submodules see the LICENSE file in each submodule. |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,40 @@ | ||
########## set C flags ######### | ||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wall -fPIC -Wl,-rpath=$ORIGIN/dl_lib) | ||
################################ | ||
|
||
|
||
###### set CXX(cpp) flags ###### | ||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wall -std=c++11 -fPIC -Wl,-rpath=$ORIGIN/dl_lib) | ||
################################ | ||
|
||
# set(LINK_FLAGS -Wl,-EL) # (default little edian) | ||
set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} | ||
${LINK_FLAGS} | ||
-Wl,-rpath=$ORIGIN/dl_lib | ||
) | ||
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${CMAKE_C_LINK_FLAGS} | ||
-std=c++11 | ||
) | ||
# set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} | ||
# ${LINK_FLAGS} | ||
# ) | ||
# set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} | ||
# ${LINK_FLAGS} | ||
# ) | ||
# set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} | ||
# ${LINK_FLAGS} | ||
# ) | ||
|
||
|
||
# Convert list to string | ||
string(REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}") | ||
string(REPLACE ";" " " CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}") | ||
string(REPLACE ";" " " CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") | ||
# string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") | ||
# string(REPLACE ";" " " CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | ||
# string(REPLACE ";" " " CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") | ||
|
||
|
||
|
This file contains 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,45 @@ | ||
|
||
# set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET>.elf <LINK_LIBRARIES>") | ||
# set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET>.elf <LINK_LIBRARIES>") | ||
|
||
# add_custom_command(TARGET ${PROJECT_ID} POST_BUILD | ||
# COMMAND ${CMAKE_OBJCOPY} --output-format=binary ${CMAKE_BINARY_DIR}/${PROJECT_ID}.elf ${CMAKE_BINARY_DIR}/${PROJECT_ID}.bin | ||
# DEPENDS ${PROJECT_ID} | ||
# COMMENT "-- Generating binary file ...") | ||
|
||
# variable #{g_dynamic_libs} have dependency dynamic libs and compiled dynamic libs(register component and assigned DYNAMIC or SHARED flag) | ||
|
||
# remove endswith libpython*.so items and libmaix.so from g_dynamic_libs | ||
set(final_dynamic_libs) | ||
set(except_libs "libpython.*\\.so$" | ||
"libmaix\\.so$" | ||
) | ||
foreach(item ${g_dynamic_libs}) | ||
set(is_except FALSE) | ||
foreach(except ${except_libs}) | ||
if(${item} MATCHES ${except}) | ||
set(is_except TRUE) | ||
break() | ||
endif() | ||
endforeach() | ||
if(NOT is_except) | ||
list(APPEND final_dynamic_libs ${item}) | ||
endif() | ||
endforeach() | ||
|
||
if(final_dynamic_libs) | ||
set(copy_dynamic_libs_cmd COMMAND mkdir -p ${PROJECT_BINARY_DIR}/dl_lib && cp ${final_dynamic_libs} ${PROJECT_BINARY_DIR}/dl_lib) | ||
set(copy_dynamic_libs_cmd2 COMMAND mkdir -p ${PROJECT_PATH}/maix/dl_lib && cp -r ${PROJECT_BINARY_DIR}/dl_lib/* ${PROJECT_PATH}/maix/dl_lib) | ||
else() | ||
set(copy_dynamic_libs_cmd) | ||
set(copy_dynamic_libs_cmd2) | ||
endif() | ||
|
||
add_custom_command(TARGET ${PROJECT_ID} POST_BUILD | ||
# COMMAND mkdir -p ${PROJECT_DIST_DIR} | ||
${copy_dynamic_libs_cmd} | ||
${copy_dynamic_libs_cmd2} | ||
COMMAND cp ${PROJECT_BINARY_DIR}/maix/libmaix.so ${PROJECT_PATH}/maix/_maix.so | ||
DEPENDS ${PROJECT_ID} | ||
COMMENT "-- copy binary files to dist dir ...") | ||
|
This file contains 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,8 @@ | ||
# component register priority | ||
# The upper components have higher priority | ||
# comments start with `#` | ||
|
||
component1 | ||
component2 | ||
|
||
|
This file contains 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,3 @@ | ||
test.json | ||
test.cpp | ||
|
This file contains 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,93 @@ | ||
############### Add include ################### | ||
list(APPEND ADD_INCLUDE "include" | ||
) | ||
list(APPEND ADD_PRIVATE_INCLUDE "") | ||
############################################### | ||
|
||
############ Add source files ################# | ||
# list(APPEND ADD_SRCS "src/main.c" | ||
# "src/test.c" | ||
# ) | ||
# append_srcs_dir(ADD_SRCS "src") # append source file in src dir to var ADD_SRCS | ||
# list(REMOVE_ITEM COMPONENT_SRCS "src/test2.c") | ||
# FILE(GLOB_RECURSE EXTRA_SRC "src/*.c") | ||
# FILE(GLOB EXTRA_SRC "src/*.c") | ||
# list(APPEND ADD_SRCS ${EXTRA_SRC}) | ||
# aux_source_directory(src ADD_SRCS) # collect all source file in src dir, will set var ADD_SRCS | ||
append_srcs_dir(ADD_SRCS "src") # append source file in src dir to var ADD_SRCS | ||
# list(REMOVE_ITEM COMPONENT_SRCS "src/test.c") | ||
# set(ADD_ASM_SRCS "src/asm.S") | ||
# list(APPEND ADD_SRCS ${ADD_ASM_SRCS}) | ||
# SET_PROPERTY(SOURCE ${ADD_ASM_SRCS} PROPERTY LANGUAGE C) # set .S ASM file as C language | ||
# SET_SOURCE_FILES_PROPERTIES(${ADD_ASM_SRCS} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp -D BBBBB") | ||
############################################### | ||
|
||
###### Add required/dependent components ###### | ||
list(APPEND ADD_REQUIREMENTS pybind11 python3 basic nn peripheral vision comm) | ||
############################################### | ||
|
||
###### Add link search path for requirements/libs ###### | ||
# list(APPEND ADD_LINK_SEARCH_PATH "${CONFIG_TOOLCHAIN_PATH}/lib") | ||
# list(APPEND ADD_REQUIREMENTS pthread m) # add system libs, pthread and math lib for example here | ||
# set (OpenCV_DIR opencv/lib/cmake/opencv4) | ||
# find_package(OpenCV REQUIRED) | ||
############################################### | ||
|
||
############ Add static libs ################## | ||
# list(APPEND ADD_STATIC_LIB "lib/libtest.a") | ||
############################################### | ||
|
||
#### Add compile option for this component #### | ||
#### Just for this component, won't affect other | ||
#### modules, including component that depend | ||
#### on this component | ||
# list(APPEND ADD_DEFINITIONS_PRIVATE -DAAAAA=1) | ||
|
||
#### Add compile option for this component | ||
#### and components denpend on this component | ||
# list(APPEND ADD_DEFINITIONS -DAAAAA222=1 | ||
# -DAAAAA333=1) | ||
############################################### | ||
|
||
############ Add static libs ################## | ||
#### Update parent's variables like CMAKE_C_LINK_FLAGS | ||
# set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group libmaix/libtest.a -ltest2 -Wl,--end-group" PARENT_SCOPE) | ||
############################################### | ||
|
||
######### Add files need to download ######### | ||
# list(APPEND ADD_FILE_DOWNLOADS "{ | ||
# 'url': 'https://*****/abcde.tar.xz', | ||
# 'urls': [], # backup urls, if url failed, will try urls | ||
# 'sites': [], # download site, user can manually download file and put it into dl_path | ||
# 'sha256sum': '', | ||
# 'filename': 'abcde.tar.xz', | ||
# 'path': 'toolchains/xxxxx', | ||
# 'check_files': [] | ||
# }" | ||
# ) | ||
# | ||
# then extracted file in ${DL_EXTRACTED_PATH}/toolchains/xxxxx, | ||
# you can directly use then, for example use it in add_custom_command | ||
############################################## | ||
|
||
set(maixpy_wrapper_src "${CMAKE_BINARY_DIR}/maixpy_wrapper.cpp") | ||
list(APPEND ADD_SRCS "${maixpy_wrapper_src}") | ||
set_property(SOURCE ${maixpy_wrapper_src} PROPERTY GENERATED 1) | ||
set(cmake_global_vars_json ${CMAKE_BINARY_DIR}/config/cmake_global_vars.json) | ||
# if exists maixpy_wrapper_src then remove it to ensure it will be generated every build time, cause it's not easy to detect all header dependency | ||
if(EXISTS ${maixpy_wrapper_src}) | ||
file(REMOVE ${maixpy_wrapper_src}) | ||
endif() | ||
add_custom_command(OUTPUT ${maixpy_wrapper_src} | ||
COMMAND ${python} -u ${CMAKE_CURRENT_SOURCE_DIR}/gen_api.py -o ${maixpy_wrapper_src} --doc ${PROJECT_PATH}/docs/api --sdk_path ${SDK_PATH} | ||
COMMENT "Generating maixpy_wrapper.cpp" | ||
VERBATIM | ||
) | ||
|
||
# list(APPEND ADD_DEFINITIONS -Wl,-rpath=$ORIGIN/dl_lib) | ||
# FIXME: $ character can not correctly convert to flag \$ORIGIN when build | ||
# so we change it when compile end in gen_binary.cmake | ||
|
||
# register component, DYNAMIC o NATIVE_COMMAND "${flags}")RED flags will make component compiled to dynamic(shared) lib | ||
register_component(DYNAMIC) | ||
|
Empty file.
Oops, something went wrong.