|
1 | 1 | cmake_minimum_required(VERSION 3.17)
|
2 |
| -project(Portduino) |
| 2 | +project(Portduino VERSION 0.0.1 LANGUAGES C CXX) |
3 | 3 |
|
4 |
| -set(CMAKE_CXX_STANDARD 14) |
5 |
| - |
6 |
| -include_directories(cores/arduino/api) |
7 |
| -include_directories(cores/portduino) |
8 |
| -include_directories(cores/portduino/FS) |
9 |
| - |
10 |
| -add_executable(Portduino |
| 4 | +add_library( |
| 5 | + Portduino |
11 | 6 | cores/arduino/api/deprecated/Client.h
|
12 | 7 | cores/arduino/api/deprecated/HardwareSerial.h
|
13 | 8 | cores/arduino/api/deprecated/IPAddress.h
|
@@ -50,17 +45,103 @@ add_executable(Portduino
|
50 | 45 | cores/portduino/Arduino.h
|
51 | 46 | cores/portduino/itoa.cpp
|
52 | 47 | cores/portduino/dtostrf.c
|
53 |
| - cores/portduino/main.cpp |
54 | 48 | cores/portduino/linux/millis.cpp
|
55 | 49 | cores/portduino/simulated/SimCommon.cpp
|
56 | 50 | cores/portduino/Utility.cpp
|
57 | 51 | cores/portduino/Utility.h
|
58 | 52 | cores/portduino/simulated/SimHardwareSPI.cpp
|
59 |
| - example/test.cpp |
60 |
| - cores/portduino/simulated/SimHardwareI2C.cpp |
61 |
| - cores/portduino/simulated/SimHardwareI2C.h |
62 |
| - cores/portduino/linux/LinuxCommon.cpp |
63 |
| - cores/portduino/linux/LinuxSerial.cpp |
| 53 | + cores/portduino/simulated/SimHardwareI2C.cpp |
| 54 | + cores/portduino/simulated/SimHardwareI2C.h |
| 55 | + cores/portduino/linux/LinuxCommon.cpp |
| 56 | + cores/portduino/linux/LinuxSerial.cpp |
64 | 57 | cores/portduino/linux/LinuxSerial.h
|
65 | 58 | cores/portduino/linux/LinuxHardwareI2C.cpp
|
66 |
| - cores/portduino/linux/LinuxHardwareI2C.h) |
| 59 | + cores/portduino/linux/LinuxHardwareI2C.h) |
| 60 | +set_target_properties(Portduino PROPERTIES PUBLIC_HEADER |
| 61 | + cores/arduino/api/ArduinoAPI.h |
| 62 | + cores/arduino/api/Binary.h |
| 63 | + cores/arduino/api/Client.h |
| 64 | + cores/arduino/api/Common.h |
| 65 | + cores/arduino/api/Compat.h |
| 66 | + cores/arduino/api/HardwareI2C.h |
| 67 | + cores/arduino/api/HardwareSerial.h |
| 68 | + cores/arduino/api/HardwareSPI.h |
| 69 | + cores/arduino/api/Interrupts.h |
| 70 | + cores/arduino/api/IPAddress.h |
| 71 | + cores/arduino/api/itoa.h |
| 72 | + cores/arduino/api/PluggableUSB.h |
| 73 | + cores/arduino/api/Printable.h |
| 74 | + cores/arduino/api/RingBuffer.h |
| 75 | + cores/arduino/api/Server.h |
| 76 | + cores/arduino/api/Stream.h |
| 77 | + cores/arduino/api/String.h |
| 78 | + cores/arduino/api/Udp.h |
| 79 | + cores/arduino/api/USBAPI.h |
| 80 | + cores/arduino/api/WCharacter.h |
| 81 | + cores/portduino/Arduino.h |
| 82 | + cores/portduino/FS/FS.h |
| 83 | + cores/portduino/FS/FSImpl.h |
| 84 | + cores/portduino/FS/PortduinoFS.h |
| 85 | + cores/portduino/FS/vfs_api.h |
| 86 | + cores/portduino/linux/gpio/LinuxGPIOPin.h |
| 87 | + cores/portduino/linux/LinuxHardwareI2C.h |
| 88 | + cores/portduino/linux/LinuxSerial.h |
| 89 | + cores/portduino/linux/PosixFile.h |
| 90 | + cores/portduino/logging.h |
| 91 | + cores/portduino/PortduinoGPIO.h |
| 92 | + cores/portduino/simulated/SimHardwareI2C.h |
| 93 | + cores/portduino/SPIChip.h |
| 94 | + cores/portduino/Utility.h |
| 95 | + cores/portduino/WString.h |
| 96 | +) |
| 97 | +target_include_directories(Portduino |
| 98 | + SYSTEM PUBLIC |
| 99 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cores/arduino/api> |
| 100 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cores/portduino> |
| 101 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cores/portduino/FS> |
| 102 | + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
| 103 | +) |
| 104 | +add_library(Portduino::Portduino ALIAS Portduino) |
| 105 | + |
| 106 | +add_library(PortduinoMain |
| 107 | + cores/portduino/main.cpp |
| 108 | +) |
| 109 | +target_link_libraries(PortduinoMain PRIVATE Portduino) |
| 110 | +add_library(Portduino::PortduinoMain ALIAS PortduinoMain) |
| 111 | + |
| 112 | + |
| 113 | +install( |
| 114 | + TARGETS |
| 115 | + Portduino PortduinoMain |
| 116 | + EXPORT |
| 117 | + PortduinoTargets |
| 118 | + PUBLIC_HEADER |
| 119 | + CONFIGURATIONS Release |
| 120 | +) |
| 121 | + |
| 122 | +include(CMakePackageConfigHelpers) |
| 123 | + |
| 124 | +configure_package_config_file( |
| 125 | + "${PROJECT_SOURCE_DIR}/cmake/PortduinoConfig.cmake.in" |
| 126 | + "${PROJECT_BINARY_DIR}/PortduinoConfig.cmake" |
| 127 | + INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/Portduino/cmake" |
| 128 | +) |
| 129 | +write_basic_package_version_file( |
| 130 | + "${PROJECT_BINARY_DIR}/PortduinoConfigVersion.cmake" |
| 131 | + VERSION ${PROJECT_VERSION} |
| 132 | + COMPATIBILITY SameMajorVersion |
| 133 | +) |
| 134 | + |
| 135 | +install( |
| 136 | + EXPORT PortduinoTargets |
| 137 | + FILE PortduinoTargets.cmake |
| 138 | + NAMESPACE Portduino:: |
| 139 | + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/Portduino/cmake" |
| 140 | +) |
| 141 | + |
| 142 | +install( |
| 143 | + FILES |
| 144 | + "${PROJECT_BINARY_DIR}/PortduinoConfig.cmake" |
| 145 | + "${PROJECT_BINARY_DIR}/PortduinoConfigVersion.cmake" |
| 146 | + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/Portduino/cmake" |
| 147 | +) |
0 commit comments