CMakeLists.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Example:
  2. # cmake -DLIBSTDCPP_HOME=/path/to/avr-libstdcpp -DCMAKE_TOOLCHAIN_FILE=../examples/mb/toolchain.cmake -DCMAKE_BUILD_TYPE=MinSizeRel
  3. # -DXIL_STANDALONE_BSP_INCLUDE=/path/to/bspinclude/include -DXIL_STANDALONE_BSP_LIB=/path/to/bsplib/lib -DCMAKE_CXX_COMPILER_AR=mb-ar
  4. # -DCMAKE_CXX_COMPILER_RANLIB=mb-ranlib ..
  5. cmake_minimum_required(VERSION 3.8)
  6. cmake_policy(SET CMP0069 NEW)
  7. include(CheckIPOSupported)
  8. check_ipo_supported(RESULT supported OUTPUT error)
  9. if( supported )
  10. message(STATUS "IPO / LTO enabled for the microblaze builds")
  11. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
  12. else()
  13. message(STATUS "IPO / LTO not supported: <${error}>")
  14. endif()
  15. if (NOT ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "MICROBLAZE" ))
  16. message(FATAL_ERROR "wrong system processor ${CMAKE_SYSTEM_PROCESSOR}, expected: MICROBLAZE")
  17. endif()
  18. message(STATUS "will use stdlib++ from '${LIBSTDCPP_HOME}'")
  19. add_library(board board.cpp)
  20. target_include_directories(rotor_light PUBLIC "${LIBSTDCPP_HOME}/include")
  21. target_include_directories(board PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
  22. target_link_libraries(board rotor_light)
  23. add_executable(blink-led blink-led.cpp)
  24. target_link_libraries(blink-led board)
  25. add_executable(ping-pong-poll ping-pong-poll.cpp)
  26. target_link_libraries(ping-pong-poll board)