-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
52 lines (44 loc) · 1.61 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cmake_minimum_required(VERSION 3.11.4)
project(Maestro)
option(PYTHON_BINDING "Set when you want to build PYTHON_BINDING (Python bindings for the library)" ON)
if(WIN32 OR APPLE)
include(FetchContent)
FetchContent_Declare(
libusb
GIT_REPOSITORY https://github.com/libusb/libusb.git
GIT_TAG v1.0.23
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/external/libusb/CMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt
)
FetchContent_GetProperties(libusb)
if(NOT libusb_POPULATED)
FetchContent_Populate(libusb)
add_subdirectory(${libusb_SOURCE_DIR} ${libusb_BINARY_DIR})
endif()
else()
include(FindPkgConfig)
pkg_search_module(LIBUSB REQUIRED libusb-1.0)
include_directories(${LIBUSB_INCLUDE_DIRS})
endif()
# Extract version information from git
find_package(Git REQUIRED)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MAESTRO_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "VERSION: ${MAESTRO_VERSION}")
add_subdirectory(src)
add_subdirectory(firmwares)
if(PYTHON_BINDING)
add_subdirectory(python)
endif()
# Package builder
set(CPACK_PACKAGE_NAME "Maestro")
set(CPACK_PACKAGE_VENDOR "https://github.com/papabricole/Pololu-Maestro")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A cross-platform C++ library for controlling Pololu Maestro devices")
set(CPACK_PACKAGE_VERSION ${MAESTRO_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
include(CPack)