Add a manual build script. Fix missing returns and a bad include.

master
poikilos 2021-02-18 11:20:12 -05:00
parent 83be25ec82
commit c9cfbfc87c
6 changed files with 79 additions and 7 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ CMakeLists.txt.user
# dev generated files
nohup.out
*.tmp
err.txt

View File

@ -1,5 +1,5 @@
#include "EventHandler.h"
#include <Utility.h>
#include "Utility.h"
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>

67
build.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
if [ -z "$PREFIX" ]; then
PREFIX="/usr"
fi
#IRR_INCDIR=
#IRR_LIBDIR=
FT2_INCDIR=$PREFIX/include/freetype2
OUT_BIN=build/b3view
#FT2_LIBDIR=
OBJDIR="./build/tmp"
# ^ build is in .gitignore
if [ ! -d "$OBJDIR" ]; then
mkdir -p "$OBJDIR"
fi
# only for pc file if exists for irrlicht:
#if [ -z "$PKG_CONFIG_PATH" ]; then
# PKG_CONFIG_PATH=$IRR_PATH
#else
# PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$IRR_PATH
#fi
#gcc -o build/b3view main.cpp Debug.cpp Engine.cpp EventHandler.cpp settings.cpp UserInterface.cpp Utility.cpp View.cpp $(pkg-config --libs --cflags irrlicht --cflags freetype2)
#^ can't find a pc file
# gcc -o build/b3view main.cpp Debug.cpp Engine.cpp EventHandler.cpp settings.cpp UserInterface.cpp Utility.cpp View.cpp -I$FT2_INCDIR
# Qmake does the following:
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/main.o ../b3view/main.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/Engine.o ../b3view/Engine.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/EventHandler.o ../b3view/EventHandler.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/UserInterface.o ../b3view/UserInterface.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/Debug.o ../b3view/Debug.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/View.o ../b3view/View.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/CGUITTFont.o ../b3view/extlib/CGUITTFont.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/Utility.o ../b3view/Utility.cpp
#g++ -c -pipe -g -w -fPIC -DQT_QML_DEBUG -I../b3view -I. -I/usr/include/freetype2 -I/../lib64/qt5/mkspecs/linux-g++ -o tmp/settings.o ../b3view/settings.cpp
#g++ -o build/b3view tmp/main.o tmp/Engine.o tmp/EventHandler.o tmp/UserInterface.o tmp/Debug.o tmp/View.o tmp/CGUITTFont.o tmp/Utility.o tmp/settings.o -lIrrlicht -lX11 -lGL -lXxf86vm -lXcursor -lstdc++fs -lfreetype
# based on the above (some options are unclear):
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/main.o ../b3view/main.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/Engine.o ../b3view/Engine.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/EventHandler.o ../b3view/EventHandler.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/UserInterface.o ../b3view/UserInterface.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/View.o ../b3view/View.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/Debug.o ../b3view/Debug.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/CGUITTFont.o ../b3view/extlib/CGUITTFont.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/Utility.o ../b3view/Utility.cpp
g++ -c -pipe -g -fPIC -I../b3view -I$FT2_INCDIR -o $OBJDIR/settings.o ../b3view/settings.cpp
#-w: suppress warning
# -I.: include the current directory (suppresses errors when using include < instead of include "
#-pipe: "Use pipes rather than intermediate files."
#Options starting with -g, -f, -m, -O, -W, or --param are automatically
# passed on to the various sub-processes invoked by g++. In order to pass
# other options on to these processes the -W<letter> options must be used.
rm "$OUT_BIN"
if [ -f "$OUT_BIN" ]; then
echo "Error: $OUT_BIN couldn't be deleted."
exit 1
fi
g++ -o build/b3view $OBJDIR/main.o $OBJDIR/Engine.o $OBJDIR/EventHandler.o $OBJDIR/UserInterface.o $OBJDIR/Debug.o $OBJDIR/View.o $OBJDIR/CGUITTFont.o $OBJDIR/Utility.o $OBJDIR/settings.o -lIrrlicht -lX11 -lGL -lXxf86vm -lXcursor -lstdc++fs -lfreetype
if [ ! -f "$OUT_BIN" ]; then
echo "Error: $OUT_BIN couldn't be built."
exit 1
else
echo "Building $OUT_BIN is complete."
fi

View File

@ -1 +0,0 @@
/home/owner/git/build-b3view-Desktop-Release/build/b3view

BIN
build/b3view Executable file

Binary file not shown.

View File

@ -48,6 +48,7 @@ void Settings::clear_types()
bool Settings::load(std::string path)
{
bool readable = false;
this->section = "";
this->path = path;
fstream newfile;
@ -135,13 +136,16 @@ bool Settings::load(std::string path)
}
}
newfile.close();
readable = true;
}
this->section = "";
this->pre = "";
return readable;
}
bool Settings::save(std::string path)
{
bool ok = true;
this->path = path;
ofstream myfile;
myfile.open(path, ios::out); // default is ios_base::out
@ -171,7 +175,7 @@ bool Settings::save(std::string path)
}
}
myfile.close();
return true;
return ok;
}
bool Settings::save()
@ -179,17 +183,17 @@ bool Settings::save()
if (this->path.length() == 0) {
throw std::string("There is no path during save().");
}
this->save(this->path);
return this->save(this->path);
}
string Settings::ao_trimmed()
{
Utility::trim(this->ao_and_spacing);
return Utility::trim(this->ao_and_spacing);
}
string Settings::cm_trimmed()
{
Utility::trim(this->cm_and_spacing);
return Utility::trim(this->cm_and_spacing);
}
bool Settings::check_type(std::string typeStr, std::string name)
@ -230,7 +234,7 @@ void Settings::set_cm_and_spacing(std::string commentMark)
this->cm_and_spacing = commentMark;
}
bool Settings::set_all_auto(std::map<std::string, std::string> table)
void Settings::set_all_auto(std::map<std::string, std::string> table)
{
std::map<std::string, std::string>::iterator it;
for (it = table.begin(); it != table.end(); it++) {

View File

@ -36,7 +36,7 @@ public:
bool exists(std::string name);
void set_ao_and_spacing(std::string assignmentOperator);
void set_cm_and_spacing(std::string commentMark);
bool set_all_auto(std::map<std::string, std::string> table);
void set_all_auto(std::map<std::string, std::string> table);
void set_section(std::string sectionName);
void set_raw(std::string name, std::string value);
bool set(std::string name, std::string value);