Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/workflows/cmake-linux-cc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# ##################################################################
#
# Cross-compile with CMake workflow for areg-sdk Demo project
#
# ##################################################################
name: CMake Linux Cross-Compile

on:
push: # Keep empty to run on each branch when push the code. Otherwise use branches: [ master ]
branches: [ main ]
pull_request: # Set to master to run only when merge with master branch
branches: [ main ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Linux.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix

jobs:

job_linux:
name: Linux Platform, x86_64, x86, arm, aarch64 builds
runs-on: ubuntu-latest
steps:
- name: Linux - Checkout AREG SDK Demo project sources and dependencies
uses: actions/checkout@v4

- name: Linux - Setup Java JDK on Windows to run code generator
uses: actions/[email protected]
with:
java-version: 17
java-package: jre
distribution: temurin

- name: Update compilers on Linux
# Update compilers, set C/C++ compilers
run: sudo apt-get update

- name: Linux - Configure Demo, include AREG SDK after project(), GNU on x64, shared
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-x64-so -DAREG_COMPILER_FAMILY=gnu

- name: Linux - Build Demo, include AREG SDK after project(), GNU on x64, shared
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-x64-so -j20

- name: Linux - Install multilib
run: sudo apt-get install -y gcc-multilib g++-multilib

- name: Linux - Configure Demo, include AREG SDK after project(), GNU on x86, shared
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-x86-so -DAREG_COMPILER_FAMILY=gnu -DAREG_PROCESSOR=x86

- name: Linux - Build Demo, include AREG SDK after project(), GNU on x86, shared
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-x86-so -j20

- name: Linux - Install GNU 32-bit ARM compilers
run: sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf

- name: Linux - Configure Demo, include AREG SDK after project(), GNU on arm32, shared
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-arm-so -DAREG_COMPILER_FAMILY=gnu -DAREG_PROCESSOR=arm

- name: Linux - Build Demo, include AREG SDK after project(), GNU on arm32, shared
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-arm-so -j20

- name: Linux - Install GNU 64-bit AARCH64 compilers
run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu

- name: Linux - Configure Demo, include AREG SDK after project(), GNU on aarch64, shared
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-aarch64-so -DAREG_COMPILER_FAMILY=gnu -DAREG_PROCESSOR=aarch64

- name: Linux - Build Demo, include AREG SDK after project(), GNU on aarch64, shared
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-aarch64-so -j20

- name: Linux - Fix 'asm' directory issue by creating symlink.
run: sudo ln -s /usr/include/asm-generic/ /usr/include/asm

- name: Linux - Cross-compile configure, gnu-linux-arm32.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-linux-arm32 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/gnu-linux-arm32.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, gnu-linux-arm32.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-linux-arm32 -j20

- name: Linux - Cross-compile configure, gnu-linux-arm64.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-linux-arm64 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/gnu-linux-arm64.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, gnu-linux-arm64.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-linux-arm64 -j20

- name: Linux - Cross-compile configure, gnu-linux-x64.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-linux-x64 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/gnu-linux-x64.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, gnu-linux-x64.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-linux-x64 -j20

- name: Linux - Cross-compile configure, gnu-linux-x86.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/gnu-linux-x86 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/gnu-linux-x86.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, gnu-linux-x86.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/gnu-linux-x86 -j20

- name: Linux - Cross-compile configure, clang-linux-arm32.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/clang-linux-arm32 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/clang-linux-arm32.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, clang-linux-arm32.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/clang-linux-arm32 -j20

- name: Linux - Cross-compile configure, clang-linux-arm64.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/clang-linux-arm64 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/clang-linux-arm64.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, clang-linux-arm64.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/clang-linux-arm64 -j20

- name: Linux - Cross-compile configure, clang-linux-x64.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/clang-linux-x64 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/clang-linux-x64.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, clang-linux-x64.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/clang-linux-x64 -j20

- name: Linux - Cross-compile configure, clang-linux-x86.cmake
working-directory: ${{github.workspace}}
run: cmake -B ./product/cache/clang-linux-x86 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/clang-linux-x86.cmake -DAREG_EXTENDED:BOOL=ON

- name: Linux - Cross-compile build, clang-linux-x86.cmake
working-directory: ${{github.workspace}}
run: cmake --build ./product/cache/clang-linux-x86 -j20
5 changes: 5 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# ##################################################################
#
# CMake workflow for areg-sdk Demo project
#
# ##################################################################
name: CMake

on:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# ##################################################################
#
# MSBuild workflow for areg-sdk Demo project
#
# ##################################################################
name: MSBuild

on:
Expand Down
31 changes: 6 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# set project options before integrating AREG SDK.
# ##################################################################

cmake_minimum_required(VERSION 3.20.0)

set(PROJECT_DEMO_NAME "areg-sdk-demo")
set(PROJECT_DEMO_VERSION "2.0.0")

# Macro to load and configure the AREG SDK package or source repository
macro(macro_load_areg_sdk)

Expand Down Expand Up @@ -66,6 +61,11 @@ macro(macro_load_areg_sdk)
endif()
endmacro(macro_load_areg_sdk)

cmake_minimum_required(VERSION 3.20.0)

set(PROJECT_DEMO_NAME "areg-sdk-demo")
set(PROJECT_DEMO_VERSION "2.0.0")

# Set the root of the demo project and its sources
set(AREG_SDK_DEMO_ROOT "${CMAKE_SOURCE_DIR}")
set(AREG_DEMO_SOURCES "${AREG_SDK_DEMO_ROOT}/demo")
Expand All @@ -89,32 +89,13 @@ else()
set(AREG_COMPILER "")
set(AREG_COMPILER_FAMILY "")

if (WIN32)
if (DEFINED CMAKE_CXX_COMPILER)
string(FIND "${CMAKE_CXX_COMPILER}" "clang-cl" _is_llvm REVERSE)
if (_is_llvm GREATER -1)
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
endif()
endif()

if (DEFINED CMAKE_SYSTEM_PROCESSOR)
string(FIND "${CMAKE_CXX_COMPILER}" "64" _is_64bit)
if (_is_64bit GREATER -1)
set(CMAKE_GENERATOR_PLATFORM x64 CACHE INTERNAL "Force 64-bit compilation")
else()
set(CMAKE_GENERATOR_PLATFORM Win32 CACHE INTERNAL "Force 32-bit compilation")
endif()
endif()
endif()

# Declare the project
project(${PROJECT_DEMO_NAME} VERSION ${PROJECT_DEMO_VERSION} LANGUAGES C CXX)

# Now integrate AREG SDK after project is defined
macro_load_areg_sdk()

endif()


# ##################################################################
# Steps to prepare AREG SDK base applications:
#
Expand Down
20 changes: 20 additions & 0 deletions toolchains/clang-linux-arm32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This toolchain builds 32-bit binaries with Clang compiler for Linux on 32-bit ARM processor
# Run example:
# cmake -B ./product/cache/clang-linux-arm32 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/clang-linux-arm32.cmake
# cmake --build ./product/cache/clang-linux-arm32 -j20

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ARM)

