diff --git a/.github/workflows/cmake-linux-cc.yml b/.github/workflows/cmake-linux-cc.yml new file mode 100644 index 0000000..27fd61e --- /dev/null +++ b/.github/workflows/cmake-linux-cc.yml @@ -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/setup-java@v4.5.0 + 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 diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 59fdf87..c120fb9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,3 +1,8 @@ +# ################################################################## +# +# CMake workflow for areg-sdk Demo project +# +# ################################################################## name: CMake on: diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index fd835b4..be22da8 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ced814..df05cd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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") @@ -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: # diff --git a/thirdparty/areg-sdk b/thirdparty/areg-sdk index 9054631..d0d3d84 160000 --- a/thirdparty/areg-sdk +++ b/thirdparty/areg-sdk @@ -1 +1 @@ -Subproject commit 9054631a2ecfcfc95c072a8fd4f94881f18aec4d +Subproject commit d0d3d84b969070b8e28bd4c717174bdafea21a7e diff --git a/toolchains/clang-linux-arm32.cmake b/toolchains/clang-linux-arm32.cmake new file mode 100644 index 0000000..a376e30 --- /dev/null +++ b/toolchains/clang-linux-arm32.cmake @@ -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) diff --git a/toolchains/clang-linux-arm64.cmake b/toolchains/clang-linux-arm64.cmake new file mode 100644 index 0000000..94b45b0 --- /dev/null +++ b/toolchains/clang-linux-arm64.cmake @@ -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) diff --git a/toolchains/clang-linux-x64.cmake b/toolchains/clang-linux-x64.cmake index 3dafa93..34d03e0 100644 --- a/toolchains/clang-linux-x64.cmake +++ b/toolchains/clang-linux-x64.cmake @@ -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) diff --git a/toolchains/clang-linux-x86.cmake b/toolchains/clang-linux-x86.cmake index d98aab8..8172e63 100644 --- a/toolchains/clang-linux-x86.cmake +++ b/toolchains/clang-linux-x86.cmake @@ -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) diff --git a/toolchains/clang-win-x64.cmake b/toolchains/clang-win-x64.cmake index ad0cc1b..8e693cd 100644 --- a/toolchains/clang-win-x64.cmake +++ b/toolchains/clang-win-x64.cmake @@ -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") diff --git a/toolchains/clang-win-x86.cmake b/toolchains/clang-win-x86.cmake index 6d6204d..e0d939b 100644 --- a/toolchains/clang-win-x86.cmake +++ b/toolchains/clang-win-x86.cmake @@ -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") diff --git a/toolchains/gnu-linux-arm32.cmake b/toolchains/gnu-linux-arm32.cmake index 6fabe8b..fb8248b 100644 --- a/toolchains/gnu-linux-arm32.cmake +++ b/toolchains/gnu-linux-arm32.cmake @@ -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) diff --git a/toolchains/gnu-linux-arm64.cmake b/toolchains/gnu-linux-arm64.cmake index af73a94..de894aa 100644 --- a/toolchains/gnu-linux-arm64.cmake +++ b/toolchains/gnu-linux-arm64.cmake @@ -1,13 +1,20 @@ -# This toolchain builds 64-bit binaries with GNU compiler for Linux on 64-bit ARM (AARCH64) processor. +# This toolchain builds 64-bit binaries with GNU g++/gcc compiler for Linux on 64-bit ARM (AARCH64) processor. # Run example: # cmake -B ./product/cache/gnu-linux-arm64 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/gnu-linux-arm64.cmake # cmake --build ./product/cache/gnu-linux-arm64 -j20 set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR AARCH64) + set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu) set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) -set(CMAKE_FIND_ROOT_PATH /usr/bin) +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) diff --git a/toolchains/gnu-linux-x64.cmake b/toolchains/gnu-linux-x64.cmake index 0905513..ff5ca76 100644 --- a/toolchains/gnu-linux-x64.cmake +++ b/toolchains/gnu-linux-x64.cmake @@ -1,13 +1,21 @@ -# This toolchain builds 64-bit binaries with GNU compiler for Linux on x64 processor +# This toolchain builds 64-bit binaries with GNU g++/gcc compiler for Linux on x86-64 processor # Run example: # cmake -B ./product/cache/gnu-linux-x64 -DCMAKE_TOOLCHAIN_FILE=/path/to/areg-sdk-demo/toolchains/gnu-linux-x64.cmake # cmake --build ./product/cache/gnu-linux-x64 -j20 set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR x86_64) + set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER_TARGET x86_64-linux-gnu) set(CMAKE_CXX_COMPILER g++) -set(CMAKE_FIND_ROOT_PATH /usr/bin) +set(CMAKE_CXX_COMPILER_TARGET x86_64-linux-gnu) + +# set(CMAKE_FIND_ROOT_PATH "/usr/lib/x86_64-linux-gnu;/usr/x86_64-linux-gnu;/usr/lib;/usr/include") +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) diff --git a/toolchains/gnu-linux-x86.cmake b/toolchains/gnu-linux-x86.cmake index 43a9ef5..44af12a 100644 --- a/toolchains/gnu-linux-x86.cmake +++ b/toolchains/gnu-linux-x86.cmake @@ -4,10 +4,17 @@ # cmake --build ./product/cache/gnu-linux-x86 -j20 set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR x86) +set(CMAKE_SYSTEM_PROCESSOR i386) + set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER_TARGET i386-linux-gnu) set(CMAKE_CXX_COMPILER g++) -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) diff --git a/toolchains/msvc-win-x64.cmake b/toolchains/msvc-win-x64.cmake index 0e60d78..771e7a1 100644 --- a/toolchains/msvc-win-x64.cmake +++ b/toolchains/msvc-win-x64.cmake @@ -1,14 +1,20 @@ -# This toolchain builds 64-bit binaries with MSVC compiler for Windows on x64 processor +# This toolchain builds 64-bit binaries with MSVC compiler for Windows on x86-64 processor # Run example: # cmake -B ./product/cache/msvc-win-x64 -DCMAKE_TOOLCHAIN_FILE=C:/path/to/areg-sdk-demo/toolchains/msvc-win-x64.cmake # cmake --build ./product/cache/msvc-win-x64 -j20 --config=Release set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR AMD64) + set(CMAKE_C_COMPILER cl) set(CMAKE_CXX_COMPILER 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_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(CMAKE_LIBRARY_ARCHITECTURE x64) + set(CMAKE_GENERATOR_PLATFORM x64 CACHE INTERNAL "Force 64-bit compilation") diff --git a/toolchains/msvc-win-x86.cmake b/toolchains/msvc-win-x86.cmake index a5e98d9..3994199 100644 --- a/toolchains/msvc-win-x86.cmake +++ b/toolchains/msvc-win-x86.cmake @@ -5,10 +5,16 @@ set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR x86) + set(CMAKE_C_COMPILER cl) set(CMAKE_CXX_COMPILER 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_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(CMAKE_LIBRARY_ARCHITECTURE x86) + set(CMAKE_GENERATOR_PLATFORM Win32 CACHE INTERNAL "Force 32-bit compilation")