Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra/onert] Update cmake toolchain file #14498

Merged
merged 1 commit into from
Dec 27, 2024
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
8 changes: 7 additions & 1 deletion infra/nnfw/cmake/buildtool/config/config_armv7l-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ set(FLAGS_COMMON ${FLAGS_COMMON}
"-mfloat-abi=hard"
"-mfpu=neon-vfpv4"
"-ftree-vectorize"
"-mfp16-format=ieee"
)

# "fp16-format=ieee" is default and not supported flag on Clang
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-mfp16-format=ieee COMPILER_SUPPORTS_FP16_FORMAT_I3E)
if(COMPILER_SUPPORTS_FP16_FORMAT_I3E)
set(FLAGS_COMMON ${FLAGS_COMMON} "-mfp16-format=ieee")
endif()
25 changes: 16 additions & 9 deletions infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-linux.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#
# config for aarch64-linux
#
include(CMakeForceCompiler)

# Set CMAKE_SYSTEM_NAME to notify to cmake that we are cross compiling
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)

# where is the target environment
set(NNAS_PROJECT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
set(ROOTFS_AARCH64 "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/aarch64")
include("${NNAS_PROJECT_SOURCE_DIR}/infra/cmake/modules/OptionTools.cmake")
if(DEFINED ENV{USE_CLANG} AND "$ENV{USE_CLANG}" STREQUAL "1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question,
why did you add clang support?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Sometimes someone request clang build (ex. oversea member)
  • More strict frontend check than gcc, and gcc follows these check on version up

set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf)
set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf)
else()
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
endif()

envoption(ROOTFS_DIR ${ROOTFS_AARCH64})
# where is the target RootFS
if(DEFINED ENV{ROOTFS_DIR})
set(ROOTFS_DIR $ENV{ROOTFS_DIR})
else()
set(ROOTFS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../../tools/cross/rootfs/aarch64")
endif()
if(NOT EXISTS "${ROOTFS_DIR}/lib/aarch64-linux-gnu")
message(FATAL_ERROR "Please prepare RootFS for AARCH64")
endif()
Expand Down
56 changes: 0 additions & 56 deletions infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-tizen.cmake

This file was deleted.

23 changes: 15 additions & 8 deletions infra/nnfw/cmake/buildtool/cross/toolchain_armv7l-linux.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#
# config for arm-linux
#
include(CMakeForceCompiler)

# Set CMAKE_SYSTEM_NAME to notify to cmake that we are cross compiling
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv7l)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
if(DEFINED ENV{USE_CLANG} AND "$ENV{USE_CLANG}" STREQUAL "1")
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf)
set(CMAKE_CXX_COMPILER_TARGET arm-linux-gnueabihf)
else()
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
endif()

# where is the target environment
set(NNAS_PROJECT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
set(ROOTFS_ARM "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/arm")
include("${NNAS_PROJECT_SOURCE_DIR}/infra/cmake/modules/OptionTools.cmake")

envoption(ROOTFS_DIR ${ROOTFS_ARM})
if(DEFINED ENV{ROOTFS_DIR})
set(ROOTFS_DIR $ENV{ROOTFS_DIR})
else()
set(ROOTFS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../../tools/cross/rootfs/arm")
endif()
if(NOT EXISTS "${ROOTFS_DIR}/lib/arm-linux-gnueabihf")
message(FATAL_ERROR "Please prepare RootFS for ARM")
endif()
Expand Down