feature test compile

This commit is contained in:
tqcq 2023-12-05 10:05:36 +08:00
parent ffc41bd2a4
commit f08ae94e37
9 changed files with 256 additions and 0 deletions

View File

@ -0,0 +1,75 @@
name: rpcrypto-build
on:
- push
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
build_type:
- Debug
- Release
toolchain:
- host.toolchain.cmake
- host-afl.toolchain.cmake
- hisiv500.toolchain.cmake
- hisiv510.toolchain.cmake
- himix200.toolchain.cmake
- mips64el-linux-gnuabi64.toolchain.cmake
- mipsel-openwrt-linux-musl.toolchain.cmake
- mipsel-openwrt-linux.toolchain.cmake
runs-on: ubuntu-20.04
env:
build_command: |
cd ${{ github.workspace }}
pwd
ls -alh
# /bin/bash scripts/install-flatc.sh
cmake . -Bbuild \
-DCMAKE_TOOLCHAIN_FILE=toolchains/${{ matrix.toolchain }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build build --config ${{ matrix.build_type }} --target all -- -j `nproc`
cmake --build build --config ${{ matrix.build_type }} --target install
steps:
# - name: Install Dependencies
# run: |
# apt-get update -y
# apt-get install -y \
# cmake make g++ libssl-dev pkg-config autoconf libtool
- uses: actions/checkout@v4
# - name: configure
# run: cmake . -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
# - name: build
# run: cmake --build build --config ${{ matrix.build_type }} --target all -- -j `nproc`
- name: build
if: matrix.toolchain == 'host.toolchain.cmake'
run: |
apt-get update -y
apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++
${{ env.build_command }}
- name: build-afl
if: matrix.toolchain == 'host-afl.toolchain.cmake'
run: |
apt-get update -y
apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config afl++ cmake make gcc g++
export AFL_LLVM_LAF_ALL=1
export CC=/usr/bin/afl-clang-fast
export CXX=/usr/bin/afl-clang-fast++
${{ env.build_command }}
- name: build-in-centos
uses: addnab/docker-run-action@v3
if: matrix.toolchain != 'host.toolchain.cmake' && matrix.toolchain != 'host-afl.toolchain.cmake'
with:
image: tqcq/hisi:centos
options: --rm --volumes-from ${{ env.JOB_CONTAINER_NAME }}
run: |
yum clean all
yum install -y libarchive cmake make gcc gcc-c++ openssl-devel autoconf libtool pkg-config
${{ env.build_command }}

View File

@ -0,0 +1,33 @@
# set cross-compiled system type, it's better not use the type which cmake cannot recognized.
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# when hislicon SDK was installed, toolchain was installed in the path as below:
set(CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc")
set(CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-himix200-linux")
# set searching rules for cross-compiler
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
# set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
set(CROSS_COMPILATION_ARM himix200)
set(CROSS_COMPILATION_ARCHITECTURE armv7-a)
# set g++ param
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 ${CMAKE_CXX_FLAGS}")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

View File

@ -0,0 +1,29 @@
# set cross-compiled system type, it's better not use the type which cmake cannot recognized.
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# when hislicon SDK was installed, toolchain was installed in the path as below:
set(CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc")
set(CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv500-linux")
# set searching rules for cross-compiler
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
# set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 ${CMAKE_CXX_FLAGS}")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

View File

@ -0,0 +1,29 @@
# set cross-compiled system type, it's better not use the type which cmake cannot recognized.
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# when hislicon SDK was installed, toolchain was installed in the path as below:
set(CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv510-linux/target/bin/arm-hisiv510-linux-gcc")
set(CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv510-linux/target/bin/arm-hisiv510-linux-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv510-linux")
# set searching rules for cross-compiler
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
# set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 ${CMAKE_CXX_FLAGS}")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

View File

@ -0,0 +1,9 @@
#set(CMAKE_SYSTEM_NAME Linux)
#set(CMAKE_SYSTEM_PROCESSOR x86_64)
#set(CMAKE_HOST_SYSTEM x86_64)
#set(CMAKE_C_COMPILER_LAUNCHER "/usr/bin/afl-clang-fast")
#set(CMAKE_CXX_COMPILER_LAUNCHER "/usr/bin/afl-clang-fast++")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fsanitize=address,undefined -fno-sanitize-recover=all -g")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fsanitize=address,undefined -fno-sanitize-recover=all -g")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-rtti -fsanitize=address,undefined -fno-sanitize-recover=all")
#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fno-rtti -fsanitize=address,undefined -fno-sanitize-recover=all")

View File

View File

@ -0,0 +1,27 @@
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR mips64el)
set(CMAKE_C_COMPILER "/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc")
set(CMAKE_CXX_COMPILER "/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/gcc-4.9.3-64-gnu/")
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
set(CMAKE_C_FLAGS "-march=mips64")
set(CMAKE_CXX_FLAGS "-march=mips64")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

View File

@ -0,0 +1,27 @@
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR mipsel)
set(CMAKE_C_COMPILER "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-musl-gcc")
set(CMAKE_CXX_COMPILER "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-musl-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl")
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
set(CMAKE_C_FLAGS "-march=mips32")
set(CMAKE_CXX_FLAGS "-march=mips32")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

View File

@ -0,0 +1,27 @@
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR mipsel)
set(CMAKE_C_COMPILER "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-gcc")
set(CMAKE_CXX_COMPILER "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-g++")
set(CMAKE_FIND_ROOT_PATH "/opt/openwrt-toolchain/toolchain-mipsel_24kc_gcc-7.3.0_musl")
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
set(CMAKE_C_FLAGS "-march=mips32")
set(CMAKE_CXX_FLAGS "-march=mips32")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")