forked from OpenHantek/OpenHantek6022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (78 loc) · 3.54 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
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(OpenHantek)
set(OpenGL_GL_PREFERENCE GLVND)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Default build type
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# Find external libraries
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/")
INCLUDE_DIRECTORIES(".")
# Use CPack to make deb/rpm/zip/exe installer packages
include(cmake/CPackInfos.cmake)
# Enable C++ standard library hardening -> cheap range checks for C++ arrays, vectors, and strings.
add_compile_options( -D_GLIBCXX_ASSERTIONS )
if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -pedantic)
endif()
# enable extra feature(s)
if ( DEFINED HANTEK_AC )
add_compile_definitions( HANTEK_AC )
endif()
# show all compile definitions
#get_directory_property( DirDefs COMPILE_DEFINITIONS )
#message( "COMPILE_DEFINITIONS = ${DirDefs}" )
# Qt Widgets based Gui with OpenGL canvas
add_subdirectory(openhantek)
if (WIN32)
install(FILES COPYING readme.md DESTINATION ".")
#else()
# add_subdirectory(firmware EXCLUDE_FROM_ALL)
endif()
if("${CMAKE_SYSTEM}" MATCHES "Linux")
if(EXISTS "/lib/udev/rules.d/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/utils/udev_rules/60-hantek.rules"
DESTINATION "/lib/udev/rules.d/" COMPONENT Runtime)
else()
message(WARNING "Could not find udev rules directory (/lib/udev/rules.d/), skipping installation of udev rules.")
endif()
if(EXISTS "/usr/share/applications/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/utils/applications/OpenHantek.desktop"
DESTINATION "/usr/share/applications/" COMPONENT Runtime)
else()
message(WARNING "Could not find applications directory (/usr/share/applications/), skipping installation of desktop file.")
endif()
if(EXISTS "/usr/share/icons/hicolor/48x48/apps/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/openhantek/res/images/OpenHantek.png"
DESTINATION /usr/share/icons/hicolor/48x48/apps/ COMPONENT Runtime)
else()
message(WARNING "Could not find icons directory (/usr/share/icons/hicolor/48x48/apps/), skipping installation of icon.")
endif()
if(EXISTS "/usr/share/icons/hicolor/scalable/apps/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/openhantek/res/images/OpenHantek.svg"
DESTINATION "/usr/share/icons/hicolor/scalable/apps/" COMPONENT Runtime)
else()
message(WARNING "Could not find icons directory (/usr/share/icons/hicolor/scalable/apps/), skipping installation of icon.")
endif()
if(EXISTS "/usr/share/doc/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/docs/OpenHantek6022_User_Manual.pdf"
DESTINATION "/usr/share/doc/OpenHantek" COMPONENT Runtime)
else()
message(WARNING "Could not find doc directory (/usr/share/doc/), skipping installation of user manual.")
endif()
endif()
# Add auxiliary files to the project, so that these files appear in VisualStudio/QtCreator
file(GLOB_RECURSE MDFILES "docs/*.md" "openhantek/*.md")
add_custom_target(readme SOURCES readme.md ${MDFILES})
# Add "cppcheck" command
add_custom_target(cppcheck COMMAND "cppcheck --enable=all -I \"${CMAKE_CURRENT_LIST_DIR}/openhantek/src\" -q ${SRC} --template=\"{file}:{line}: {severity}: {message}\"")
# Add "doc" target to build the documentation.
find_package(Doxygen QUIET)
if (DOXYGEN_FOUND)
add_custom_target(doc
COMMAND "${CMAKE_COMMAND} -E remove_directory html"
COMMAND "${DOXYGEN_EXECUTABLE} Doxyfile" WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
endif()