Kiibohd Controller
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

setup.cmake 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ###| CMAKE Kiibohd Controller Source Configurator |###
  2. #
  3. # Written by Jacob Alexander in 2011-2013 for the Kiibohd Controller
  4. #
  5. # Released into the Public Domain
  6. #
  7. ###
  8. ###
  9. # Project Modules
  10. #
  11. #| Note: This is the only section you probably want to modify
  12. #| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
  13. #| All of the modules must be specified, as they generate the sources list of files to compile
  14. #| Any modifications to this file will cause a complete rebuild of the project
  15. #| Please the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones
  16. ##| Deals with acquiring the keypress information and turning it into a key index
  17. set( ScanModule "MBC-55X" )
  18. ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
  19. set( MacroModule "buffer" )
  20. ##| Sends the current list of usb key codes through USB HID
  21. set( USBModule "pjrc" )
  22. ##| Debugging source to use, each module has it's own set of defines that it sets
  23. set( DebugModule "full" )
  24. ###
  25. # Module Overrides (Used in the buildall.bash script)
  26. #
  27. if ( ( DEFINED ${ScanModuleOverride} ) AND ( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Scan/${ScanModuleOverride} ) )
  28. set( ScanModule ${ScanModuleOverride} )
  29. endif ( ( DEFINED ${ScanModuleOverride} ) AND ( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Scan/${ScanModuleOverride} ) )
  30. ###
  31. # Path Setup
  32. #
  33. set( ScanModulePath "Scan/${ScanModule}" )
  34. set( MacroModulePath "Macro/${MacroModule}" )
  35. set( USBModulePath "USB/${USBModule}" )
  36. set( DebugModulePath "Debug/${DebugModule}" )
  37. #| Top-level directory adjustment
  38. set( HEAD_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
  39. ###
  40. # Module Check Function
  41. #
  42. #| Usage:
  43. #| PathPrepend( ModulePath <ListOfFamiliesSupported> )
  44. #| Uses the ${COMPILER_FAMILY} variable
  45. function( ModuleCompatibility ModulePath )
  46. foreach( mod_var ${ARGN} )
  47. if ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
  48. # Module found, no need to scan further
  49. return()
  50. endif ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
  51. endforeach( mod_var ${ARGN} )
  52. message( FATAL_ERROR "${ModulePath} does not support the ${COMPILER_FAMILY} family..." )
  53. endfunction( ModuleCompatibility ModulePath )
  54. ###
  55. # Module Configuration
  56. #
  57. #| Additional options, usually define settings
  58. add_definitions()
  59. #| Include path for each of the modules
  60. add_definitions(
  61. -I${HEAD_DIR}/${ScanModulePath}
  62. -I${HEAD_DIR}/${MacroModulePath}
  63. -I${HEAD_DIR}/${USBModulePath}
  64. -I${HEAD_DIR}/${DebugModulePath}
  65. )
  66. ###
  67. # Module Processing
  68. #
  69. #| Go through lists of sources and append paths
  70. #| Usage:
  71. #| PathPrepend( OutputListOfSources <Prepend Path> <InputListOfSources> )
  72. macro( PathPrepend Output SourcesPath )
  73. unset( tmpSource )
  74. # Loop through items
  75. foreach( item ${ARGN} )
  76. # Set the path
  77. set( tmpSource ${tmpSource} "${SourcesPath}/${item}" )
  78. endforeach( item )
  79. # Finalize by writing the new list back over the old one
  80. set( ${Output} ${tmpSource} )
  81. endmacro( PathPrepend )
  82. #| Scan Module
  83. include ( "${ScanModulePath}/setup.cmake" )
  84. PathPrepend( SCAN_SRCS ${ScanModulePath} ${SCAN_SRCS} )
  85. #| Macro Module
  86. include ( "${MacroModulePath}/setup.cmake" )
  87. PathPrepend( MACRO_SRCS ${MacroModulePath} ${MACRO_SRCS} )
  88. #| USB Module
  89. include ( "${USBModulePath}/setup.cmake" )
  90. PathPrepend( USB_SRCS ${USBModulePath} ${USB_SRCS} )
  91. #| Debugging Module
  92. include ( "${DebugModulePath}/setup.cmake" )
  93. PathPrepend( DEBUG_SRCS ${DebugModulePath} ${DEBUG_SRCS} )
  94. #| Print list of all module sources
  95. message( STATUS "Detected Scan Module Source Files:" )
  96. message( "${SCAN_SRCS}" )
  97. message( STATUS "Detected Macro Module Source Files:" )
  98. message( "${MACRO_SRCS}" )
  99. message( STATUS "Detected USB Module Source Files:" )
  100. message( "${USB_SRCS}" )
  101. message( STATUS "Detected Debug Module Source Files:" )
  102. message( "${DEBUG_SRCS}" )