#RPI1-ZERO toolchain set(RPI True) set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR armv6) set(SCOL_INSTALL_PREFIX "RPIZERO") set(PIZERO "ZERO") set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # cross-compiler set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) set(CMAKE_LINKER arm-linux-gnueabihf-ld) set(CMAKE_OBJCOPY arm-linux-gnueabihf-objcopy) set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf) list(APPEND CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf/lib /usr/arm-linux-gnueabihf/usr/lib /usr/lib/arm-linux-gnueabihf /opt/vc/lib/) # Tell pkg-config to look for libraries set(ENV{PKG_CONFIG_PATH} "/usr/lib/arm-linux-gnueabihf/pkgconfig") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) # Todo add -mfpu=neon-vfpv4 #RPI 1 flags -mfpu=vfp -mfloat-abi=hard -march=armv6 -mtune=arm1176jzf-s set(CMAKE_C_FLAGS "-pipe -march=armv6 -marm -mthumb-interwork -mfpu=vfp -mtune=arm1176jzf-s -mabi=aapcs-linux -mfloat-abi=hard -fomit-frame-pointer -fsigned-char" CACHE STRING "Flags for Raspberry Pi 1") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Flags for Raspberry Pi 1") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "c++ Release flags" ) set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "c Release flags" ) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c++ Debug flags" ) set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c Debug flags" ) set(CMAKE_SKIP_RPATH 1) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-new-dtags,-R,\\\$ORIGIN" CACHE STRING "Flags executables") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags,-R,\\\$ORIGIN" CACHE STRING "Flags shared") set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES}) add_definitions(-DRPI -DRPIZERO -D__ARM_PCS_VFP -fPIC) # Find Python 3 interpreter find_package(Python3 COMPONENTS Interpreter) if(NOT Python3_FOUND) find_program(PYTHON_EXECUTABLE python3) if(NOT PYTHON_EXECUTABLE) message(FATAL_ERROR "Python3 not found. Please install Python3.") else() set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE PATH "Python executable" FORCE) endif() else() set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE PATH "Python executable" FORCE) endif()