set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf)

set(CMAKE_FIND_ROOT_PATH "/usr")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
20 changes: 20 additions & 0 deletions toolchains/clang-linux-arm64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This toolchain builds 64-bit binaries with Clang compiler for Linux on 64-bit ARM (AARCH64) processor.
# Run example:
# cmake -B ./product/cache/clang-linux-arm64 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/clang-linux-arm64.cmake
# cmake --build ./product/cache/clang-linux-arm64 -j20

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR AARCH64)

set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_TARGET aarch64-linux-gnu)

set(CMAKE_FIND_ROOT_PATH "/usr")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE aarch64-linux-gnu)
13 changes: 10 additions & 3 deletions toolchains/clang-linux-x64.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# This toolchain builds 64-bit binaries with Clang compiler for Linux on x64 processor
# This toolchain builds 64-bit binaries with Clang compiler for Linux on x86-64 processor
# Run example:
# cmake -B ./product/cache/clang-linux-x64 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/clang-linux-x64.cmake
# cmake --build ./product/cache/clang-linux-x64 -j20

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x64)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET x86_64-linux-gnu)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_FIND_ROOT_PATH /usr/bin)
set(CMAKE_CXX_COMPILER_TARGET x86_64-linux-gnu)

set(CMAKE_FIND_ROOT_PATH "/usr")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)
11 changes: 9 additions & 2 deletions toolchains/clang-linux-x86.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
# cmake --build ./product/cache/clang-linux-x86 -j20

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86)
set(CMAKE_SYSTEM_PROCESSOR i386)

set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET i386-linux-gnu)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_FIND_ROOT_PATH /usr/bin)
set(CMAKE_CXX_COMPILER_TARGET i386-linux-gnu)

set(CMAKE_FIND_ROOT_PATH "/usr")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE i386-linux-gnu)
12 changes: 9 additions & 3 deletions toolchains/clang-win-x64.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# This toolchain builds 64-bit binaries with Clang compiler for Windows on x64 processor
# This toolchain builds 64-bit binaries with Clang compiler for Windows on x86-64 processor
# Run example:
# cmake -B ./product/cache/clang-win-x64 -DCMAKE_TOOLCHAIN_FILE=C:/path/to/areg-sdk-demo/toolchains/clang-win-x64.cmake
# cmake --build ./product/cache/clang-win-x64 -j20 --config=Release

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR AMD64)

set(CMAKE_C_COMPILER clang-cl)
set(CMAKE_CXX_COMPILER clang-cl)
set(CMAKE_FIND_ROOT_PATH /)

set(CMAKE_FIND_ROOT_PATH "/")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE x64)

set(CMAKE_GENERATOR_PLATFORM x64 CACHE INTERNAL "Force 64-bit compilation")
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
10 changes: 8 additions & 2 deletions toolchains/clang-win-x86.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86)

set(CMAKE_C_COMPILER clang-cl)
set(CMAKE_CXX_COMPILER clang-cl)
set(CMAKE_FIND_ROOT_PATH /)

set(CMAKE_FIND_ROOT_PATH "/")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE x86)

set(CMAKE_GENERATOR_PLATFORM Win32 CACHE INTERNAL "Force 32-bit compilation")
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
11 changes: 9 additions & 2 deletions toolchains/gnu-linux-arm32.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# This toolchain builds 32-bit binaries with GNU compiler for Linux on 32-bit ARM processor
# This toolchain builds 32-bit binaries with GNU g++/gcc compiler for Linux on 32-bit ARM processor
# Run example:
# cmake -B ./product/cache/gnu-linux-arm32 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/gnu-linux-arm32.cmake
# cmake --build ./product/cache/gnu-linux-arm32 -j20

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ARM)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH /usr/bin)
set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf)

set(CMAKE_FIND_ROOT_PATH "/usr")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
Loading
Loading