initial commit

Fri, 02 Aug 2019 21:29:06 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 02 Aug 2019 21:29:06 +0300
changeset 0
f9f4d4d6f162
child 1
51d14b0c68c0

initial commit

.hgignore file | annotate | diff | comparison | revisions
CMakeLists.txt file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/mainwindow.h file | annotate | diff | comparison | revisions
src/mainwindow.ui file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,2 @@
+syntax:glob
+CMakeLists.txt.user
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,73 @@
+project(ldforge)
+cmake_minimum_required(VERSION 2.8.12)
+#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
+#include(cotire)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Core REQUIRED)
+find_package(Qt5OpenGL REQUIRED)
+find_package(Qt5Network REQUIRED)
+if (Qt5Widgets_VERSION VERSION_LESS 5.5.0)
+	message(FATAL_ERROR "Qt5 version 5.5 required")
+endif()
+set (CMAKE_AUTOMOC ON)
+find_package (OpenGL REQUIRED)
+# 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})
+include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
+# set_source_files_properties (${CMAKE_BINARY_DIR}/configuration.cpp PROPERTIES GENERATED TRUE)
+# set_property(SOURCE configuration.cpp PROPERTY SKIP_AUTOMOC ON)
+set (LDFORGE_SOURCES
+	src/main.cpp
+        src/mainwindow.cpp
+)
+set (LDFORGE_HEADERS
+	src/main.h
+        src/mainwindow.h
+)
+set (LDFORGE_FORMS
+        src/mainwindow.ui
+)
+# set (LDFORGE_OTHER_FILES
+# 	src/configurationoptions.txt
+# 	data/primitive-categories.cfg
+# )
+set (LDFORGE_RESOURCES ldforge.qrc)
+set(CMAKE_CXX_STANDARD 14)
+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")
+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} -Werror=all -Wextra")
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough -Wno-noexcept-type")
+endif()
+# qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES})
+qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
+add_executable (ldforge WIN32
+    ${LDFORGE_SOURCES} 
+    ${LDFORGE_HEADERS} 
+#     ${LDFORGE_OTHER_FILES}
+# 	${LDFORGE_QRC}
+	${LDFORGE_FORMS_HEADERS}
+# 	${CMAKE_BINARY_DIR}/configuration.cpp
+)
+set_source_files_properties(${LDFORGE_HEADERS} 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})
+# 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 revision_check config_collection)
+install (TARGETS ldforge RUNTIME DESTINATION bin)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main.cpp	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,11 @@
+#include <QApplication>
+#include "main.h"
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication app{argc, argv};
+    MainWindow mainwindow;
+    mainwindow.show();
+    return app.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main.h	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,1 @@
+#pragma once
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mainwindow.cpp	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,15 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow{parent},
+    ui{*new Ui_MainWindow}
+{
+    ui.setupUi(this);
+    connect(ui.actionQuit, &QAction::triggered, this, &QMainWindow::close);
+}
+
+MainWindow::~MainWindow()
+{
+    delete &this->ui;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mainwindow.h	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,12 @@
+#pragma once
+#include <QMainWindow>
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+private:
+    class Ui_MainWindow &ui;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mainwindow.ui	Fri Aug 02 21:29:06 2019 +0300
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>File</string>
+    </property>
+    <addaction name="actionQuit"/>
+   </widget>
+   <addaction name="menuFile"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionQuit">
+   <property name="text">
+    <string>Quit</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

mercurial