]> git.donarmstrong.com Git - kiibohd-controller.git/blob - setup.cmake
Reorganization for use with the CMake "Modules"
[kiibohd-controller.git] / setup.cmake
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
10
11 ###
12 # Project Modules
13 #
14
15 #| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
16 #| All of the modules must be specified, as they generate the sources list of files to compile
17 #| Any modifications to this file will cause a complete rebuild of the project
18
19 #| Please the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones
20
21 ##| Deals with acquiring the keypress information and turning it into a key index
22 set(  ScanModule  "matrix" )
23
24 ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
25 set( MacroModule  "basic"  )
26
27 ##| Sends the current list of usb key codes through USB HID
28 set(   USBModule  "pjrc"   )
29
30 ##| Debugging source to use, each module has it's own set of defines that it sets
31 set( DebugModule  "basic"  )
32
33
34
35 ###
36 # Path Setup
37
38 set(  ScanModulePath  "Scan/${ScanModule}"  )
39 set( MacroModulePath "Macro/${MacroModule}" )
40 set(   USBModulePath   "USB/${USBModule}"   )
41 set( DebugModulePath "Debug/${DebugModule}" )
42
43
44
45
46 ###
47 # Module Configuration
48 #
49
50 #| Additional options, usually define settings
51 add_definitions()
52
53 #| Include path for each of the modules TODO Fixme!! (../)
54 add_definitions("
55         -I../${ScanModulePath}
56         -I../${MacroModulePath}
57         -I../${USBModulePath}
58         -I../${DebugModulePath}
59 ")
60
61
62
63 ###
64 # Module Processing
65 #
66
67 #| Go through lists of sources and append paths
68 #| Usage:
69 #|  PathPrepend( OutputListOfSources <Prepend Path> <InputListOfSources> )
70 macro( PathPrepend Output SourcesPath )
71         unset( tmpSource )
72
73         # Loop through items
74         foreach( item ${ARGN} )
75                 set( tmpSource ${tmpSource} "${SourcesPath}/${item}" )
76         endforeach( item )
77
78         # Finalize by writing the new list back over the old one
79         set( ${Output} ${tmpSource} )
80 endmacro( PathPrepend )
81
82
83 #| Scan Module
84 include(  "${ScanModulePath}/setup.cmake" )
85 PathPrepend( SCAN_SRCS ${ScanModulePath} ${SCAN_SRCS} )
86
87 #| Macro Module
88 include( "${MacroModulePath}/setup.cmake" )
89 PathPrepend( MACRO_SRCS ${MacroModulePath} ${MACRO_SRCS} )
90
91 #| USB Module
92 include(   "${USBModulePath}/setup.cmake" )
93 PathPrepend( USB_SRCS ${USBModulePath} ${USB_SRCS} )
94
95 #| Debugging Module
96 include( "${DebugModulePath}/setup.cmake" )
97 PathPrepend( DEBUG_SRCS ${DebugModulePath} ${DEBUG_SRCS} )
98
99
100 #| Print list of all module sources
101 message( STATUS "Detected Scan Module Source Files:
102 ${SCAN_SRCS}")
103 message( STATUS "Detected Macro Module Source Files:
104 ${MACRO_SRCS}")
105 message( STATUS "Detected USB Module Source Files:
106 ${USB_SRCS}")
107 message( STATUS "Detected Debug Module Source Files:
108 ${DEBUG_SRCS}")
109