-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CMake 4 Linux; clean up tests/jamfile relics
- Loading branch information
Showing
35 changed files
with
714 additions
and
1,303 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Linux build | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
push: | ||
release: | ||
types: [published, edited] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
using_cmake: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
toolchain: | ||
- compiler: "armhf" | ||
usr_dir: "arm-linux-gnueabihf" | ||
- compiler: "arm64" | ||
usr_dir: "aarch64-linux-gnu" | ||
# - compiler: "x86_64" | ||
# usr_dir: "x86_64-linux-gnux32" | ||
# - compiler: "i686" | ||
# usr_dir: "i686-linux-gnu" | ||
- compiler: "default" # github runner is hosted on a "amd64" | ||
usr_dir: "local" | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: install rpmbuild | ||
run: sudo apt-get install rpm | ||
|
||
# - name: provide toolchain (for x86_64) | ||
# if: ${{ matrix.toolchain.compiler == 'x86_64' }} | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install gcc-x86-64-linux-gnux32 g++-x86-64-linux-gnux32 | ||
|
||
# - name: provide toolchain (for i686) | ||
# if: ${{ matrix.toolchain.compiler == 'i686' }} | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install gcc-i686-linux-gnu g++-i686-linux-gnu | ||
|
||
- name: provide toolchain (for arm64) | ||
if: ${{ matrix.toolchain.compiler == 'arm64' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
- name: provide toolchain (for armhf) | ||
if: ${{ matrix.toolchain.compiler == 'armhf' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf | ||
- name: checkout RF24 | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nRF24/RF24 | ||
ref: rp2xxx | ||
|
||
- name: build & install RF24 | ||
if: ${{ matrix.toolchain.compiler == 'default' }} | ||
working-directory: ${{ github.workspace }}/RF24 | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D RF24_DRIVER=SPIDEV \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
sudo make install | ||
- name: create CMake build environment | ||
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 \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
- name: build lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: cmake --build . | ||
|
||
- name: install lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo cmake --install . | ||
|
||
- name: package lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo cpack | ||
|
||
- name: Save artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: "pkg_RF24Mesh" | ||
path: | | ||
${{ github.workspace }}/build/pkgs/*.deb | ||
${{ github.workspace }}/build/pkgs/*.rpm | ||
- name: Upload Release assets | ||
if: github.event_name == 'release' && (matrix.toolchain.compiler == 'armhf' || matrix.toolchain.compiler == 'arm64') | ||
uses: csexton/release-asset-action@master | ||
with: | ||
pattern: "${{ github.workspace }}/build/pkgs/librf24*" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: clean build environment | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo rm -r ./* | ||
|
||
- name: configure examples | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cmake ../examples_RPi \ | ||
-D CMAKE_TOOLCHAIN_FILE=../cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
- name: build examples | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cmake --build . | ||
file ./helloworld_tx |
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,73 @@ | ||
# This module will build a debian compatible package to install - handy for cross-compiling | ||
|
||
if(NOT PKG_REV) | ||
set(PKG_REV "1") | ||
endif() | ||
|
||
# get target arch if not cross-compiling | ||
if(NOT TARGET_ARCH) # TARGET_ARCH is defined only in the toolchain_<ARCH_TYPE>.cmake files | ||
if(WIN32) | ||
set(TARGET_ARCH $ENV{PROCESSOR_ARCHITECTURE}) | ||
else() | ||
execute_process(COMMAND dpkg --print-architecture | ||
OUTPUT_VARIABLE TARGET_ARCH | ||
) | ||
endif() | ||
string(STRIP "${TARGET_ARCH}" TARGET_ARCH) | ||
endif() | ||
|
||
# set the Cpack generators (specific to types of packages to create) | ||
if(NOT WIN32) | ||
set(CPACK_GENERATOR DEB RPM) # RPM requires rpmbuild executable | ||
else() | ||
set(CPACK_GENERATOR "") # should find out how to build vcpkg packages | ||
endif() | ||
|
||
# assemble a debian package filename from known info | ||
include(InstallRequiredSystemLibraries) | ||
set(CPACK_PACKAGE_FILE_NAME "lib${LibTargetName}_${${LibName}_VERSION_STRING}-${PKG_REV}_${TARGET_ARCH}") | ||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE") | ||
set(CPACK_PACKAGE_VERSION_MAJOR "${${LibName}_VERSION_MAJOR}") | ||
set(CPACK_PACKAGE_VERSION_MINOR "${${LibName}_VERSION_MINOR}") | ||
set(CPACK_PACKAGE_VERSION_PATCH "${${LibName}_VERSION_PATCH}") | ||
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/pkgs") # for easy uploading to github releases | ||
|
||
if(NOT WIN32) | ||
############################### | ||
# info specific debian packages | ||
############################### | ||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH}) | ||
set(CPACK_DEBIAN_PACKAGE_SECTION libs) | ||
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) | ||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) | ||
|
||
############################### | ||
# info specific rpm (fedora) packages | ||
############################### | ||
set(CPACK_RPM_FILE_NAME "lib${LibTargetName}-${${LibName}_VERSION_STRING}-${PKG_REV}.${TARGET_ARCH}.rpm") | ||
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${TARGET_ARCH}) | ||
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2.0") | ||
set(CPACK_RPM_PACKAGE_VENDOR "Humanity") | ||
|
||
# create a post-install & post-removal scripts to update linker | ||
set(POST_SCRIPTS | ||
${CMAKE_BINARY_DIR}/DEBIAN/postrm | ||
${CMAKE_BINARY_DIR}/DEBIAN/postinst | ||
) | ||
foreach(script ${POST_SCRIPTS}) | ||
file(WRITE ${script} /sbin/ldconfig) | ||
execute_process(COMMAND chmod +x ${script}) | ||
execute_process(COMMAND chmod 775 ${script}) | ||
endforeach() | ||
# declare scripts for deb pkgs | ||
list(JOIN POST_SCRIPTS ";" EXTRA_CTRL_FILES) | ||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA EXTRA_CTRL_FILES) | ||
# declare scripts for rpm pkgs | ||
list(POP_FRONT POST_SCRIPTS CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE) | ||
list(POP_FRONT POST_SCRIPTS CPACK_RPM_POST_INSTALL_SCRIPT_FILE) | ||
|
||
message(STATUS "ready to package: ${CPACK_PACKAGE_FILE_NAME}.deb") | ||
message(STATUS "ready to package: ${CPACK_RPM_FILE_NAME}") | ||
endif() | ||
|
||
include(CPack) |
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,31 @@ | ||
option(ENABLE_CACHE "Enable cache if available" ON) | ||
if(NOT ENABLE_CACHE) | ||
return() | ||
endif() | ||
|
||
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 | ||
) | ||
|
||
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}) | ||
if(CACHE_BINARY) | ||
message(STATUS "${CACHE_OPTION} found and enabled") | ||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BINARY}) | ||
else() | ||
message(WARNING "${CACHE_OPTION} is enabled but was not found. Not using it") | ||
endif() |
Oops, something went wrong.