-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
155 lines (136 loc) · 4.36 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
cmake_minimum_required(VERSION 3.16)
project( QwtPlot3D
VERSION 0.3.0
LANGUAGES CXX
)
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED TRUE )
set( CMAKE_CXX_EXTENSIONS OFF )
set( CMAKE_AUTOUIC OFF )
set( CMAKE_AUTORCC OFF )
set( CMAKE_AUTOMOC ON )
if( MSVC )
# /wd4458 Silent "declaration of %1 hides %2 ..."
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4 /permissive- /wd4458" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nonportable-include-path" )
add_compile_definitions( _CRT_SECURE_NO_WARNINGS )
else()
add_compile_options( "/MP" )
endif()
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -Wall -Wextra -pedantic" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic" )
endif()
if( APPLE )
add_compile_definitions( GL_SILENCE_DEPRECATION )
endif()
find_package(Qt6 COMPONENTS Core Gui OpenGLWidgets QUIET )
if( Qt6_FOUND )
set( QT_VERSION_MAJOR 6 )
else()
find_package(Qt5 COMPONENTS Core Gui OpenGL REQUIRED )
set( QT_VERSION_MAJOR 5 )
endif()
find_package( OpenGL COMPONENTS OpenGL REQUIRED )
find_library( GL2PS_LIBRARY NAMES gl2ps )
if( GL2PS_LIBRARY )
find_path ( GL2PS_INCLUDE_DIR NAMES gl2ps.h REQUIRED )
message( STATUS "Found GL2PS: ${GL2PS_LIBRARY}, with include: ${GL2PS_INCLUDE_DIR}" )
endif()
set( SRCS
"src/qwt3d_axis.cpp"
"src/qwt3d_color.cpp"
"src/qwt3d_coordsys.cpp"
"src/qwt3d_drawable.cpp"
"src/qwt3d_mousekeyboard.cpp"
"src/qwt3d_movements.cpp"
"src/qwt3d_lighting.cpp"
"src/qwt3d_colorlegend.cpp"
"src/qwt3d_plot.cpp"
"src/qwt3d_label.cpp"
"src/qwt3d_types.cpp"
"src/qwt3d_enrichment_std.cpp"
"src/qwt3d_autoscaler.cpp"
"src/qwt3d_io_reader.cpp"
"src/qwt3d_io.cpp"
"src/qwt3d_scale.cpp"
"src/qwt3d_gridmapping.cpp"
"src/qwt3d_parametricsurface.cpp"
"src/qwt3d_function.cpp"
"src/qwt3d_surfaceplot.cpp"
"src/qwt3d_gridplot.cpp"
"src/qwt3d_meshplot.cpp"
"src/qwt3d_io_gl2ps.cpp"
)
set( HEADERS
"include/qwt3d_color.h"
"include/qwt3d_global.h"
"include/qwt3d_types.h"
"include/qwt3d_axis.h"
"include/qwt3d_coordsys.h"
"include/qwt3d_drawable.h"
"include/qwt3d_helper.h"
"include/qwt3d_label.h"
"include/qwt3d_openglhelper.h"
"include/qwt3d_colorlegend.h"
"include/qwt3d_plot.h"
"include/qwt3d_enrichment.h"
"include/qwt3d_enrichment_std.h"
"include/qwt3d_autoscaler.h"
"include/qwt3d_autoptr.h"
"include/qwt3d_io.h"
"include/qwt3d_io_reader.h"
"include/qwt3d_scale.h"
"include/qwt3d_portability.h"
"include/qwt3d_mapping.h"
"include/qwt3d_gridmapping.h"
"include/qwt3d_parametricsurface.h"
"include/qwt3d_function.h"
"include/qwt3d_surfaceplot.h"
"include/qwt3d_volumeplot.h"
"include/qwt3d_graphplot.h"
"include/qwt3d_multiplot.h"
"include/qwt3d_io_gl2ps.h"
)
configure_file( "include/qwt3d_version.h.in" "qwt3d_version.h" @ONLY )
add_library( qwtplot3d ${SRCS} ${HEADERS} )
target_link_libraries( qwtplot3d
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
OpenGL::GLU
)
if( QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6 )
target_link_libraries( qwtplot3d Qt${QT_VERSION_MAJOR}::OpenGLWidgets )
else()
target_link_libraries( qwtplot3d Qt${QT_VERSION_MAJOR}::OpenGL )
endif()
target_include_directories( qwtplot3d PUBLIC include ${CMAKE_CURRENT_BINARY_DIR} )
if( NOT GL2PS_LIBRARY )
enable_language( C )
target_sources( qwtplot3d PRIVATE "3rdparty/gl2ps/gl2ps.c" "3rdparty/gl2ps/gl2ps.h" )
target_include_directories( qwtplot3d PRIVATE "3rdparty/gl2ps" )
else()
target_link_libraries( qwtplot3d ${GL2PS_LIBRARY} )
target_include_directories( qwtplot3d PRIVATE ${GL2PS_INCLUDE_DIR} )
endif()
if( WIN32 AND BUILD_SHARED_LIBS )
target_compile_definitions( qwtplot3d PRIVATE QWT3D_DLL QWT3D_MAKEDLL )
endif()
if( ${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
add_subdirectory( examples )
endif()
# Don't install qwtplot3d static library and headers if it is built as a subproject
if( "${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}" )
install( TARGETS qwtplot3d
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qwtplot3d
)
elseif( BUILD_SHARED_LIBS )
install( TARGETS qwtplot3d
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()