Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

initialize.cmake 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ###| CMAKE Kiibohd Controller Initialization |###
  2. #
  3. # Written by Jacob Alexander in 2011-2014 for the Kiibohd Controller
  4. #
  5. # Released into the Public Domain
  6. #
  7. ###
  8. #| Windows / Cygwin Compatibility options
  9. set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
  10. set( CMAKE_USE_RELATIVE_PATHS 1 )
  11. #| Prevent In-Source Builds
  12. set( CMAKE_DISABLE_SOURCE_CHANGES ON )
  13. set( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
  14. ###
  15. # Compiler Lookup
  16. #
  17. #| avr match
  18. if ( "${CHIP}" MATCHES "^at90usb.*$" OR "${CHIP}" MATCHES "^atmega.*$" )
  19. set( COMPILER_FAMILY "avr" )
  20. #| arm match
  21. elseif ( "${CHIP}" MATCHES "^mk20dx.*$" )
  22. set( COMPILER_FAMILY "arm" )
  23. #| Invalid CHIP
  24. else ()
  25. message( FATAL_ERROR "CHIP: ${CHIP} - Unknown chip, could not choose compiler..." )
  26. endif ()
  27. #| Results of Compiler Lookup
  28. message( STATUS "Compiler Family:" )
  29. message( "${COMPILER_FAMILY}" )
  30. #| Compiler Selection Record
  31. #| This is used to check if the chip target has changed (a complete cmake reset is needed)
  32. if ( EXISTS compiler )
  33. file( READ ${CMAKE_BINARY_DIR}/compiler COMPILER_RECORD )
  34. # Detect case if a full cmake reset is required
  35. if ( NOT COMPILER_FAMILY STREQUAL COMPILER_RECORD )
  36. message( FATAL_ERROR "Changing compilers requires a cmake reset\ne.g. rm -rf *; cmake .." )
  37. endif()
  38. endif ()
  39. #| Load the compiler family specific configurations
  40. include( ${COMPILER_FAMILY} )
  41. #| Binutils not set by CMake
  42. set( CMAKE_SIZE "${_CMAKE_TOOLCHAIN_PREFIX}size" )