-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
69 lines (62 loc) · 2.24 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
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.1.0)
project(PothosWidgets CXX)
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
find_package(Pothos "0.4.0" CONFIG REQUIRED)
else()
find_package(Pothos CONFIG REQUIRED) #in-tree build
endif()
#args to set the CMAKE_PREFIX_PATH environment variable
if (CMAKE_PREFIX_PATH)
set(ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
endif (CMAKE_PREFIX_PATH)
########################################################################
# Qt devel setup
########################################################################
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Concurrent)
message(STATUS "QT_VERSION_MAJOR=${QT_VERSION_MAJOR}")
set(CMAKE_AUTOMOC ON)
########################################################################
## Feature registration
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_WIDGETS "Enable Pothos Widgets component" ON "Pothos_FOUND;Qt${QT_VERSION_MAJOR}_FOUND" OFF)
add_feature_info(Widgets ENABLE_WIDGETS "Graphical control widgets for the GUI")
if (NOT ENABLE_WIDGETS)
return()
endif()
########################################################################
# Build control widgets module
########################################################################
set(SOURCES
QStringSupport.cpp
Slider.cpp
NumericEntry.cpp
TextDisplay.cpp
DropDown.cpp
RadioGroup.cpp
PlanarSelect.cpp
ChatBox.cpp
PushButton.cpp
MyDoubleSlider.cpp
Odometer.cpp
indicator.cpp
TextEntry.cpp
ColoredBox.cpp
)
POTHOS_MODULE_UTIL(
TARGET ControlWidgets
SOURCES ${SOURCES}
LIBRARIES Qt${QT_VERSION_MAJOR}::Widgets
DESTINATION widgets
ENABLE_DOCS
)
#Qt 5.11 introduced QFontMetrics::horizontalAdvance() to replace width
#this simple define keeps slightly older versions of Qt compiling for now
if ("${Qt${QT_VERSION_MAJOR}_VERSION}" VERSION_LESS "5.11")
target_compile_definitions(ControlWidgets PRIVATE -DhorizontalAdvance=width)
endif()