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