]> git.donarmstrong.com Git - kiibohd-controller.git/blob - LoadFile/CMakeLists.txt
Merge pull request #71 from glguy/pr-cli-history
[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/Windows - libusb
49 if( CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "CYGWIN" )
50         # Find libusb (not 1.0)
51         find_package( LibUSB-1.0 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 #| Mac OS X
63 elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
64         message( AUTHOR_WARNING "Not Tested...")
65
66         # Defines - XXX What is SDK?
67         set( DEFINES -DUSE_APPLE_IOKIT -isysroot ${SDK} -Wl,-syslibroot,${SDK} -framework IOKit -framework CoreFoundation )
68
69 #| BSD - NetBSD and OpenBSD
70 elseif( CMAKE_SYSTEM_NAME MATCHES "BSD" )
71         message( AUTHOR_WARNING "Not Tested...")
72
73         # Defines
74         set( DEFINES -s -DUSE_UHID )
75 #| Unregonized OS
76 else()
77         message( FATAL_ERROR "${CMAKE_SYSTEM_NAME}: OS Not Recognized..." )
78 endif()
79
80
81
82 ###
83 # Defines
84 #
85
86 #| Default CFLAGS
87 set( CFLAGS -O2 -Wall -std=gnu99 )
88
89 add_definitions( ${CFLAGS} ${DEFINES} )
90
91
92
93 ###
94 # Includes
95 #
96
97 #| Linux
98 include_directories( ${INCLUDE_DIRS} )
99
100
101
102 ###
103 # Build Targets
104 #
105
106 #| Create the executable
107 add_executable( ${TARGET} ${SRCS} )
108
109 #| Link executable
110 target_link_libraries( ${TARGET} ${LIBS} )
111