forked from WEARTHaptics/WEART-SDK-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (78 loc) · 3.74 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.5)
project(WeArtGloveLib
LANGUAGES CXX C
VERSION 1.0.0.0)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros.
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Export symbols when on windows for making a SHARED lib
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
# Build position independent code.(PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# List of CPP (source) library files.
set(${PROJECT_NAME}_SRC
MiddlewareStatusListener.cpp
WeArtClient.cpp
WeArtEffect.cpp
WeArtHapticObject.cpp
WeArtMessages.cpp
WeArtMessageSerializer.cpp
WeArtAnalogSensorData.cpp
WeArtThimbleTrackingObject.cpp
WeArtTrackingCalibration.cpp
WeArtTrackingRawData.cpp
)
# Shared/Dynamic or Static library?
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
# List of HPP (header) library files.
set(${PROJECT_NAME}_HDR
MiddlewareStatusListener.h
WeArtClient.h
WeArtCommon.h
WeArtController.h
WeArtEffect.h
WeArtForce.h
WeArtHapticObject.h
WeArtMessageListener.h
WeArtMessages.h
WeArtMessageSerializer.h
WeArtAnalogSensorData.h
WeArtTemperature.h
WeArtTexture.h
WeArtThimbleTrackingObject.h
WeArtTrackingCalibration.h
WeArtTrackingRawData.h
nlohmann/json.hpp
)
# Add SHARED library with source *.cpp in src directory
add_library(${PROJECT_NAME} ${${PROJECT_NAME}_SRC} ${${PROJECT_NAME}_HDR})
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION}
PUBLIC_HEADER "${${PROJECT_NAME}_HDR}")
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE TRUE
)
target_link_libraries(${PROJECT_NAME} windowsapp.lib runtimeobject.lib)
target_compile_definitions(${PROJECT_NAME} PRIVATE WEART_CMAKE_COMPILATION)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>")
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}" COMPONENT dev)
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME}
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
VARS_PREFIX ${PROJECT_NAME}
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# Add the uninstall target
include(AddUninstallTarget)