Kiibohd Controller
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

CMakeLists.txt 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ###| CMAKE Kiibohd Controller |###
  2. #
  3. # Jacob Alexander 2011-2013
  4. # Due to this file's usefulness:
  5. #
  6. # Released into the Public Domain
  7. #
  8. ###
  9. #| Windows / Cygwin Compatibility options
  10. set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
  11. set( CMAKE_USE_RELATIVE_PATHS 1 )
  12. #| Add Dependency Macro
  13. include( AddFileDependencies )
  14. ###
  15. # Compiler Family
  16. #
  17. #| Specify the compiler family to use
  18. #| Currently only supports AVR and ARM
  19. #| "avr" # Teensy 1.0
  20. #| "avr" # Teensy 2.0
  21. #| "avr" # Teensy++ 1.0
  22. #| "avr" # Teensy++ 2.0
  23. #| "arm" # Teensy 3.0
  24. #set( COMPILER_FAMILY "arm" )
  25. set( COMPILER_FAMILY "avr" )
  26. message( STATUS "Compiler Family:" )
  27. message( "${COMPILER_FAMILY}" )
  28. #| Load the compiler family specific configurations
  29. include( ${COMPILER_FAMILY}.cmake )
  30. ###
  31. # Project Description
  32. #
  33. #| Project
  34. project( kiibohd_controller )
  35. #| Target Name (output name)
  36. set( TARGET kiibohd )
  37. #| General Settings
  38. cmake_minimum_required( VERSION 2.8 )
  39. ###
  40. # Source Defines
  41. #
  42. #| Sources (see setup.h for configuring in/away code blocks or other complete modules)
  43. #| XXX Not set here in this project, see setup.cmake
  44. #set( SRCS ./main.c )
  45. #| Instead, include the module source selector
  46. include( setup.cmake )
  47. set( SRCS
  48. main.c
  49. ${COMPILER_SRCS}
  50. ${SCAN_SRCS}
  51. ${MACRO_SRCS}
  52. ${USB_SRCS}
  53. ${DEBUG_SRCS}
  54. )
  55. ###
  56. # Build Targets
  57. #
  58. #| Create the .ELF file
  59. set( TARGET_ELF ${TARGET}.elf )
  60. add_executable( ${TARGET_ELF} ${SRCS} )
  61. #| .ELF Properties
  62. set_target_properties( ${TARGET_ELF} PROPERTIES
  63. LINK_FLAGS ${LINKER_FLAGS}
  64. SUFFIX "" # XXX Force Windows to keep the .exe off
  65. )
  66. #| Convert the .ELF into a .HEX to load onto the Teensy
  67. set( TARGET_HEX ${TARGET}.hex )
  68. add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
  69. COMMAND ${OBJCOPY} ${HEX_FLAGS} ${TARGET_ELF} ${TARGET_HEX}
  70. COMMENT "Creating load file for Flash: ${TARGET_HEX}"
  71. )
  72. #| Generate the Extended .LSS
  73. set( TARGET_LSS ${TARGET}.lss )
  74. add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
  75. COMMAND ${OBJDUMP} ${LSS_FLAGS} ${TARGET_ELF} > ${TARGET_LSS}
  76. COMMENT "Creating Extended Listing: ${TARGET_LSS}"
  77. )
  78. #| Generate the Symbol Table .SYM
  79. set( TARGET_SYM ${TARGET}.sym )
  80. add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
  81. COMMAND ${NM} -n ${TARGET_ELF} > ${TARGET_SYM}
  82. COMMENT "Creating Symbol Table: ${TARGET_SYM}"
  83. )
  84. ###
  85. # Size Information
  86. #
  87. #| After Changes Size Information
  88. add_custom_target( SizeAfter ALL ${SIZE} --target=${FORMAT} ${TARGET_HEX} ${TARGET_ELF}
  89. DEPENDS ${TARGET_ELF}
  90. COMMENT "Size after generation:"
  91. )
  92. ###
  93. # Setup Loader Script
  94. #
  95. #| Provides the user with the correct teensy-loader-cli command for the built .HEX file
  96. #| teensy-loader-cli must be in the user's path
  97. if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
  98. configure_file( LoadFile/bash load )
  99. endif( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
  100. #| TODO Windows
  101. if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
  102. configure_file( LoadFile/bash load )
  103. endif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )