Skip to content

Commit

Permalink
add arm6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechnobear committed Nov 5, 2020
1 parent 6213c5c commit e5ab0a6
Showing 1 changed file with 54 additions and 18 deletions.
72 changes: 54 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,64 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fomit-frame-pointer")


if (SALT)
set(BELA on)
endif (SALT)

if (PEPPER)
set(BELA on)
endif (PEPPER)

if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^armv6l")
set(ARM6 on)
endif()

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Processor: ${CMAKE_SYSTEM_PROCESSOR}")

if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST")
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
if (BELA)
message(STATUS "BELA optimized")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize --fast-math")
if (NOT DEFINED CPU_OPTIMIZATION_FLAGS)
if (APPLE)
elseif (UNIX)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
if (BELA)
message(STATUS "BELA optimized")
# /usr/xenomai/bin/xeno-config --skin=cobalt --no-mode-check --cflags
if(SALT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSALT")
endif(SALT)
if(PEPPER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPEPPER")
endif(PEPPER)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/xenomai/include/cobalt -I/usr/xenomai/include -march=armv7-a -D_GNU_SOURCE -D_REENTRANT -D__COBALT__")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -ftree-vectorize")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBELA")
# /usr/xenomai/bin/xeno-config --skin=cobalt --no-auto-init --no-mode-check --ldflags
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsingle-precision-constant --fast-math")
endif()

set(BELA_LINK_FLAGS "-v ${BELA_LINK_FLAGS} -Wl,@${PROJECT_SOURCE_DIR}/xenomai.wrappers -Wl,--no-as-needed -L/usr/xenomai/lib -lcobalt -lmodechk -lpthread -lrt")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${BELA_LINK_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${BELA_LINK_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${BELA_LINK_FLAGS}")
#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${BELA_LINK_FLAGS} ")
elseif (ARM6)
message(STATUS "arm6 build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv6+fp -mfpu=vfp -mfloat-abi=hard")
else ()
message(STATUS "arm7 build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -mfloat-abi=hard")
endif ()
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard")
endif (BELA)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST")
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall")
endif ()
endif ()
elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST")
set(PD_CMAKE_PATH C:/Program\ Files\ \(x86\)/Pd/bin)
endif (APPLE)

else()
message(STATUS "Using provided optimization flags '${CPU_OPTIMIZATION_FLAGS}'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPU_OPTIMIZATION_FLAGS}")
endif ()

## setup rpath for linux and macos
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Expand Down

0 comments on commit e5ab0a6

Please sign in to comment.