Fri, 04 Mar 2022 23:00:06 +0200
add missing files
project(ldforge) cmake_minimum_required(VERSION 2.8.12) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") #include(cotire) set(OpenGL_GL_PREFERENCE GLVND) find_package(Qt5Widgets REQUIRED) if (Qt5Widgets_VERSION VERSION_LESS 5.5.0) message(FATAL_ERROR "Qt5 version 5.5 required") endif() find_package(Qt5Core REQUIRED) find_package(Qt5OpenGL REQUIRED) find_package(Qt5Network REQUIRED) #find_package(Qt5LinguistTools REQUIRED) find_package(GLM REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) find_package(OpenGL REQUIRED) include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) include_directories(${GLM_INCLUDE_DIR}) add_definitions(-DQT_NO_KEYWORDS) source_group("1 Foundation code" REGULAR_EXPRESSION "src/.+\\.(cpp|h|ui)") source_group("4 OpenGL renderer" REGULAR_EXPRESSION "src/gl/.+\\.(cpp|h|ui)") source_group("5 LDraw line types" REGULAR_EXPRESSION "src/linetypes/.+\\.(cpp|h|ui)") source_group("5.1 LDraw algorithms" REGULAR_EXPRESSION "src/ldrawalgorithm.(cpp|h|ui)") source_group("3.2 Widgets" REGULAR_EXPRESSION "src/(ui|widgets)/.+\\.(cpp|h|ui)") source_group("3.1 Settings editor" REGULAR_EXPRESSION "src/settingseditor/.+\\.(cpp|h|ui)") source_group("3 User interface" REGULAR_EXPRESSION "src/(mainwindow|document|documentmanager|uiutilities)\\.(cpp|h|ui)") source_group("2 Model handling" REGULAR_EXPRESSION "src/(model|modeleditor|libraries|colors|parser|vertexmap|edithistory|polygoncache)\\.(cpp|h|ui)") source_group("6 Editing tools" REGULAR_EXPRESSION "src/tools/.+\\.(cpp|h|ui)") set (LDFORGE_SOURCES src/colors.cpp src/document.cpp src/documentmanager.cpp src/edithistory.cpp src/geometry.cpp src/header.cpp src/ldrawalgorithm.cpp src/libraries.cpp src/invert.cpp src/main.cpp src/mainwindow.cpp src/model.cpp src/modeleditor.cpp src/parser.cpp src/polygoncache.cpp src/uiutilities.cpp src/version.cpp src/vertexmap.cpp src/gl/axesprogram.cpp src/gl/basicshaderprogram.cpp src/gl/compiler.cpp src/gl/gridprogram.cpp src/gl/partrenderer.cpp src/gl/vertexprogram.cpp src/linetypes/comment.cpp src/linetypes/conditionaledge.cpp src/linetypes/edge.cpp src/linetypes/errorline.cpp src/linetypes/metacommand.cpp src/linetypes/object.cpp src/linetypes/quadrilateral.cpp src/linetypes/subfilereference.cpp src/linetypes/triangle.cpp src/settingseditor/keyboardshortcutseditor.cpp src/settingseditor/librarieseditor.cpp src/settingseditor/settingseditor.cpp src/types/boundingbox.cpp src/ui/canvas.cpp src/ui/multiplyfactordialog.cpp src/ui/objecteditor.cpp src/ui/polygonobjecteditor.cpp src/widgets/colorbutton.cpp src/widgets/colorselectdialog.cpp src/widgets/doublespinbox.cpp src/widgets/matrixeditor.cpp src/widgets/vec3editor.cpp src/tools/basetool.cpp src/tools/selecttool.cpp src/tools/drawtool.cpp src/tools/transformtool.cpp ) set (LDFORGE_HEADERS src/basics.h src/colors.h src/document.h src/documentmanager.h src/edithistory.h src/functional.h src/geometry.h src/header.h src/invert.h src/ldrawalgorithm.h src/libraries.h src/main.h src/mainwindow.h src/maths.h src/model.h src/modeleditor.h src/parser.h src/polygoncache.h src/ring.h src/uiutilities.h src/utility.h src/version.h src/vertexmap.h src/gl/axesprogram.h src/gl/basicshaderprogram.h src/gl/common.h src/gl/compiler.h src/gl/gridprogram.h src/gl/partrenderer.h src/gl/vertexprogram.h src/linetypes/comment.h src/linetypes/conditionaledge.h src/linetypes/edge.h src/linetypes/errorline.h src/linetypes/metacommand.h src/linetypes/object.h src/linetypes/polygonobject.h src/linetypes/propertygenerics.h src/linetypes/quadrilateral.h src/linetypes/subfilereference.h src/linetypes/triangle.h src/settingseditor/keyboardshortcutseditor.h src/settingseditor/librarieseditor.h src/settingseditor/settingseditor.h src/types/boundingbox.h src/ui/canvas.h src/ui/multiplyfactordialog.h src/ui/objecteditor.h src/ui/polygonobjecteditor.h src/widgets/colorbutton.h src/widgets/colorselectdialog.h src/widgets/doublespinbox.h src/widgets/matrixeditor.h src/widgets/vec3editor.h src/tools/selecttool.h src/tools/basetool.h src/tools/drawtool.h src/tools/transformtool.h ) set (LDFORGE_FORMS src/document.ui src/mainwindow.ui src/settingseditor/librarieseditor.ui src/settingseditor/settingseditor.ui src/ui/multiplyfactordialog.ui src/widgets/colorselectdialog.ui src/widgets/matrixeditor.ui src/widgets/vec3editor.ui ) set(LDFORGE_LOCALES locale/fi.ts locale/sv.ts ) set (LDFORGE_OTHER_FILES src/configurationoptions.txt ) set(LDFORGE_RESOURCES ldforge.qrc) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) include_directories("${PROJECT_BINARY_DIR}") include_directories("${PROJECT_BINARY_DIR}/src") include_directories("${PROJECT_SOURCE_DIR}/src") # Translations #qt5_create_translation(QM_FILES ${LDFORGE_SOURCES} ${LDFORGE_HEADERS} ${LDFORGE_FORMS} ${LDFORGE_LOCALES}) #add_custom_target(translations ALL DEPENDS ${QM_FILES}) add_custom_target(resources ALL DEPENDS ${LDFORGE_RESOURCES}) if (NOT MSVC) if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") endif() qt5_add_resources(LDFORGE_QRC ${LDFORGE_RESOURCES}) qt5_wrap_ui(LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS}) # Move languages.qrc into the build directory to bake the .qm-files into LDForge # so that they don't have to be shipped separately # https://stackoverflow.com/a/34798124 # https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412 set(LANGUAGES_QRC "languages.qrc") configure_file(${LANGUAGES_QRC} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) qt5_add_resources(LDFORGE_QM_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGES_QRC}) set_source_files_properties(${LDFORGE_LOCALES} PROPERTIES HEADER_FILE_ONLY TRUE) add_executable(ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_HEADERS} ${LDFORGE_RESOURCES} #${LDFORGE_QRC} #${LDFORGE_QM_RC_FILE} ${QM_FILES} ${LDFORGE_FORMS_HEADERS} ${LDFORGE_OTHER_FILES} ${CMAKE_BINARY_DIR}/configuration.cpp ) set_source_files_properties(${LDFORGE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${LDFORGE_RESOURCES} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${LDFORGE_OTHER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(ldforge PROPERTIES AUTOMOC 1) target_link_libraries(ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) add_dependencies(ldforge resources) #cotire(ldforge) add_custom_target (config_collection ALL COMMAND python3 "${CMAKE_SOURCE_DIR}/tools/configcollector.py" --header ${CMAKE_BINARY_DIR}/configuration.h --source ${CMAKE_BINARY_DIR}/configuration.cpp --sourcedir ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/configurationoptions.txt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_dependencies(ldforge config_collection) set_source_files_properties (${CMAKE_BINARY_DIR}/configuration.cpp PROPERTIES GENERATED TRUE) set_property(SOURCE configuration.cpp PROPERTY SKIP_AUTOGEN ON) add_custom_target(linelength ALL COMMAND python3 "${CMAKE_SOURCE_DIR}/tools/linelength.py" ${LDFORGE_SOURCES} ${LDFORGE_HEADERS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_dependencies(ldforge linelength) # Collect the current hg revision into hginfo.h add_custom_target(revision_check ALL COMMAND python3 "${CMAKE_SOURCE_DIR}/tools/updaterevision.py" --cwd "$(CMAKE_SOURCE_DIR)" hginfo.h WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_dependencies(ldforge revision_check) install(TARGETS ldforge RUNTIME DESTINATION bin)