src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:49:24 +0200
branchv_0
changeset 11 aaa89fe98b63
parent 5 6ba51911d539
permissions -rw-r--r--
fix license version: GNU GPLv3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Spacenav Demo Qt
4
1383ad1c4f57 SpacenavWrapper
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     2
# Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
0
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
# it under the terms of the GNU General Public License as published by
11
aaa89fe98b63 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
     6
# the Free Software Foundation, version 3 of the License.
0
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
# This program is distributed in the hope that it will be useful,
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
# GNU General Public License for more details.
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
#
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
# You should have received a copy of the GNU General Public License
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
set(EXECUTABLE_FILE "spacenav-demo-qt")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
# Qt libraries:
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
find_package(Qt5Widgets CONFIG REQUIRED) # Find the QtWidgets library
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
# find_package(Qt5Charts CONFIG REQUIRED)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
# Add ASan AddressSanitizer
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
# From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
# Executable output:
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
add_executable(
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	${EXECUTABLE_FILE}
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	# QObjects must be listed here (including them from other files is not enough)
4
1383ad1c4f57 SpacenavWrapper
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    34
	SpacenavWindow.h
5
6ba51911d539 Qt designer UI
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    35
	SpacenavWindow.ui
6ba51911d539 Qt designer UI
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    36
	SpacenavWindow.cpp
1
2a3e9f07c128 receive spacenav events (in separate thread) and print them on stderr
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    37
	SpacenavReceiver.h
4
1383ad1c4f57 SpacenavWrapper
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    38
	SpacenavWrapper.cpp
0
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	spacenav-demo-qt.cpp
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
# Link libraries:
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
target_link_libraries(${EXECUTABLE_FILE} -lX11 -lm -lspnav)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
# target_link_libraries(${EXECUTABLE_FILE} Qt5::Charts)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
install(TARGETS ${EXECUTABLE_FILE} DESTINATION bin)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
# Print all variables:
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
#macro(print_all_variables)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
#	message(STATUS "print_all_variables------------------------------------------{")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
#	get_cmake_property(_variableNames VARIABLES)
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
#	foreach (_variableName ${_variableNames})
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
#		message(STATUS "${_variableName}=${${_variableName}}")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
#	endforeach()
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
#	message(STATUS "print_all_variables------------------------------------------}")
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
#endmacro()
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
#
37aa134ae57b empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
#print_all_variables()