-
Notifications
You must be signed in to change notification settings - Fork 55
/
CMakeLists.txt
88 lines (72 loc) · 3.1 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
# Minimum CMake required
cmake_minimum_required(VERSION 3.5)
if(WIN32)
if(${CMAKE_VERSION} VERSION_LESS "3.8")
message(WARNING "Your current cmake version is ${CMAKE_VERSION} which does not support setting the toolset architecture to x64. This may cause \"compiler out of heap space\" errors when building. Consider upgrading your cmake to > 3.8 and using the flag -Thost=x64 when running cmake.")
else()
if(NOT CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE OR NOT "${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}" STREQUAL "x64")
message(WARNING "Your current cmake generator is set to use 32 bit toolset architecture. This may cause \"compiler out of heap space\" errors when building. Consider using the flag -Thost=x64 when running cmake.")
endif()
endif()
endif()
# Project
project(nanovna_qt C CXX)
set(xaVNA_VERSION_MAJOR 0)
set(xaVNA_VERSION_MINOR 1)
set(xaVNA_VERSION_STRING ${xaVNA_VERSION_MAJOR}.${xaVNA_VERSION_MINOR})
# Set C++11 as standard for the whole project
set(CMAKE_CXX_STANDARD 11)
if(UNIX)
set(CMAKE_CXX_FLAGS "-O2 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g ${CMAKE_CXX_FLAGS}")
endif()
if(NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib)
endif()
if(NOT BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR bin)
endif()
# Set version
add_definitions(-DVERSION=\"${xaVNA_VERSION_STRING}\")
add_definitions(-DEIGEN_DONT_VECTORIZE -DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
# CMake policies
cmake_policy(SET CMP0022 NEW)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Position independent code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Local Include
include_directories(include)
# ==============================================================================
# Eigen3
# ==============================================================================
find_package(Eigen3 REQUIRED)
if(EIGEN3_FOUND)
message(STATUS " eigen3 version: ${EIGEN3_VERSION}")
message(STATUS " eigen3 includes: ${EIGEN3_INCLUDE_DIR}")
include_directories(${EIGEN3_INCLUDE_DIR})
endif()
# ==============================================================================
# FFTW3
# ==============================================================================
find_package(FFTW3 REQUIRED)
if(FFTW3_FOUND)
message(STATUS "Found FFTW3 (${FFTW3_VERSION})")
message(STATUS " fftw3 includes: ${FFTW3_INCLUDE_DIRS}")
message(STATUS " fftw3 libraries: ${FFTW3_LIBRARIES}")
include_directories(${FFTW3_INCLUDE_DIR})
endif()
# ==============================================================================
# QT5 Charts (and QT5 subdependences)
# ==============================================================================
find_package(Qt5 COMPONENTS Core Gui Widgets Charts REQUIRED)
if(Qt5Charts_FOUND)
message(STATUS "Found QT5 version: ${Qt5_VERSION}")
message(STATUS " qt5 charts dir: ${Qt5Charts_DIR}")
endif()
# ==============================================================================
# xaVNA subprojects
# ==============================================================================
add_subdirectory(libxavna)
add_subdirectory(libxavna/xavna_mock_ui)
add_subdirectory(vna_qt)