zynq_7010/zynq_7010_code/CMakeLists.txt

78 lines
2.9 KiB
CMake
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.0.0)
project(scanservice)
add_compile_options(-std=c++14)
#set (CMAKE_GENERATOR "/home/holdtecs/zzm-linux/rk3288-linux/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++")
#交叉编译配置
# set(CMAKE_SYSTEM_NAME Linux)
# set(CMAKE_SYSTEM_PROCESSOR arm)
#可选配置roofs和安装路径如果存在
#set(linux_sdk_path /home/holdtecs/zzm-linux/rk3288-linux)
#set(linux_sdk_path /mnt/disk2/linux-rhx/rk3288-linux)
#set(CMAKE_SYSROOT ${linux_sdk_path}/buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/sysroot)
# set(CMAKE_STAGING_PREFIX ${PROJECT_SOURCE_DIR}/install)
#编译工具配置
#set(tools ${linux_sdk_path}/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf)
# set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
# set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
# set(CMAKE_LIBRARY_ARCHITECTURE arm)
#add_subdirectory(fpga)
set(-mfloat-abi=hard)
# 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_C_FLAGS "${CMAKE_C_FLAGS} -O1 -fvectorize")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fvectorize")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(OpenCV_DIR /home/modehua/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/include/opencv4/)
#set(OpenCV_DIR /home/holdtecs/zzm-linux/fs/usr/lib)
#find_package( OpenCV 3 REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
FILE(GLOB SRC "*.cpp" "*.h" "*.c")
FILE(GLOB IMAGEPRO "imageprocess/*.h" "imageprocess/*.cpp" )
FILE(GLOB FPGA "fpga/*.h" "fpga/*.cpp" )
# message(STATUS "SRC:" ${SRC})
# message(STATUS "IMAGEPRO:" ${IMAGEPRO})
#message(STATUS "FPGA:" ${FPGA})
set(CMAKE_BUILD_TYPE "Release")
include_directories(
fpga
imageprocess
imageprocess/include
#/home/modehua/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/include/opencv4/
)
add_executable(${PROJECT_NAME} ${SRC})
#优化代码大小
SET(-CMAKE_BUILD_TYPE "Release")
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND $ENV{STRIP} -s ${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "-s")
#target_link_libraries(${PROJECT_NAME} ${PROJECT_BINARY_DIR}/bin/libfpgaupdate.a)
target_link_libraries(${PROJECT_NAME} opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs turbojpeg pthread )
target_link_libraries(${PROJECT_NAME} pthread )
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/fpga
/home/modehua/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/include/opencv4/
)