1# set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2SET ( CMAKE_SYSTEM_NAME Linux )
3SET ( CMAKE_SYSTEM_PROCESSOR aarch64 )
4# for the reason of aarch64-linux-gnu-gcc DONOT need to be installed, make sure aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ can be found in $PATH:
5SET ( CMAKE_C_COMPILER "aarch64-linux-gnu-gcc" )
6SET ( CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++" )
7
8# set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
9# -march=armv8-a could work on Jetson, but will compile without some extra cpu features
10SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=native -fopenmp ${CMAKE_CXX_FLAGS}" )
11
12# other settings
13# Jetson CPU supports asimd
14add_definitions ( -D__ARM_NEON)
15# Jetson does NOT run ANDROID
16# but `__ANDROID__` marco is tested before `__aarch64__`
17# and currently no negative effect is caused by this marco
18add_definitions( -D__ANDROID__)
19SET ( ANDROID true)
20