forked from LibreCAD/LibreCAD_3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
79 lines (65 loc) · 2.38 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
cmake_minimum_required(VERSION 3.6)
project(LC)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(WITH_QT_UI "With QT user interface" ON)
option(WITH_LUACMDINTERFACE "Build Lua command line interface" ON)
option(WITH_UNITTESTS "Build unit tests" ON)
option(WITH_RENDERING_UNITTESTS "Build rendering unit tests (require GDK)" ON)
option(WITH_LIBOPENCAD "Use libopencad" ON)
#make doc/tests ?
option(WITH_DOCUMENTATION "Build documentation" OFF)
option(WITH_LCDXFDWG "Build dxf/dwg support" ON)
#Try to find version
if(EXISTS "${CMAKE_SOURCE_DIR}/lckernel/version.h")
file(READ "${CMAKE_SOURCE_DIR}/lckernel/version.h" FILE_VERSION_H REGEX "^#define")
string(REGEX REPLACE ".*#define VERSION_MAJOR ([0-9]+).*" "\\1" VERSION_MAJOR ${FILE_VERSION_H})
string(REGEX REPLACE ".*#define VERSION_MINOR ([0-9]+).*" "\\1" VERSION_MINOR ${FILE_VERSION_H})
endif()
#Print infos about compilation
message("***** LibreCAD *****")
message("Version: ${VERSION_MAJOR}.${VERSION_MINOR}\n")
message("Options:")
message(" - Qt user interface: ${WITH_QT_UI}")
message(" - Lua command line interface: ${WITH_LUACMDINTERFACE}")
message(" - Unit tests: ${WITH_UNITTESTS}")
message(" - Rendering unit tests: ${WITH_RENDERING_UNITTESTS}")
message(" - Documentation: ${WITH_DOCUMENTATION}")
message(" - LibreCAD DXF/DWG support: ${WITH_LCDXFDWG}")
message(" - Use libopencad: ${WITH_LIBOPENCAD}")
message("\n")
#Add each LibreCAD component
add_subdirectory("lckernel")
add_subdirectory("lcUILua")
add_subdirectory("lcadluascript")
if(WITH_LCDXFDWG)
add_subdirectory("lcDXFDWG")
add_definitions(-DUSE_lcDXFDWG=1)
else()
add_definitions(-DUSE_lcDXFDWG=0)
endif()
add_subdirectory("lcviewernoqt")
if(WITH_QT_UI)
add_definitions(-DWITH_QTUI)
add_subdirectory("lcUI")
endif(WITH_QT_UI)
if(WITH_LUACMDINTERFACE)
add_subdirectory("luacmdinterface")
endif(WITH_LUACMDINTERFACE)
if(WITH_UNITTESTS)
add_subdirectory("unittest")
endif()
# clang-tidy
find_file(
RUN_CLANG_TIDY_PY
NAMES "run-clang-tidy.py"
HINTS /usr/share/clang/
DOC "Path to clang-tidy executable"
)
if(RUN_CLANG_TIDY_PY)
message(STATUS "run-clang-tidy.py found: ${RUN_CLANG_TIDY_PY}")
set(DO_CLANG_TIDY "${RUN_CLANG_TIDY_PY}" "-p" "${CMAKE_BINARY_DIR}")
message(${DO_CLANG_TIDY})
add_custom_target(stylecheck ${DO_CLANG_TIDY})
else()
message(STATUS "run-clang-tidy.py executable not found.")
endif()