Prepare project for unit-test executables
This commit splits the brunt of the Ripes application into a separate library,
which may then be linked to by a main file of a different Qt project file.
This commit allows introducing additional applications into the build,
required for adding unit test executable(s).
MODIFY
Ripes.pro
Ripes.pro
-QT += widgets svg
-
-CONFIG += c++14
-
-INCLUDEPATH += $$PWD/src/ \
- $$PWD/src/graphics/ \
- $$PWD/external/fancytabbar/
-
-SOURCES += src/main.cpp \
- src/parser.cpp \
- #src/runner.cpp \
- src/mainwindow.cpp \
- src/registerwidget.cpp \
- src/programfiletab.cpp \
- src/processortab.cpp \
- src/memorytab.cpp \
- src/memorymodel.cpp \
- src/memorydisplaydelegate.cpp \
- src/memoryview.cpp \
- src/gotocombobox.cpp \
- src/addressdialog.cpp \
- src/codeeditor.cpp \
- src/tabbar.cpp \
- src/graphics/shape.cpp \
- src/graphics/connection.cpp \
- src/graphics/pipelinewidget.cpp \
- src/registercontainerwidget.cpp \
- src/aboutwidget.cpp \
- src/graphics/backgrounditems.cpp \
- src/instructionmodel.cpp \
- src/pipeline.cpp \
- src/pipelineobjects.cpp \
- src/assembler.cpp \
- src/syntaxhighlighter.cpp \
- src/pipelinetable.cpp \
- src/pipelinetablemodel.cpp \
- src/rwjumpwidget.cpp \
- src/rwjumpmodel.cpp \
- src/rundialog.cpp \
- src/binutils.cpp
-
-HEADERS += \
- src/parser.h \
- src/defines.h \
- #src/runner.h \
- src/mainwindow.h \
- src/registerwidget.h \
- src/programfiletab.h \
- src/processortab.h \
- src/memorytab.h \
- src/memorymodel.h \
- src/memorydisplaydelegate.h \
- src/memoryview.h \
- src/gotocombobox.h \
- src/addressdialog.h \
- src/addressdialog.h \
- src/codeeditor.h \
- src/tabbar.h \
- src/graphics/shape.h \
- src/graphics/connection.h \
- src/graphics/pipelinewidget.h \
- src/registercontainerwidget.h \
- src/aboutwidget.h \
- src/graphics/backgrounditems.h \
- src/instructionmodel.h \
- src/binutils.h \
- src/pipelineobjects.h \
- src/pipeline.h \
- src/mainmemory.h \
- src/assembler.h \
- src/syntaxhighlighter.h \
- src/pipelinetable.h \
- src/pipelinetablemodel.h \
- src/rwjumpwidget.h \
- src/rwjumpmodel.h \
- src/lexerutilities.h \
- src/graphics/descriptions.h \
- src/rundialog.h
-
-FORMS += \
- src/mainwindow.ui \
- src/registerwidget.ui \
- src/programfiletab.ui \
- src/processortab.ui \
- src/memorytab.ui \
- src/addressdialog.ui \
- src/registercontainerwidget.ui \
- src/aboutwidget.ui \
- src/pipelinetable.ui \
- src/rwjumpwidget.ui \
- src/rundialog.ui
-
-
-# External
-DEFINES += QT_NO_PRINTER
-
-HEADERS += \
- external/fancytabbar/fancytab.h \
- external/fancytabbar/fancytabbar.h \
-
-
-SOURCES += \
- external/fancytabbar/fancytab.cpp \
- external/fancytabbar/fancytabbar.cpp \
-
-RESOURCES += \
- resources/images.qrc \
- examples/examples.qrc
-
-unix {
- isEmpty(PREFIX) {
- PREFIX = /usr
- }
- target.path = $$PREFIX/bin
-
- desktop.path = $$PREFIX/share/applications/
- desktop.files += Ripes.desktop
-
- icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
- icon512.files += Ripes.png
-
- icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps
- icon256.files += Ripes.png
-
- INSTALLS += icon512
- INSTALLS += icon256
- INSTALLS += desktop
- INSTALLS += target
-}
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS = src app # test
+# test.depends = src
+app.depends = src

ADD
app/app.pro
+TARGET = Ripes
+
+QT += widgets
+
+CONFIG += c++14
+
+INCLUDEPATH += ../src/
+SOURCES += main.cpp
+
+win32 {
+ CONFIG(release, debug|release) {
+ BUILD_PREFIX = release/
+ }
+ CONFIG(debug, debug|release) {
+ BUILD_PREFIX = debug/
+ }
+}
+
+LIBS += -L$${PWD}/../src/$${BUILD_PREFIX} -lRipesLib
+
+unix {
+ isEmpty(PREFIX) {
+ PREFIX = /usr
+ }
+ target.path = $$PREFIX/bin
+
+ desktop.path = $$PREFIX/share/applications/
+ desktop.files += Ripes.desktop
+
+ icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
+ icon512.files += Ripes.png
+
+ icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps
+ icon256.files += Ripes.png
+
+ INSTALLS += icon512
+ INSTALLS += icon256
+ INSTALLS += desktop
+ INSTALLS += target
+}

