summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorAmir Hammad <amirhammad@users.noreply.github.com>2016-09-11 13:40:59 +0200
committerGitHub <noreply@github.com>2016-09-11 13:40:59 +0200
commit5e714edfa65f2f0d18fe9dc722ccd564a04e152a (patch)
tree5e310e07bdfb28e36d663ccdffbe65f78081187e /src/CMakeLists.txt
parent5615b9c938f6e4d05f7fae68b5329346df1238f9 (diff)
parentb7167bf2aff1a7c9cf223dc2a1d2e401f599d5d8 (diff)
downloadsecure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.tar.gz
secure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.tar.bz2
secure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.zip
Merge pull request #4 from amirhammad/core-refactor
Major rework
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..f8478f6
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,61 @@
+if (USE_USART_DEBUG)
+ set (USART_HELPERS
+ usart_helpers.c
+ tinyprintf.c
+ )
+else (USE_USART_DEBUG)
+ set (USART_HELPERS "")
+endif (USE_USART_DEBUG)
+
+set (inc ${CMAKE_SOURCE_DIR}/include)
+
+add_library (usbhost
+ ${USART_HELPERS}
+ ${inc}/usbh_core.h
+ ${inc}/usbh_driver_ac_midi.h
+ ${inc}/usbh_driver_gp_xbox.h
+ ${inc}/usbh_driver_hid.h
+ ${inc}/usbh_driver_hub.h
+ ${inc}/usbh_lld_stm32f4.h
+ ${inc}/driver/usbh_device_driver.h
+
+ usbh_core.c
+ usbh_driver_ac_midi.c
+ usbh_driver_ac_midi_private.h
+ usbh_driver_gp_xbox.c
+ usbh_driver_hid.c
+ usbh_driver_hub.c
+ usbh_driver_hub_private.h
+ usbh_lld_stm32f4.c
+)
+
+target_link_libraries (usbhost
+ ${LIBOPENCM3_LIB}
+)
+
+add_executable (demo
+ demo.c
+)
+
+target_link_libraries (demo
+ usbhost
+)
+
+add_custom_command (TARGET demo
+ POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:demo> ${CMAKE_BINARY_DIR}/demo.hex
+ COMMENT "Generating output files: ${CMAKE_BINARY_DIR}/demo.hex"
+)
+
+add_custom_command (TARGET demo
+ POST_BUILD
+ COMMAND ${CMAKE_SIZE} $<TARGET_FILE:demo>
+ COMMENT "Calculating size of the binary"
+)
+
+add_custom_command (TARGET usbhost
+ POST_BUILD
+ COMMENT "Calculating size of the library"
+ COMMAND ${CMAKE_SIZE} $<TARGET_FILE:usbhost>
+)
+