src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:51:08 +0200
branchv_0
changeset 10 da93f3667a52
parent 8 127d06e3a004
permissions -rw-r--r--
fix license version: GNU GPLv3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Spacenav Simulator Qt
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
# Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
bb36d1770a9e 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
bb36d1770a9e 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
10
da93f3667a52 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
     6
# the Free Software Foundation, version 3 of the License.
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#
bb36d1770a9e 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,
bb36d1770a9e 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
bb36d1770a9e 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
bb36d1770a9e 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.
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
#
bb36d1770a9e 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
bb36d1770a9e 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/>.
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
set(EXECUTABLE_FILE "spacenav-simulator-qt")
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
# Qt libraries:
bb36d1770a9e 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
bb36d1770a9e 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
bb36d1770a9e 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
bb36d1770a9e 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
5
980a27d138f7 publish events to all clients connected over unix domain socket
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    23
find_package(Qt5Network CONFIG REQUIRED)
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
# Add ASan AddressSanitizer
bb36d1770a9e 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")
bb36d1770a9e 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")
bb36d1770a9e 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."
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
# Executable output:
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
add_executable(
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	${EXECUTABLE_FILE}
bb36d1770a9e 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)
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    34
	SimulatorWindow.h
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    35
	SimulatorWindow.cpp
3
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    36
	SimulatorSocketServer.cpp
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	spacenav-simulator-qt.cpp
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
# Link libraries:
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
5
980a27d138f7 publish events to all clients connected over unix domain socket
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    42
target_link_libraries(${EXECUTABLE_FILE} Qt5::Network)
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
install(TARGETS ${EXECUTABLE_FILE} DESTINATION bin)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
# Print all variables:
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
#macro(print_all_variables)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
#	message(STATUS "print_all_variables------------------------------------------{")
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
#	get_cmake_property(_variableNames VARIABLES)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
#	foreach (_variableName ${_variableNames})
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
#		message(STATUS "${_variableName}=${${_variableName}}")
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
#	endforeach()
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
#	message(STATUS "print_all_variables------------------------------------------}")
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
#endmacro()
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
#
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
#print_all_variables()