diff --git a/.github/workflows/build_arduino.yml b/.github/workflows/build_arduino.yml index 0966c0ec..e6c61e2f 100644 --- a/.github/workflows/build_arduino.yml +++ b/.github/workflows/build_arduino.yml @@ -2,7 +2,7 @@ name: Arduino CLI build on: pull_request: - types: [opened, synchronize, reopened] + types: [opened, reopened] paths: - ".github/workflows/build_arduino.yml" - "examples/**" diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 45b3ff0d..bf927064 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -4,8 +4,26 @@ on: pull_request: branches: [master] types: [opened, reopened] + paths: + - '*.h' + - 'docs/**' + - '!docs/README.md' + - '*.md' + - 'images/**' + - '.github/workflows/doxygen.yml' + - 'Doxyfile' + - 'library.properties' # get lib version from here push: branches: [master] + paths: + - '*.h' + - 'docs/**' + - '!docs/README.md' + - '*.md' + - 'images/**' + - '.github/workflows/doxygen.yml' + - 'Doxyfile' + - 'library.properties' # get lib version from here release: branches: [master] types: [published, edited] diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index 151ea358..bfdd4552 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -3,7 +3,29 @@ name: Linux build on: pull_request: types: [opened, reopened] + paths: + - '*.h' + - '*.cpp' + - 'CMakeLists.txt' + - 'cmake/**' + - 'library.properties' # CMake gets lib info from here + - 'Makefile' + - 'examples_RPi/**' + - '**pyRF24Network/setup.py' + - '**pyRF24Network/*.cpp' + - '.github/workflows/build_linux.yml' push: + paths: + - '*.h' + - '*.cpp' + - 'CMakeLists.txt' + - 'cmake/**' + - 'library.properties' # CMake gets lib info from here + - 'Makefile' + - 'examples_RPi/**' + - '**pyRF24Network/setup.py' + - '**pyRF24Network/*.cpp' + - '.github/workflows/build_linux.yml' release: types: [published, edited] @@ -32,9 +54,6 @@ jobs: usr_dir: "local" steps: - - name: install rpmbuild - run: sudo apt-get install rpm - # - name: provide toolchain (for x86_64) # if: ${{ matrix.toolchain.compiler == 'x86_64' }} # run: | @@ -81,12 +100,6 @@ jobs: run: cmake -E make_directory ${{ github.workspace }}/build - name: configure lib - if: ${{ matrix.toolchain.compiler == 'default' }} - working-directory: ${{ github.workspace }}/build - run: cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE - - - name: configure lib (with toolchain compilers) - if: ${{ matrix.toolchain.compiler != 'default' }} working-directory: ${{ github.workspace }}/build run: | cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE \ @@ -135,3 +148,23 @@ jobs: run: | cmake --build . file ./helloworld_tx + + # cross-compiling a python C extension is better done with pypa/cibuildwheel action + - name: provide python wrapper prerequisites + if: ${{ matrix.toolchain.compiler == 'default' }} + # python3-rpi.gpio is only required for physical hardware (namely the IRQ example) + run: sudo apt-get install python3-dev libboost-python-dev python3-setuptools + + - name: create alias symlink to libboost_python3*.so + if: ${{ matrix.toolchain.compiler == 'default' }} + run: sudo ln -s $(ls /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3*.so | tail -1) /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3.so + + - name: build python wrapper + if: ${{ matrix.toolchain.compiler == 'default' }} + working-directory: ${{ github.workspace }}/RPi/pyRF24Network + run: python3 setup.py build + + - name: install python wrapper + if: ${{ matrix.toolchain.compiler == 'default' }} + working-directory: ${{ github.workspace }}/RPi/pyRF24Network + run: sudo python3 setup.py install diff --git a/.gitignore b/.gitignore index 360a49a1..7c2a322e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ PINS_*/ *.exe build/ .vscode/ -*CMakeUserPresets.json +*CMakeUserPresets*.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc7d43e..a103fbe4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,39 +56,39 @@ message(STATUS "using RF24 library: ${RF24}") ########################### add_library(${LibTargetName} SHARED RF24Network.cpp - ) +) target_include_directories(${LibTargetName} PUBLIC ${CMAKE_CURRENT_LIST_DIR} - ) +) target_link_libraries(${LibTargetName} INTERFACE project_options project_warnings SHARED ${RF24} - ) +) set_target_properties( ${LibTargetName} PROPERTIES SOVERSION ${${LibName}_VERSION_MAJOR} VERSION ${${LibName}_VERSION_STRING} - ) +) ########################### # target install rules for the RF24Log lib ########################### install(TARGETS ${LibTargetName} DESTINATION lib - ) +) install(FILES RF24Network.h RF24Network_config.h DESTINATION include/RF24Network - ) +) # CMAKE_CROSSCOMPILING is only TRUE when CMAKE_TOOLCHAIN_FILE is specified via CLI -if(CMAKE_HOST_UNIX AND "${CMAKE_CROSSCOMPILING}" STREQUAL "FALSE") +if("${CMAKE_CROSSCOMPILING}" STREQUAL "FALSE") install(CODE "message(STATUS \"Updating ldconfig\")") install(CODE "execute_process(COMMAND ldconfig)") endif() diff --git a/RPi/pyRF24Network/pyRF24Network.cpp b/RPi/pyRF24Network/pyRF24Network.cpp index c2844c8f..17525169 100644 --- a/RPi/pyRF24Network/pyRF24Network.cpp +++ b/RPi/pyRF24Network/pyRF24Network.cpp @@ -6,7 +6,7 @@ namespace bp = boost::python; // **************** expicit wrappers ***************** // where needed, especially where buffer is involved -// + void throw_ba_exception(void) { PyErr_SetString(PyExc_TypeError, "buf parameter must be bytes or bytearray"); @@ -23,6 +23,7 @@ char *get_bytes_or_bytearray_str(bp::object buf) return PyBytes_AsString(py_ba); else throw_ba_exception(); + return NULL; } @@ -36,144 +37,102 @@ int get_bytes_or_bytearray_ln(bp::object buf) return PyBytes_Size(py_ba); else throw_ba_exception(); + return 0; } -bp::tuple read_wrap(RF24Network& ref, size_t maxlen) +bp::tuple read_wrap(RF24Network &ref, size_t maxlen) { - char *buf = new char[maxlen+1]; - RF24NetworkHeader header; + char *buf = new char[maxlen + 1]; + RF24NetworkHeader header; - uint16_t len = ref.read(header, buf, maxlen); + uint16_t len = ref.read(header, buf, maxlen); bp::object py_ba(bp::handle<>(PyByteArray_FromStringAndSize(buf, len))); delete[] buf; - return bp::make_tuple(header, py_ba); + return bp::make_tuple(header, py_ba); } -bp::tuple peek_read_wrap(RF24Network& ref, size_t maxlen) +bp::tuple peek_read_wrap(RF24Network &ref, size_t maxlen) { - char *buf = new char[maxlen+1]; - RF24NetworkHeader header; + char *buf = new char[maxlen + 1]; + RF24NetworkHeader header; - ref.peek(header, buf, maxlen); + ref.peek(header, buf, maxlen); uint16_t len = ref.peek(header); bp::object py_ba(bp::handle<>(PyByteArray_FromStringAndSize(buf, len))); delete[] buf; - return bp::make_tuple(header, py_ba); + return bp::make_tuple(header, py_ba); } -bool write_wrap(RF24Network& ref, RF24NetworkHeader& header, bp::object buf) +bool write_wrap(RF24Network &ref, RF24NetworkHeader &header, bp::object buf) { - return ref.write(header, get_bytes_or_bytearray_str(buf), get_bytes_or_bytearray_ln(buf)); + return ref.write(header, get_bytes_or_bytearray_str(buf), get_bytes_or_bytearray_ln(buf)); } -std::string toString_wrap(RF24NetworkHeader& ref) +std::string toString_wrap(RF24NetworkHeader &ref) { - return std::string(ref.toString()); + return std::string(ref.toString()); } -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( - peekvoid, RF24Network::peek, 1, 3) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( - peekint, RF24Network::peek, 1, 2) +BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(peekvoid, RF24Network::peek, 1, 3) +BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(peekint, RF24Network::peek, 1, 2) + // **************** RF24Network exposed ***************** -// -BOOST_PYTHON_MODULE(RF24Network){ +BOOST_PYTHON_MODULE(RF24Network) +{ { //::RF24Network - typedef bp::class_< RF24Network > RF24Network_exposer_t; - RF24Network_exposer_t RF24Network_exposer = RF24Network_exposer_t( "RF24Network", bp::init< RF24 & >(( bp::arg("_radio") )) ); - bp::scope RF24Network_scope( RF24Network_exposer ); - bp::implicitly_convertible< RF24 &, RF24Network >(); + typedef bp::class_ RF24Network_exposer_t; + RF24Network_exposer_t RF24Network_exposer = RF24Network_exposer_t("RF24Network", bp::init((bp::arg("_radio")))); + bp::scope RF24Network_scope(RF24Network_exposer); + bp::implicitly_convertible(); { //::RF24Network::available - - typedef bool ( ::RF24Network::*available_function_type )( ) ; - - RF24Network_exposer.def( - "available" - , available_function_type( &::RF24Network::available ) ); - + typedef bool (::RF24Network::*available_function_type)(); + RF24Network_exposer.def("available", available_function_type(&::RF24Network::available)); } { //::RF24Network::begin - - typedef void ( ::RF24Network::*begin_function_type )( ::uint8_t,::uint16_t ) ; - - RF24Network_exposer.def( - "begin" - , begin_function_type( &::RF24Network::begin ) - , ( bp::arg("_channel"), bp::arg("_node_address") ) ); - + typedef void (::RF24Network::*begin_function_type)(::uint8_t, ::uint16_t); + RF24Network_exposer.def("begin", begin_function_type(&::RF24Network::begin), (bp::arg("_channel"), bp::arg("_node_address"))); } { //::RF24Network::parent - - typedef ::uint16_t ( ::RF24Network::*parent_function_type )( ) const; - - RF24Network_exposer.def( - "parent" - , parent_function_type( &::RF24Network::parent ) ); - + typedef ::uint16_t (::RF24Network::*parent_function_type)() const; + RF24Network_exposer.def("parent", parent_function_type(&::RF24Network::parent)); } { //::RF24Network::peek - - typedef uint16_t ( ::RF24Network::*peekint )( ::RF24NetworkHeader & ) ; - - RF24Network_exposer.def( - "peek" - , peekint( &::RF24Network::peek ) - , ( bp::arg("header") ) ); - + typedef uint16_t (::RF24Network::*peekint)(::RF24NetworkHeader &); + RF24Network_exposer.def("peek", peekint(&::RF24Network::peek), (bp::arg("header"))); } { //::RF24Network::peek - - typedef bp::tuple ( *peekvoid )( ::RF24Network& , size_t) ; - - RF24Network_exposer.def( - "peek" - , peekvoid( &peek_read_wrap ) - , (bp::arg("maxlen") ) ); - + typedef bp::tuple (*peekvoid)(::RF24Network &, size_t); + RF24Network_exposer.def("peek", peekvoid(&peek_read_wrap), (bp::arg("maxlen"))); } { //::RF24Network::read - - typedef bp::tuple ( *read_function_type )(::RF24Network&, size_t ) ; - - RF24Network_exposer.def( - "read" - //, read_function_type( &::RF24Network::read ) - , read_function_type( &read_wrap ) - , ( bp::arg("maxlen") ) ); - + typedef bp::tuple (*read_function_type)(::RF24Network &, size_t); + RF24Network_exposer.def( + "read", + // read_function_type( &::RF24Network::read ), + read_function_type(&read_wrap), (bp::arg("maxlen"))); } { //::RF24Network::update - - typedef void ( ::RF24Network::*update_function_type )( ) ; - - RF24Network_exposer.def( - "update" - , update_function_type( &::RF24Network::update ) ); - + typedef void (::RF24Network::*update_function_type)(); + RF24Network_exposer.def("update", update_function_type(&::RF24Network::update)); } { //::RF24Network::write - - typedef bool ( *write_function_type )( ::RF24Network&, ::RF24NetworkHeader&, bp::object ) ; - - RF24Network_exposer.def("write", write_function_type( &write_wrap ), ( bp::arg("header"), bp::arg("buf") ) ); - + typedef bool (*write_function_type)(::RF24Network &, ::RF24NetworkHeader &, bp::object); + RF24Network_exposer.def("write", write_function_type(&write_wrap), (bp::arg("header"), bp::arg("buf"))); } - RF24Network_exposer.def_readwrite( "txTimeout", &RF24Network::txTimeout ); + RF24Network_exposer.def_readwrite("txTimeout", &RF24Network::txTimeout); } -// **************** RF24NetworkHeader exposed ***************** -// - bp::class_< RF24NetworkHeader >( "RF24NetworkHeader", bp::init< >() ) - .def( bp::init< uint16_t, bp::optional< unsigned char > >(( bp::arg("_to"), bp::arg("_type")=(unsigned char)(0) )) ) - .def("toString", &toString_wrap ) - .def_readwrite( "from_node", &RF24NetworkHeader::from_node ) - .def_readwrite( "id", &RF24NetworkHeader::id ) - .def_readwrite( "next_id", RF24NetworkHeader::next_id ) - .def_readwrite( "reserved", &RF24NetworkHeader::reserved ) - .def_readwrite( "to_node", &RF24NetworkHeader::to_node ) - .def_readwrite( "type", &RF24NetworkHeader::type ); + // **************** RF24NetworkHeader exposed ***************** + bp::class_("RF24NetworkHeader", bp::init<>()) + .def(bp::init>((bp::arg("_to"), bp::arg("_type") = (unsigned char)(0)))) + .def("toString", &toString_wrap) + .def_readwrite("from_node", &RF24NetworkHeader::from_node) + .def_readwrite("id", &RF24NetworkHeader::id) + .def_readwrite("next_id", RF24NetworkHeader::next_id) + .def_readwrite("reserved", &RF24NetworkHeader::reserved) + .def_readwrite("to_node", &RF24NetworkHeader::to_node) + .def_readwrite("type", &RF24NetworkHeader::type); } - diff --git a/RPi/pyRF24Network/setup.py b/RPi/pyRF24Network/setup.py index adaea150..f06db198 100755 --- a/RPi/pyRF24Network/setup.py +++ b/RPi/pyRF24Network/setup.py @@ -1,18 +1,27 @@ #!/usr/bin/env python -from distutils.core import setup, Extension -import sys +from setuptools import setup, Extension +from sys import version_info -if sys.version_info >= (3,): - BOOST_LIB = 'boost_python3' -else: - BOOST_LIB = 'boost_python' +if version_info >= (3,): + BOOST_LIB = "boost_python3" +else: + BOOST_LIB = "boost_python" -module_RF24Network = Extension('RF24Network', - libraries = ['rf24network', BOOST_LIB], - sources = ['pyRF24Network.cpp']) - -setup(name='RF24Network', - version='1.0', - ext_modules=[module_RF24Network] - ) +setup( + name="RF24Network", + version="1.0", + classifiers = [ + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Programming Language :: C++", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + ], + ext_modules=[ + Extension( + "RF24Network", + libraries = ["rf24network", BOOST_LIB], + sources=["pyRF24Network.cpp"] + ) + ] +) diff --git a/cmake/Cache.cmake b/cmake/Cache.cmake index 4cc2e8c5..8e7ae631 100644 --- a/cmake/Cache.cmake +++ b/cmake/Cache.cmake @@ -3,23 +3,15 @@ if(NOT ENABLE_CACHE) return() endif() -set(CACHE_OPTION - "ccache" - CACHE STRING "Compiler cache to be used" - ) +set(CACHE_OPTION "ccache" CACHE STRING "Compiler cache to be used") set(CACHE_OPTION_VALUES "ccache" "sccache") set_property(CACHE CACHE_OPTION PROPERTY STRINGS ${CACHE_OPTION_VALUES}) -list( - FIND - CACHE_OPTION_VALUES - ${CACHE_OPTION} - CACHE_OPTION_INDEX - ) +list(FIND CACHE_OPTION_VALUES ${CACHE_OPTION} CACHE_OPTION_INDEX) if(${CACHE_OPTION_INDEX} EQUAL -1) message(STATUS "Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}" - ) + ) endif() find_program(CACHE_BINARY ${CACHE_OPTION}) diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 90311602..af36206d 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -29,7 +29,7 @@ function(set_project_warnings project_name) /w14906 # string literal cast to 'LPWSTR' /w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied /permissive- # standards conformance mode for MSVC compiler. - ) + ) set(CLANG_WARNINGS -Wall @@ -47,7 +47,7 @@ function(set_project_warnings project_name) -Wnull-dereference # warn if a null dereference is detected -Wdouble-promotion # warn if float is implicit promoted to double -Wformat=2 # warn on security issues around functions that format output (ie printf) - ) + ) if(WARNINGS_AS_ERRORS) set(CLANG_WARNINGS ${CLANG_WARNINGS} -Werror) @@ -61,7 +61,7 @@ function(set_project_warnings project_name) -Wduplicated-branches # warn if if / else branches have duplicated code -Wlogical-op # warn about logical operations being used where bitwise were probably wanted -Wuseless-cast # warn if you perform a cast to the same type - ) + ) if(MSVC) set(PROJECT_WARNINGS ${MSVC_WARNINGS}) diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 0414e993..8524dcb0 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -4,7 +4,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE - ) + ) # Set the possible values of build type for cmake-gui, ccmake set_property( CACHE CMAKE_BUILD_TYPE @@ -13,7 +13,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "Release" "MinSizeRel" "RelWithDebInfo" - ) + ) endif() # Generate compile_commands.json to make it easier to work with clang based tools @@ -24,11 +24,9 @@ option(ENABLE_IPO "Enable Interprocedural Optimization, aka Link Time Optimizati if(ENABLE_IPO) include(CheckIPOSupported) check_ipo_supported( - RESULT - result - OUTPUT - output - ) + RESULT result + OUTPUT output + ) if(result) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) else() diff --git a/cmake/detectCPU.cmake b/cmake/detectCPU.cmake index ebd7fe72..bd702f99 100644 --- a/cmake/detectCPU.cmake +++ b/cmake/detectCPU.cmake @@ -1,43 +1,78 @@ # try to get the CPU model using a Linux bash command -execute_process(COMMAND cat /proc/cpuinfo - OUTPUT_VARIABLE CPU_MODEL - ) +if(NOT SOC) # if SOC variable not defined by user at CLI + if(EXISTS "/sys/class/sunxi_info/sys_info") + execute_process(COMMAND grep sunxi_platform /sys/class/sunxi_info/sys_info + OUTPUT_VARIABLE CPU_MODEL + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else() + execute_process(COMMAND grep Hardware /proc/cpuinfo + OUTPUT_VARIABLE CPU_MODEL + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() -# If above command is not executed on an actual SOC board (& compatible OS), then -# there won't be a "Hardware" field to describe the CPU model -string(FIND ${CPU_MODEL} "Hardware" cpu_info_has_hw_field) -if(${cpu_info_has_hw_field} GREATER 0) # Hardware field does exist - string(SUBSTRING ${CPU_MODEL} ${cpu_info_has_hw_field} -1 CPU_MODEL) - string(REGEX MATCH "[ ]+([A-Za-z0-9_])+" SOC ${CPU_MODEL}) - string(STRIP ${SOC} SOC) -else() # Hardware field does not exist - set(SOC "UNKNOWN") # use this string as a sentinel + string(FIND "${CPU_MODEL}" ":" cpu_is_described) + if(${cpu_is_described} GREATER 0) # Hardware field does exist + math(EXPR cpu_is_described "${cpu_is_described} + 1") + string(SUBSTRING "${CPU_MODEL}" ${cpu_is_described} -1 SOC) + string(STRIP "${SOC}" SOC) + else() # Hardware field does not exist + set(SOC "UNKNOWN") # use this string as a sentinel + endif() + message(STATUS "detected SoC: ${SOC}") +else() + message(STATUS "SOC set to ${SOC}") endif() -# detect machine hardware name +string(FIND "${SOC}" "Generic AM33XX" is_AM33XX) + +#[[ detect machine hardware name +This CPU_TYPE variable is not used anywhere. +It remains as useful prompt info & to be consistent with old build system ]] execute_process(COMMAND uname -m - OUTPUT_VARIABLE CPU_TYPE) -string(STRIP "${CPU_TYPE}" CPU_TYPE) + OUTPUT_VARIABLE CPU_TYPE + OUTPUT_STRIP_TRAILING_WHITESPACE +) message(STATUS "detected CPU type: ${CPU_TYPE}") +# identify the compiler base name for customizing flags +# THIS ONLY WORKS/TESTED FOR GNU COMPILERS +if(NOT CMAKE_CROSSCOMPILING) # need to use /usr/lib/gcc soft symlink + # NOTE the following command doesn't work with " | tail -1" appended + execute_process(COMMAND ls /usr/lib/gcc + OUTPUT_VARIABLE tool_name + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # use only last entry if multiple entries are returned + string(FIND "${tool_name}" "\n" last_list_delimiter REVERSE) + if(last_list_delimiter GREATER -1) + math(EXPR last_list_delimiter "${last_list_delimiter} + 1") + string(SUBSTRING "${tool_name}" ${last_list_delimiter} -1 tool_name) + endif() + +else() # we can use the compiler's name of the path set in the toolchain file + string(REGEX REPLACE "^\/usr\/bin\/(.*)-gcc.*" "\\1" tool_name "${CMAKE_C_COMPILER}") +endif() + +message(STATUS "tool name being used is ${tool_name}") + # add compiler flags to optomize builds with arm-linux-gnueabihf-g* compilers -if("${CMAKE_C_COMPILER}" STREQUAL "/usr/bin/arm-linux-gnueabihf-gcc" AND - "${CMAKE_CXX_COMPILER}" STREQUAL "/usr/bin/arm-linux-gnueabihf-g++") - if("${SOC}" STREQUAL "BCM2835") +if("${tool_name}" STREQUAL "arm-linux-gnueabihf") + if("${SOC}" STREQUAL "BCM2835" OR "${SOC}" STREQUAL "BCM2708") add_compile_options(-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard) - elseif("$SOC" STREQUAL "BCM2836") + elseif("$SOC" STREQUAL "BCM2836" OR "${SOC}" STREQUAL "BCM2709") add_compile_options(-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard) - elseif("$SOC" STREQUAL "AM33XX") + elseif(${is_AM33XX} GREATER -1) add_compile_options(-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard) - elseif("$SOC" STREQUAL "A10") + elseif("$SOC" STREQUAL "sun4i" OR "${SOC}" STREQUAL "Sun4iw1p1") # A10 add_compile_options(-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard) - elseif("$SOC" STREQUAL "A13") + elseif("$SOC" STREQUAL "sun5i" OR "${SOC}" STREQUAL "Sun4iw2p1") # A13 add_compile_options(-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard) - elseif("$SOC" STREQUAL "A20") + elseif("$SOC" STREQUAL "sun7i" OR "${SOC}" STREQUAL "Sun8iw2p1") # A20 add_compile_options(-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard) - elseif("$SOC" STREQUAL "H3") + elseif("$SOC" STREQUAL "sun8i" OR "${SOC}" STREQUAL "Sun8iw7p1") # H3 add_compile_options(-march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard) endif() endif() - -message(STATUS "detected SoC: ${SOC}") \ No newline at end of file diff --git a/cmake/toolchains/arm64.cmake b/cmake/toolchains/arm64.cmake index add14e1a..23e41ca7 100644 --- a/cmake/toolchains/arm64.cmake +++ b/cmake/toolchains/arm64.cmake @@ -27,7 +27,6 @@ example using MRAA: (for RF24/build dir) `cmake .. -D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/arm64.cmake ]] list(APPEND CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu) -# message("CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search CMAKE_SYSROOT when find_program() is called set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_library() is called set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_file() is called diff --git a/cmake/toolchains/armhf.cmake b/cmake/toolchains/armhf.cmake index f1611f2d..488b81a8 100644 --- a/cmake/toolchains/armhf.cmake +++ b/cmake/toolchains/armhf.cmake @@ -27,7 +27,6 @@ example using MRAA: (for RF24/build dir) `cmake .. -D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/arm.cmake ]] list(APPEND CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf) -# message("CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search CMAKE_SYSROOT when find_program() is called set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_library() is called set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_file() is called diff --git a/cmake/toolchains/i686.cmake b/cmake/toolchains/i686.cmake index 344fd8b6..f3c42be0 100644 --- a/cmake/toolchains/i686.cmake +++ b/cmake/toolchains/i686.cmake @@ -27,7 +27,6 @@ example using MRAA: (for RF24/build dir) `cmake .. -D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/i686.cmake ]] list(APPEND CMAKE_FIND_ROOT_PATH /usr/i686-linux-gnu) -# message("CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search CMAKE_SYSROOT when find_program() is called set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_library() is called set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_file() is called diff --git a/cmake/toolchains/x86_64.cmake b/cmake/toolchains/x86_64.cmake index b75ab3f0..e4ff737a 100644 --- a/cmake/toolchains/x86_64.cmake +++ b/cmake/toolchains/x86_64.cmake @@ -27,7 +27,6 @@ example using MRAA: (for RF24/build dir) `cmake .. -D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/x86_64.cmake ]] list(APPEND CMAKE_FIND_ROOT_PATH /usr/x86_64-linux-gnux32) -# message("CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search CMAKE_SYSROOT when find_program() is called set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_library() is called set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # search CMAKE_FIND_ROOT_PATH entries when find_file() is called