]> git.donarmstrong.com Git - kiibohd-controller.git/blob - LoadFile/CMakeLists.txt
Adding teensy-loader-cli so it's not required.
[kiibohd-controller.git] / LoadFile / CMakeLists.txt
1 ###| CMAKE teensy-loader-cli |###
2 #
3 # Jacob Alexander 2014
4 # Written to replace the pjrc's kludey Makefiles
5 #  (that require hand edits for different platforms)
6 #
7 # Released into the Public Domain
8 #
9 ###
10
11 #| Windows / Cygwin Compatibility options
12 set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
13 set( CMAKE_USE_RELATIVE_PATHS  1 )
14
15
16
17 ###
18 # Project Description
19 #
20
21 #| Project
22 project( teensy-loader-cli )
23
24 #| Target Name (output name)
25 set( TARGET teensy-loader-cli )
26
27 #| General Settings
28 cmake_minimum_required( VERSION 2.8 )
29
30
31
32 ###
33 # Source Defines
34 #
35
36 #| Sources
37 set( SRCS
38         teensy_loader_cli.c
39 )
40
41
42
43 ###
44 # Platform Setup
45 #
46 list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ) # Use local find scripts
47
48 #| Linux - libusb
49 if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
50         # Find libusb (not 1.0)
51         find_package( LibUSB REQUIRED )
52
53         # Defines
54         set( DEFINES -s -DUSE_LIBUSB )
55
56         # Include directories
57         set( INCLUDE_DIRS ${LIBUSB_INCLUDE_DIRS} )
58
59         # Libraries
60         set( LIBS ${LIBUSB_LIBRARIES} )
61
62 #| Windows
63 elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
64         message( AUTHOR_WARNING "Not Tested...")
65
66         # Defines
67         set( DEFINES -s -DUSE_WIN32 )
68
69         # Libraries
70         set( LIBS hid setupapi )
71
72 #| Mac OS X
73 elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
74         message( AUTHOR_WARNING "Not Tested...")
75
76         # Defines - XXX What is SDK?
77         set( DEFINES -DUSE_APPLE_IOKIT -isysroot ${SDK} -Wl,-syslibroot,${SDK} -framework IOKit -framework CoreFoundation )
78
79 #| BSD - NetBSD and OpenBSD
80 elseif( ${CMAKE_SYSTEM_NAME} MATCHES "BSD" )
81         message( AUTHOR_WARNING "Not Tested...")
82
83         # Defines
84         set( DEFINES -s -DUSE_UHID )
85 endif()
86
87
88
89 ###
90 # Defines
91 #
92
93 #| Default CFLAGS
94 set( CFLAGS -O2 -Wall )
95
96 add_definitions( ${CFLAGS} ${DEFINES} )
97
98
99
100 ###
101 # Includes
102 #
103
104 #| Linux
105 include_directories( ${INCLUDE_DIRS} )
106
107
108
109 ###
110 # Build Targets
111 #
112
113 #| Create the executable
114 add_executable( ${TARGET} ${SRCS} )
115
116 #| Link executable
117 target_link_libraries( ${TARGET} ${LIBS} )
118