forked from thomaslepoix/Qucs-RFlayout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
233 lines (201 loc) · 6.82 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#########################################################################PROJECT
cmake_minimum_required( VERSION 3.12 )
project( qucsrflayout
LANGUAGES CXX
VERSION 2.0.1
DESCRIPTION "A tool to produce layout from qucs RF schematics (microstrip only for now)"
# HOMEPAGE_URL "https://github.com/thomaslepoix/Qucs-RFlayout"
)
set( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake"
)
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE "Release" )
endif( NOT CMAKE_BUILD_TYPE )
message( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
include( FixedShell )
if( ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux" )
set( HOST_LINUX TRUE )
endif( ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux" )
if( MINGW AND HOST_LINUX )
find_program( PELDD NAMES peldd )
if( PELDD )
message( STATUS "Found peldd: ${PELDD}" )
else( PELDD )
message( ERROR "Not found peldd: Please install https://github.com/gsauthof/pe-util" )
endif( PELDD )
endif( MINGW AND HOST_LINUX )
if( STATIC MATCHES TRUE )
find_program( CMAKE_CXX_CPPCHECK NAMES cppcheck )
list( APPEND CMAKE_CXX_CPPCHECK
"--enable=all"
"--force"
)
find_program( CMAKE_CXX_CLANG_TIDY NAMES clang-tidy )
set( CMAKE_CXX_CPPCHECK "cppcheck")
endif( STATIC MATCHES TRUE )
if( CMAKE_BUILD_TYPE MATCHES Coverage )
find_program( GCOV NAMES gcov )
if( GCOV )
message( STATUS "Found gcov: ${GCOV}" )
else( GCOV )
message( ERROR "Not found gcov: install it" )
endif( GCOV )
find_program( LCOV NAMES lcov )
if( LCOV )
message( STATUS "Found lcov: ${LCOV}" )
else( LCOV )
message( ERROR "Not found lcov: install it" )
endif( LCOV )
find_program( GENHTML NAMES genhtml )
if( GENHTML )
message( STATUS "Found genhtml: ${GENHTML}" )
else( GENHTML )
message( ERROR "Not found genhtml: install it" )
endif( GENHTML )
endif( CMAKE_BUILD_TYPE MATCHES Coverage )
set( CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
#######################################################################EXTERNALS
find_package( Qt5Core REQUIRED )
find_package( Qt5Widgets REQUIRED )
find_package( Qt5Gui REQUIRED )
find_package( Qt5OpenGL REQUIRED )
find_package( OpenGL REQUIRED )
set( CMAKE_AUTOMOC ON )
set( CMAKE_AUTOUIC ON )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
#########################################################################SOURCES
set( QUCS-RF-LAYOUT_SRCS
"${CMAKE_SOURCE_DIR}/src/logger.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/element.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/pac.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/sp.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/subst.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcorn.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcoupled.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcross.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mgap.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mlin.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mmbend.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mopen.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mrstub.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mstep.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mtee.cpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mvia.cpp"
"${CMAKE_SOURCE_DIR}/src/data.cpp"
"${CMAKE_SOURCE_DIR}/src/schparser.cpp"
"${CMAKE_SOURCE_DIR}/src/xycalculator.cpp"
"${CMAKE_SOURCE_DIR}/src/oemsline.cpp"
"${CMAKE_SOURCE_DIR}/src/oemsmesh.cpp"
"${CMAKE_SOURCE_DIR}/src/layoutstrings.cpp"
"${CMAKE_SOURCE_DIR}/src/layoutwriter.cpp"
"${CMAKE_SOURCE_DIR}/src/converter.cpp"
"${CMAKE_SOURCE_DIR}/src/preview.cpp"
"${CMAKE_SOURCE_DIR}/src/mainwindow.cpp"
"${CMAKE_SOURCE_DIR}/src/main.cpp"
)
set( QUCS-RF-LAYOUT_HDRS
"${CMAKE_SOURCE_DIR}/src/logger.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/element.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/pac.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/sp.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/subst.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcorn.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcoupled.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mcross.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mgap.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mlin.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mmbend.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mopen.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mrstub.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mstep.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mtee.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/mvia.hpp"
"${CMAKE_SOURCE_DIR}/src/microstrip/microstrip.hpp"
"${CMAKE_SOURCE_DIR}/src/data.hpp"
"${CMAKE_SOURCE_DIR}/src/schparser.hpp"
"${CMAKE_SOURCE_DIR}/src/xycalculator.hpp"
"${CMAKE_SOURCE_DIR}/src/oemsline.hpp"
"${CMAKE_SOURCE_DIR}/src/oemsmesh.hpp"
"${CMAKE_SOURCE_DIR}/src/layoutstrings.hpp"
"${CMAKE_SOURCE_DIR}/src/layoutwriter.hpp"
"${CMAKE_SOURCE_DIR}/src/converter.hpp"
"${CMAKE_SOURCE_DIR}/src/preview.hpp"
"${CMAKE_SOURCE_DIR}/src/mainwindow.hpp"
)
##########################################################################TARGET
add_executable( ${PROJECT_NAME} WIN32
${QUCS-RF-LAYOUT_SRCS}
)
#[[ CMAKE 3.12
add_executable( ${PROJECT_NAME} )
target_sources( ${PROJECT_NAME}
PRIVATE
${QUCS-RF-LAYOUT_SRCS}
)
#]]
target_compile_definitions( ${PROJECT_NAME}
PRIVATE
${QT_DEPRECATED_WARNINGS}
QRFL_VERSION="${PROJECT_VERSION}"
)
target_compile_features( ${PROJECT_NAME}
PRIVATE
cxx_std_14
)
target_compile_options( ${PROJECT_NAME}
PRIVATE
$<$<CONFIG:Debug>:-Wall>
$<$<CONFIG:Debug>:-Wextra>
$<$<CONFIG:Debug>:-fexceptions>
)
target_include_directories( ${PROJECT_NAME}
PRIVATE
"${CMAKE_SOURCE_DIR}/src"
)
qt5_use_modules( ${PROJECT_NAME}
Core
Gui
OpenGL
)
set_target_properties( ${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "qucsrflayout"
# RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
install(
TARGETS ${PROJECT_NAME}
CONFIGURATIONS Release
RUNTIME DESTINATION "bin" #"${CMAKE_INSTALL_BINDIR}"
)
if( WIN32 )
if( MINGW AND HOST_LINUX )
set( MINGW_PATH "/usr/x86_64-w64-mingw32" )
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/dist/platforms"
COMMAND ${CMAKE_COMMAND} -E copy_if_different `${PELDD} -a "${CMAKE_BINARY_DIR}/qucsrflayout.exe" -w UxTheme.dll -w d3d11.dll -w dxgi.dll -w OPENGL32.dll -w USERENV.dll` "${CMAKE_BINARY_DIR}/dist"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${MINGW_PATH}/lib/qt/plugins/platforms/qwindows.dll" "${CMAKE_BINARY_DIR}/dist/platforms"
COMMENT "Find additional DLLs"
)
# else( MINGW AND HOST_LINUX )
# # Use winqdeploy or a Microsoft equivalent of ldd to copy dlls
endif( MINGW AND HOST_LINUX )
install(
DIRECTORY "${CMAKE_BINARY_DIR}/dist/."
DESTINATION "bin"
)
endif( WIN32 )
###########################################################################TOOLS
add_subdirectory( "${CMAKE_SOURCE_DIR}/doc" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/test" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/pack" )