forked from paceholder/nodeeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
164 lines (142 loc) · 5.04 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
cmake_minimum_required( VERSION 3.15 )
project( NodeEditor VERSION 1.0.0 LANGUAGES CXX )
# I don't know why these can't be set as target properties of NodeEditor, but it doesn't invoke automoc
set( CMAKE_AUTOMOC ON )
set( CMAKE_AUTORCC ON )
add_library( NodeEditor
# Headers listed for automoc
include/nodes/internal/Connection.hpp
include/nodes/internal/ConnectionGeometry.hpp
include/nodes/internal/ConnectionGraphicsObject.hpp
include/nodes/internal/ConnectionState.hpp
include/nodes/internal/ConnectionStyle.hpp
include/nodes/internal/DataModelRegistry.hpp
include/nodes/internal/FlowScene.hpp
include/nodes/internal/FlowView.hpp
include/nodes/internal/FlowViewStyle.hpp
include/nodes/internal/memory.hpp
include/nodes/internal/Node.hpp
include/nodes/internal/NodeData.hpp
include/nodes/internal/NodeDataModel.hpp
include/nodes/internal/NodeGeometry.hpp
include/nodes/internal/NodeGraphicsObject.hpp
include/nodes/internal/NodePainterDelegate.hpp
include/nodes/internal/NodeState.hpp
include/nodes/internal/NodeStyle.hpp
include/nodes/internal/PortType.hpp
include/nodes/internal/QStringStdHash.hpp
include/nodes/internal/QUuidStdHash.hpp
include/nodes/internal/Serializable.hpp
include/nodes/internal/Style.hpp
include/nodes/internal/StyleCollection.hpp
include/nodes/internal/TypeConverter.hpp
src/Connection.cpp
src/ConnectionBlurEffect.cpp
src/ConnectionGeometry.cpp
src/ConnectionGraphicsObject.cpp
src/ConnectionPainter.cpp
src/ConnectionState.cpp
src/ConnectionStyle.cpp
src/DataModelRegistry.cpp
src/FlowScene.cpp
src/FlowView.cpp
src/FlowViewStyle.cpp
src/Node.cpp
src/NodeConnectionInteraction.cpp
src/NodeDataModel.cpp
src/NodeGeometry.cpp
src/NodeGraphicsObject.cpp
src/NodePainter.cpp
src/NodeState.cpp
src/NodeStyle.cpp
src/Properties.cpp
src/StyleCollection.cpp
resources/NodeEditor.qrc
)
add_library( NodeEditor::NodeEditor ALIAS NodeEditor )
target_compile_features( NodeEditor PUBLIC cxx_std_17 )
set_target_properties( NodeEditor PROPERTIES
CXX_EXTENSIONS OFF
DEBUG_POSTFIX d
)
# Set includes
target_include_directories( NodeEditor
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/nodes/internal>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/nodes/internal>
)
#==================================================================================================
# Link Libraries
#==================================================================================================
find_package( Qt5 5.3 COMPONENTS
Core
Widgets
Gui
OpenGL
Concurrent
)
target_link_libraries( NodeEditor PUBLIC
Qt5::Core
Qt5::Widgets
Qt5::Gui
Qt5::OpenGL
Qt5::Concurrent
)
#==================================================================================================
# Installation
#==================================================================================================
include( GNUInstallDirs )
set( INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/NodeEditor )
# Copy include folder into install folder
install( DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
# Create export target, but don't install yet
install(
TARGETS NodeEditor
EXPORT NodeEditorTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Export the target to a script
install(
EXPORT NodeEditorTargets
FILE NodeEditorTargets.cmake
NAMESPACE NodeEditor::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NodeEditor
)
# Create a ConfigVersion.cmake file
include( CMakePackageConfigHelpers )
write_basic_package_version_file(
NodeEditorConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
# Generate Config file
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/NodeEditorConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/NodeEditorConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NodeEditor
)
# Install the config and configversion
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/NodeEditorConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/NodeEditorConfigVersion.cmake
DESTINATION
${INSTALL_CONFIGDIR}
)
#==================================================================================================
# Export from the build tree
#==================================================================================================
export( EXPORT NodeEditorTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/NodeEditorTargets.cmake"
NAMESPACE NodeEditor::
)
# Register package in the User Package Registry
set( CMAKE_EXPORT_PACKAGE_REGISTRY True )
export( PACKAGE NodeEditor )