Fri, 02 Aug 2019 21:29:06 +0300
initial commit
0 | 1 | project(ldforge) |
2 | cmake_minimum_required(VERSION 2.8.12) | |
3 | #set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") | |
4 | #include(cotire) | |
5 | find_package(Qt5Widgets REQUIRED) | |
6 | find_package(Qt5Core REQUIRED) | |
7 | find_package(Qt5OpenGL REQUIRED) | |
8 | find_package(Qt5Network REQUIRED) | |
9 | if (Qt5Widgets_VERSION VERSION_LESS 5.5.0) | |
10 | message(FATAL_ERROR "Qt5 version 5.5 required") | |
11 | endif() | |
12 | set (CMAKE_AUTOMOC ON) | |
13 | find_package (OpenGL REQUIRED) | |
14 | # add_custom_target (revision_check ALL | |
15 | # COMMAND python3 "${CMAKE_SOURCE_DIR}/tools/updaterevision.py" --cwd "$(CMAKE_SOURCE_DIR)" hginfo.h | |
16 | # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) | |
17 | include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) | |
18 | # set_source_files_properties (${CMAKE_BINARY_DIR}/configuration.cpp PROPERTIES GENERATED TRUE) | |
19 | # set_property(SOURCE configuration.cpp PROPERTY SKIP_AUTOMOC ON) | |
20 | set (LDFORGE_SOURCES | |
21 | src/main.cpp | |
22 | src/mainwindow.cpp | |
23 | ) | |
24 | set (LDFORGE_HEADERS | |
25 | src/main.h | |
26 | src/mainwindow.h | |
27 | ) | |
28 | set (LDFORGE_FORMS | |
29 | src/mainwindow.ui | |
30 | ) | |
31 | # set (LDFORGE_OTHER_FILES | |
32 | # src/configurationoptions.txt | |
33 | # data/primitive-categories.cfg | |
34 | # ) | |
35 | set (LDFORGE_RESOURCES ldforge.qrc) | |
36 | set(CMAKE_CXX_STANDARD 14) | |
37 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
38 | set(CMAKE_CXX_EXTENSIONS OFF) | |
39 | include_directories ("${PROJECT_BINARY_DIR}") | |
40 | include_directories ("${PROJECT_BINARY_DIR}/src") | |
41 | include_directories ("${PROJECT_SOURCE_DIR}/src") | |
42 | if (NOT MSVC) | |
43 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") | |
44 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG") | |
45 | endif() | |
46 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=all -Wextra") | |
47 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough -Wno-noexcept-type") | |
48 | endif() | |
49 | # qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES}) | |
50 | qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS}) | |
51 | add_executable (ldforge WIN32 | |
52 | ${LDFORGE_SOURCES} | |
53 | ${LDFORGE_HEADERS} | |
54 | # ${LDFORGE_OTHER_FILES} | |
55 | # ${LDFORGE_QRC} | |
56 | ${LDFORGE_FORMS_HEADERS} | |
57 | # ${CMAKE_BINARY_DIR}/configuration.cpp | |
58 | ) | |
59 | set_source_files_properties(${LDFORGE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE) | |
60 | set_source_files_properties(${LDFORGE_OTHER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) | |
61 | set_target_properties(ldforge PROPERTIES AUTOMOC 1) | |
62 | target_link_libraries(ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) | |
63 | # cotire(ldforge) | |
64 | # add_custom_target (config_collection ALL | |
65 | # COMMAND python3 | |
66 | # "${CMAKE_SOURCE_DIR}/tools/configcollector.py" | |
67 | # --header ${CMAKE_BINARY_DIR}/configuration.h | |
68 | # --source ${CMAKE_BINARY_DIR}/configuration.cpp | |
69 | # --sourcedir ${CMAKE_SOURCE_DIR}/src | |
70 | # ${CMAKE_SOURCE_DIR}/src/configurationoptions.txt | |
71 | # WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) | |
72 | add_dependencies (ldforge revision_check config_collection) | |
73 | install (TARGETS ldforge RUNTIME DESTINATION bin) |