]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - CMakeLists.txt
Fixing RAM calculator and reduced actual SRAM usage
[kiibohd-controller.git] / CMakeLists.txt
index 852610986586cf43300b2c297c9898b92e3512bb..e7e92d100a4041227e89ab6c6b1ccf60b4366575 100644 (file)
 #
 ###
 
-#| Windows / Cygwin Compatibility options
-set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
-set( CMAKE_USE_RELATIVE_PATHS  1 )
-
 
 
 ###
-# Compiler Family
+# Chip Selection
 #
 
-#| Specify the compiler family to use
-#| Currently only supports AVR and ARM
-#| "avr"       # Teensy   1.0
-#| "avr"       # Teensy   2.0
-#| "avr"       # Teensy++ 1.0
-#| "avr"       # Teensy++ 2.0
-#| "arm"       # Teensy   3.0
-#| "arm"       # Teensy   3.1
-#set( COMPILER_FAMILY "arm" )
-set( COMPILER_FAMILY "avr" )
-
-message( STATUS "Compiler Family:" )
-message( "${COMPILER_FAMILY}" )
-
-
-
-#| Load the compiler family specific configurations
-include( ${COMPILER_FAMILY}.cmake )
+#| You _MUST_ set this to match the microcontroller you are trying to compile for
+#| You _MUST_ clean the build directory if you change this value
+#|
+set( CHIP
+#      "at90usb162"       # Teensy   1.0 (avr)
+#      "atmega32u4"       # Teensy   2.0 (avr)
+#      "at90usb646"       # Teensy++ 1.0 (avr)
+#      "at90usb1286"      # Teensy++ 2.0 (avr)
+#      "mk20dx128"        # Teensy   3.0 (arm)
+       "mk20dx128vlf5"    # McHCK    mk20dx128vlf5
+#      "mk20dx256"        # Teensy   3.1 (arm)
+)
 
 
 
 ###
-# Project Description
+# Compiler Intialization
 #
-
-#| Project
-project( kiibohd_controller )
-
-#| Target Name (output name)
-set( TARGET kiibohd )
-
-#| General Settings
-cmake_minimum_required( VERSION 2.8 )
+set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/Lib/CMake )
+include( initialize )
 
 
 
 ###
-# Source Defines
+# Project Modules
 #
 
-#| Sources (see setup.h for configuring in/away code blocks or other complete modules)
-#| XXX Not set here in this project, see setup.cmake
-#set( SRCS ./main.c )
+#| Note: This is the only section you probably want to modify
+#| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
+#| All of the modules must be specified, as they generate the sources list of files to compile
+#| Any modifications to this file will cause a complete rebuild of the project
 
-#| Instead, include the module source selector
-include( setup.cmake )
-set( SRCS
-       main.c
-       ${COMPILER_SRCS}
-       ${SCAN_SRCS}
-       ${MACRO_SRCS}
-       ${OUTPUT_SRCS}
-       ${DEBUG_SRCS}
-)
+#| Please look at the {Scan,Macro,Output,Debug} for information on the modules and how to create new ones
 
-#| Directories to include by default
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
+##| Deals with acquiring the keypress information and turning it into a key index
+set(   ScanModule "MD1" )
 
+##| Provides the mapping functions for DefaultMap and handles any macro processing before sending to the OutputModule
+set(  MacroModule "PartialMap" )
 
+##| Sends the current list of usb key codes through USB HID
+set( OutputModule "pjrcUSB" )
 
-###
-# Module Compatibility Check
-#
-
-#| Check for whether the set modules are compatible with the specified compiler family
-ModuleCompatibility( ${ScanModulePath}   ${ScanModuleCompatibility}   )
-ModuleCompatibility( ${MacroModulePath}  ${MacroModuleCompatibility}  )
-ModuleCompatibility( ${OutputModulePath} ${OutputModuleCompatibility} )
-ModuleCompatibility( ${DebugModulePath}  ${DebugModuleCompatibility}  )
+##| Debugging source to use, each module has it's own set of defines that it sets
+set(  DebugModule "full" )
 
 
 
 ###
-# CMake Module Checking
+# Keymap Configuration (XXX - Not worky yet, currently ignored)
 #
-find_package( Git REQUIRED )
 
+##| If there are multiple DefaultMaps, it is defined here. If, the specified DefaultMap is not found, defaultMap.h is used.
+set(   DefaultMap "kishsaver" )
 
-###
-# Build Targets
-#
+##| PartialMap combined keymap layering. The first keymap has the "least" precedence.
+set(  CombinedMap colemak capslock2ctrl )
 
-#| Create the .ELF file
-set( TARGET_ELF ${TARGET}.elf )
-add_executable( ${TARGET_ELF} ${SRCS} )
+##| ParitalMaps available on top of the CombinedMap. If there are input conflicts, the last PartialMap takes precedence.
+set(  PartialMaps hhkbnav kbdctrl )
 
-
-#| .ELF Properties
-set_target_properties( ${TARGET_ELF} PROPERTIES
-       LINK_FLAGS ${LINKER_FLAGS}
-       SUFFIX ""                               # XXX Force Windows to keep the .exe off
-)
-
-
-#| Convert the .ELF into a .HEX to load onto the Teensy
-set( TARGET_HEX ${TARGET}.hex )
-add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
-       COMMAND ${OBJCOPY} ${HEX_FLAGS} ${TARGET_ELF} ${TARGET_HEX}
-       COMMENT "Creating load file for Flash:  ${TARGET_HEX}"
-)
+##| MacroSets define extra capabilities that are not provided by the Scan or Output modules. Last MacroSet takes precedence.
+set(    MacroSets retype )
 
 
-#| Generate the Extended .LSS
-set( TARGET_LSS ${TARGET}.lss )
-add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
-       COMMAND ${OBJDUMP} ${LSS_FLAGS} ${TARGET_ELF} > ${TARGET_LSS}
-       COMMENT "Creating Extended Listing:     ${TARGET_LSS}"
-)
 
-
-#| Generate the Symbol Table .SYM
-set( TARGET_SYM ${TARGET}.sym )
-add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
-       COMMAND ${NM} -n ${TARGET_ELF} > ${TARGET_SYM}
-       COMMENT "Creating Symbol Table:         ${TARGET_SYM}"
+###
+# Source Defines (in addition to the selected Modules)
+#
+set( MAIN_SRCS
+       main.c
 )
 
 
 
 ###
-# Size Information
+# Project Description
 #
 
-#| After Changes Size Information
-#| TODO Do lookup on Flash and RAM sizes and do % used
-add_custom_target( SizeAfter ALL ${SIZE} --target=${FORMAT} ${TARGET_HEX} ${TARGET_ELF}
-       DEPENDS ${TARGET_ELF}
-       COMMENT "Size after generation\n\tFlash Usage: data (hex)\n\t  RAM Usage: data (elf)"
-)
+#| Project
+project( kiibohd_controller )
 
+#| Target Name (output name)
+set( TARGET kiibohd )
 
+#| General Settings
+cmake_minimum_required( VERSION 2.8 )
 
-###
-# Setup Loader Script
-#
 
-#| Provides the user with the correct teensy-loader-cli command for the built .HEX file
-#| teensy-loader-cli must be in the user's path
-if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
-       configure_file( LoadFile/bash load )
-endif()
 
-#| TODO Windows
-if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
-       configure_file( LoadFile/bash load )
-endif()
+###
+# Module Initialization / Compilation / Targets
+#
+include( Lib/CMake/modules.cmake )