Fri, 06 Mar 2020 23:45:44 +0200
stretch the grid quadrilateral less, hopefully this makes fragments small enough even on integrated
0 | 1 | project(ldforge) |
2 | cmake_minimum_required(VERSION 2.8.12) | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
3 | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
4 | include(cotire) |
21 | 5 | set(OpenGL_GL_PREFERENCE GLVND) |
0 | 6 | find_package(Qt5Widgets REQUIRED) |
6 | 7 | if (Qt5Widgets_VERSION VERSION_LESS 5.5.0) |
8 | message(FATAL_ERROR "Qt5 version 5.5 required") | |
9 | endif() | |
0 | 10 | find_package(Qt5Core REQUIRED) |
11 | find_package(Qt5OpenGL REQUIRED) | |
12 | find_package(Qt5Network REQUIRED) | |
6 | 13 | find_package(Qt5LinguistTools REQUIRED) |
17 | 14 | find_package(GLUT REQUIRED) |
28 | 15 | find_package(GLM REQUIRED) |
16 | set(CMAKE_AUTOMOC ON) | |
17 | set(CMAKE_AUTOUIC ON) | |
18 | set(CMAKE_AUTORCC ON) | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
19 | find_package(OpenGL REQUIRED) |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
20 | include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) |
17 | 21 | include_directories(${GLUT_INCLUDE_DIR}) |
28 | 22 | include_directories(${GLM_INCLUDE_DIR}) |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
23 | |
0 | 24 | set (LDFORGE_SOURCES |
26 | 25 | src/colors.cpp |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
7
diff
changeset
|
26 | src/document.cpp |
3 | 27 | src/documentmanager.cpp |
55 | 28 | src/geometry.cpp |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
29 | src/libraries.cpp |
17 | 30 | src/invert.cpp |
0 | 31 | src/main.cpp |
1 | 32 | src/mainwindow.cpp |
3 | 33 | src/model.cpp |
34 | src/modeleditcontext.cpp | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
35 | src/parser.cpp |
16 | 36 | src/uiutilities.cpp |
1 | 37 | src/version.cpp |
69
a36913fc552a
begin work on axes program
Teemu Piippo <teemu@hecknology.net>
parents:
63
diff
changeset
|
38 | src/gl/axesprogram.cpp |
70 | 39 | src/gl/basicshaderprogram.cpp |
17 | 40 | src/gl/compiler.cpp |
53 | 41 | src/gl/gridprogram.cpp |
17 | 42 | src/gl/partrenderer.cpp |
14 | 43 | src/linetypes/comment.cpp |
44 | src/linetypes/conditionaledge.cpp | |
45 | src/linetypes/edge.cpp | |
46 | src/linetypes/errorline.cpp | |
47 | src/linetypes/metacommand.cpp | |
48 | src/linetypes/object.cpp | |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
14
diff
changeset
|
49 | src/linetypes/quadrilateral.cpp |
14 | 50 | src/linetypes/subfilereference.cpp |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
14
diff
changeset
|
51 | src/linetypes/triangle.cpp |
16 | 52 | src/settingseditor/keyboardshortcutseditor.cpp |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
53 | src/settingseditor/librarieseditor.cpp |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
54 | src/settingseditor/settingseditor.cpp |
17 | 55 | src/types/boundingbox.cpp |
47 | 56 | src/ui/canvas.cpp |
39
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
57 | src/widgets/colorbutton.cpp |
0 | 58 | ) |
59 | set (LDFORGE_HEADERS | |
3 | 60 | src/basics.h |
61 | src/colors.h | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
7
diff
changeset
|
62 | src/document.h |
3 | 63 | src/documentmanager.h |
63
f7dd937667a5
omg functional programming
Teemu Piippo <teemu@hecknology.net>
parents:
55
diff
changeset
|
64 | src/functional.h |
55 | 65 | src/geometry.h |
21 | 66 | src/header.h |
17 | 67 | src/invert.h |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
68 | src/libraries.h |
0 | 69 | src/main.h |
1 | 70 | src/mainwindow.h |
20 | 71 | src/maths.h |
3 | 72 | src/model.h |
73 | src/modeleditcontext.h | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
74 | src/parser.h |
17 | 75 | src/ring.h |
16 | 76 | src/uiutilities.h |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
7
diff
changeset
|
77 | src/utility.h |
1 | 78 | src/version.h |
69
a36913fc552a
begin work on axes program
Teemu Piippo <teemu@hecknology.net>
parents:
63
diff
changeset
|
79 | src/gl/axesprogram.h |
70 | 80 | src/gl/basicshaderprogram.h |
17 | 81 | src/gl/common.h |
82 | src/gl/compiler.h | |
53 | 83 | src/gl/gridprogram.h |
17 | 84 | src/gl/partrenderer.h |
14 | 85 | src/linetypes/comment.h |
86 | src/linetypes/conditionaledge.h | |
87 | src/linetypes/edge.h | |
88 | src/linetypes/errorline.h | |
89 | src/linetypes/metacommand.h | |
90 | src/linetypes/object.h | |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
14
diff
changeset
|
91 | src/linetypes/quadrilateral.h |
14 | 92 | src/linetypes/subfilereference.h |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
14
diff
changeset
|
93 | src/linetypes/triangle.h |
16 | 94 | src/settingseditor/keyboardshortcutseditor.h |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
95 | src/settingseditor/librarieseditor.h |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
96 | src/settingseditor/settingseditor.h |
17 | 97 | src/types/boundingbox.h |
47 | 98 | src/ui/canvas.h |
39
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
99 | src/widgets/colorbutton.h |
0 | 100 | ) |
101 | set (LDFORGE_FORMS | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
7
diff
changeset
|
102 | src/document.ui |
1 | 103 | src/mainwindow.ui |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
104 | src/settingseditor/librarieseditor.ui |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
105 | src/settingseditor/settingseditor.ui |
0 | 106 | ) |
6 | 107 | |
108 | set(LDFORGE_LOCALES | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
109 | locale/fi.ts |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
110 | locale/sv.ts |
6 | 111 | ) |
112 | ||
42
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
113 | set (LDFORGE_OTHER_FILES |
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
114 | src/configurationoptions.txt |
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
115 | ) |
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
116 | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
117 | set(LDFORGE_RESOURCES ldforge.qrc) |
39
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
118 | set(CMAKE_CXX_STANDARD 17) |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
119 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
120 | set(CMAKE_CXX_EXTENSIONS OFF) |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
121 | include_directories("${PROJECT_BINARY_DIR}") |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
122 | include_directories("${PROJECT_BINARY_DIR}/src") |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
123 | include_directories("${PROJECT_SOURCE_DIR}/src") |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
124 | |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
125 | # Translations |
6 | 126 | qt5_create_translation(QM_FILES ${LDFORGE_SOURCES} ${LDFORGE_HEADERS} ${LDFORGE_FORMS} ${LDFORGE_LOCALES}) |
127 | add_custom_target(translations ALL DEPENDS ${QM_FILES}) | |
10
e249d97c7fe6
fixed translations being updated twice at the same time, that's bad
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
128 | add_custom_target(resources ALL DEPENDS ${LDFORGE_RESOURCES}) |
6 | 129 | |
0 | 130 | if (NOT MSVC) |
131 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
132 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG") |
0 | 133 | endif() |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
134 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
135 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough") |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
136 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") |
0 | 137 | endif() |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
138 | qt5_add_resources(LDFORGE_QRC ${LDFORGE_RESOURCES}) |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
139 | qt5_wrap_ui(LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS}) |
6 | 140 | |
141 | # Move languages.qrc into the build directory to bake the .qm-files into LDForge | |
142 | # so that they don't have to be shipped separately | |
143 | # https://stackoverflow.com/a/34798124 | |
10
e249d97c7fe6
fixed translations being updated twice at the same time, that's bad
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
144 | # https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412 |
6 | 145 | set(LANGUAGES_QRC "languages.qrc") |
10
e249d97c7fe6
fixed translations being updated twice at the same time, that's bad
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
146 | configure_file(${LANGUAGES_QRC} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) |
6 | 147 | qt5_add_resources(LDFORGE_QM_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGES_QRC}) |
28 | 148 | set_source_files_properties(${LDFORGE_LOCALES} PROPERTIES HEADER_FILE_ONLY TRUE) |
6 | 149 | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
150 | add_executable(ldforge WIN32 |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
151 | ${LDFORGE_SOURCES} |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
152 | ${LDFORGE_HEADERS} |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
153 | ${LDFORGE_RESOURCES} |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
154 | ${LDFORGE_QRC} |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
155 | ${LDFORGE_QM_RC_FILE} |
28 | 156 | ${QM_FILES} |
0 | 157 | ${LDFORGE_FORMS_HEADERS} |
42
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
158 | ${LDFORGE_OTHER_FILES} |
41
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
159 | ${CMAKE_BINARY_DIR}/configuration.cpp |
0 | 160 | ) |
6 | 161 | |
0 | 162 | set_source_files_properties(${LDFORGE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE) |
6 | 163 | set_source_files_properties(${LDFORGE_RESOURCES} PROPERTIES HEADER_FILE_ONLY TRUE) |
42
1d03dc1173cd
made configurationoptions.txt visible in Qt Creator
Teemu Piippo <teemu@hecknology.net>
parents:
41
diff
changeset
|
164 | set_source_files_properties(${LDFORGE_OTHER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) |
0 | 165 | set_target_properties(ldforge PROPERTIES AUTOMOC 1) |
166 | target_link_libraries(ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) | |
17 | 167 | target_link_libraries(ldforge ${GLUT_LIBRARIES}) |
28 | 168 | add_dependencies(ldforge resources) |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
169 | cotire(ldforge) |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
170 | |
41
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
171 | add_custom_target (config_collection ALL |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
172 | COMMAND python3 |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
173 | "${CMAKE_SOURCE_DIR}/tools/configcollector.py" |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
174 | --header ${CMAKE_BINARY_DIR}/configuration.h |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
175 | --source ${CMAKE_BINARY_DIR}/configuration.cpp |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
176 | --sourcedir ${CMAKE_SOURCE_DIR}/src |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
177 | ${CMAKE_SOURCE_DIR}/src/configurationoptions.txt |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
178 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
179 | add_dependencies(ldforge config_collection) |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
180 | set_source_files_properties (${CMAKE_BINARY_DIR}/configuration.cpp PROPERTIES GENERATED TRUE) |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
181 | set_property(SOURCE configuration.cpp PROPERTY SKIP_AUTOGEN ON) |
0abada2a9802
added automated configuration collection
Teemu Piippo <teemu@hecknology.net>
parents:
39
diff
changeset
|
182 | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
183 | # Collect the current hg revision into hginfo.h |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
184 | add_custom_target(revision_check ALL |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
185 | COMMAND python3 "${CMAKE_SOURCE_DIR}/tools/updaterevision.py" --cwd "$(CMAKE_SOURCE_DIR)" hginfo.h |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
186 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
187 | add_dependencies(ldforge revision_check) |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
188 | |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
189 | install(TARGETS ldforge RUNTIME DESTINATION bin) |