RENAME
src/main.cpp
app/main.cpp
using namespace std;
int main(int argc, char** argv) {
+ Q_INIT_RESOURCE(images);
+ Q_INIT_RESOURCE(examples);
+
QApplication app(argc, argv);
MainWindow m;
m.show();

MODIFY
scripts/linux/travisbuild.sh
scripts/linux/travisbuild.sh
@@ -3,7 +3,12 @@ qmake --version
# build
qmake CONFIG+=release PREFIX=/usr
make -j$(nproc)
-make INSTALL_ROOT=appdir -j$(nproc) install ; find appdir/
+pushd app
+make INSTALL_ROOT=../appdir -j$(nproc) install
+popd
+echo "Appdir contents:"
+find appdir/
+
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH

MODIFY
scripts/mac/after_success.sh
scripts/mac/after_success.sh
#!/bin/bash
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
-bash upload.sh Ripes*.zip
+bash upload.sh app/Ripes*.zip

MODIFY
scripts/mac/travisbuild.sh
scripts/mac/travisbuild.sh
@@ -10,11 +10,11 @@ export QT_ROOT=${TRAVIS_BUILD_DIR}/Qt/5.11.1/clang_64
export PATH=$QT_ROOT/bin:$PATH # Make sure correct qmake is found on the $PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
-
qmake CONFIG+=release CONFIG+=c++14
make -j$(nproc)
# Start bundling the app
+pushd app/
macdeployqt Ripes.app
APPNAME=Ripes-continuous-mac-x86_64

MODIFY
scripts/windows/travisbuild.sh
scripts/windows/travisbuild.sh
@@ -6,16 +6,14 @@ export PATH=$MXE_DIR/usr/bin:$PATH
echo $PATH
-echo "Running QMake"
-${MXE_DIR}/usr/${MXE_TARGET}/qt5/bin/qmake CONFIG+=release CONFIG+=c++14 QMAKE_LFLAGS+=-static-libgcc
+export RIPES_CFG="release"
-
-echo "Running make"
-make -j 2
+echo "Building..."
+${MXE_DIR}/usr/${MXE_TARGET}/qt5/bin/qmake CONFIG+=${RIPES_CFG} CONFIG+=c++14 QMAKE_LFLAGS+=-static-libgcc
+make -j$(nproc)
echo "Done."
+
# Start bundling the .zip
APPNAME=Ripes-continuous-win-x86_64
-
-cd release
-sudo mv Ripes.exe $APPNAME.exe
\ No newline at end of file
+sudo mv app/${RIPES_CFG}/Ripes.exe $APPNAME.exe
\ No newline at end of file

ADD
src/src.pro
+TARGET = RipesLib
+TEMPLATE = lib
+
+QT += widgets svg
+
+CONFIG += c++14 staticlib
+
+INCLUDEPATH += $$PWD \
+ $$PWD/graphics/ \
+ $$PWD/../external/fancytabbar/
+
+SOURCES += parser.cpp \
+ mainwindow.cpp \
+ registerwidget.cpp \
+ programfiletab.cpp \
+ processortab.cpp \
+ memorytab.cpp \
+ memorymodel.cpp \
+ memorydisplaydelegate.cpp \
+ memoryview.cpp \
+ gotocombobox.cpp \
+ addressdialog.cpp \
+ codeeditor.cpp \
+ tabbar.cpp \
+ graphics/shape.cpp \
+ graphics/connection.cpp \
+ graphics/pipelinewidget.cpp \
+ registercontainerwidget.cpp \
+ aboutwidget.cpp \
+ graphics/backgrounditems.cpp \
+ instructionmodel.cpp \
+ pipeline.cpp \
+ pipelineobjects.cpp \
+ assembler.cpp \
+ syntaxhighlighter.cpp \
+ pipelinetable.cpp \
+ pipelinetablemodel.cpp \
+ rwjumpwidget.cpp \
+ rwjumpmodel.cpp \
+ rundialog.cpp \
+ binutils.cpp \
+
+HEADERS += \
+ parser.h \
+ defines.h \
+ mainwindow.h \
+ registerwidget.h \
+ programfiletab.h \
+ processortab.h \
+ memorytab.h \
+ memorymodel.h \
+ memorydisplaydelegate.h \
+ memoryview.h \
+ gotocombobox.h \
+ addressdialog.h \
+ addressdialog.h \
+ codeeditor.h \
+ tabbar.h \
+ graphics/shape.h \
+ graphics/connection.h \
+ graphics/pipelinewidget.h \
+ registercontainerwidget.h \
+ aboutwidget.h \
+ graphics/backgrounditems.h \
+ instructionmodel.h \
+ binutils.h \
+ pipelineobjects.h \
+ pipeline.h \
+ mainmemory.h \
+ assembler.h \
+ syntaxhighlighter.h \
+ pipelinetable.h \
+ pipelinetablemodel.h \
+ rwjumpwidget.h \
+ rwjumpmodel.h \
+ lexerutilities.h \
+ graphics/descriptions.h \
+ rundialog.h
+
+FORMS += \
+ mainwindow.ui \
+ registerwidget.ui \
+ programfiletab.ui \
+ processortab.ui \
+ memorytab.ui \
+ addressdialog.ui \
+ registercontainerwidget.ui \
+ aboutwidget.ui \
+ pipelinetable.ui \
+ rwjumpwidget.ui \
+ rundialog.ui
+
+# External
+DEFINES += QT_NO_PRINTER
+
+HEADERS += \
+ $$PWD/../external/fancytabbar/fancytab.h \
+ $$PWD/../external/fancytabbar/fancytabbar.h \
+
+
+SOURCES += \
+ $$PWD/../external/fancytabbar/fancytab.cpp \
+ $$PWD/../external/fancytabbar/fancytabbar.cpp \
+
+RESOURCES += \
+ $$PWD/../resources/images.qrc \
+ $$PWD/../examples/examples.qrc

Prepare project for unit-test executables

This commit splits the brunt of the Ripes application into a separate library,
which may then be linked to by a main file of a different Qt project file.
This commit allows introducing additional applications into the build,
required for adding unit test executable(s).