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.

setup.cmake 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. ###| CMAKE Kiibohd Controller Source Configurator |###
  2. #
  3. # Written by Jacob Alexander in 2011 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 "matrix" )
  18. ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
  19. set( MacroModule "basic" )
  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. # Path Setup
  26. #
  27. set( ScanModulePath "Scan/${ScanModule}" )
  28. set( MacroModulePath "Macro/${MacroModule}" )
  29. set( USBModulePath "USB/${USBModule}" )
  30. set( DebugModulePath "Debug/${DebugModule}" )
  31. #| Top-level directory adjustment
  32. set( HEAD_DIR "${PROJECT_SOURCE_DIR}" )
  33. ###
  34. # Module Configuration
  35. #
  36. #| Additional options, usually define settings
  37. add_definitions()
  38. #| Include path for each of the modules
  39. add_definitions(
  40. -I${HEAD_DIR}/${ScanModulePath}
  41. -I${HEAD_DIR}/${MacroModulePath}
  42. -I${HEAD_DIR}/${USBModulePath}
  43. -I${HEAD_DIR}/${DebugModulePath}
  44. )
  45. ###
  46. # Module Processing
  47. #
  48. #| Go through lists of sources and append paths
  49. #| Usage:
  50. #| PathPrepend( OutputListOfSources <Prepend Path> <InputListOfSources> )
  51. macro( PathPrepend Output SourcesPath )
  52. unset( tmpSource )
  53. # Loop through items
  54. foreach( item ${ARGN} )
  55. set( tmpSource ${tmpSource} "${SourcesPath}/${item}" )
  56. endforeach( item )
  57. # Finalize by writing the new list back over the old one
  58. set( ${Output} ${tmpSource} )
  59. endmacro( PathPrepend )
  60. #| Scan Module
  61. include ( "${ScanModulePath}/setup.cmake" )
  62. PathPrepend( SCAN_SRCS ${ScanModulePath} ${SCAN_SRCS} )
  63. #| Macro Module
  64. include ( "${MacroModulePath}/setup.cmake" )
  65. PathPrepend( MACRO_SRCS ${MacroModulePath} ${MACRO_SRCS} )
  66. #| USB Module
  67. include ( "${USBModulePath}/setup.cmake" )
  68. PathPrepend( USB_SRCS ${USBModulePath} ${USB_SRCS} )
  69. #| Debugging Module
  70. include ( "${DebugModulePath}/setup.cmake" )
  71. PathPrepend( DEBUG_SRCS ${DebugModulePath} ${DEBUG_SRCS} )
  72. #| Print list of all module sources
  73. message( STATUS "Detected Scan Module Source Files: \n${SCAN_SRCS}")
  74. message( STATUS "Detected Macro Module Source Files:\n${MACRO_SRCS}")
  75. message( STATUS "Detected USB Module Source Files: \n${USB_SRCS}")
  76. message( STATUS "Detected Debug Module Source Files:\n${DEBUG_SRCS}")