From 909c37b77534b88eeafac7a03286692c31cbb1ef Mon Sep 17 00:00:00 2001 From: John Fultz Date: Tue, 18 Aug 2015 10:37:11 -0500 Subject: Migrate gaddag maker into quackleio. Prepping to build the gaddag maker into the quacker ui. Built a new class called GaddagFactory to do this and cleaned up the code a bit. makegaddag still builds exactly as it did before. --- makegaddag/makegaddag.cpp | 199 +++------------------------------------------- 1 file changed, 12 insertions(+), 187 deletions(-) (limited to 'makegaddag/makegaddag.cpp') diff --git a/makegaddag/makegaddag.cpp b/makegaddag/makegaddag.cpp index 8e2ffac..b8fe276 100644 --- a/makegaddag/makegaddag.cpp +++ b/makegaddag/makegaddag.cpp @@ -29,79 +29,12 @@ #include -#include -#include -#include -#include +#include "quackleio/froggetopt.h" +#include "quackleio/gaddagfactory.h" +#include "quackleio/util.h" using namespace std; -class Node { - public: - Quackle::Letter c; - bool t; - vector children; - int pointer; - bool lastchild; - void pushword(Quackle::LetterString word); - void print(Quackle::LetterString prefix); -}; - -vector< Node* > nodelist; - -void Node::print(Quackle::LetterString prefix) { - if (t) { - //UVcout << QUACKLE_ALPHABET_PARAMETERS->userVisible(prefix)) << endl; - } - - // UVcout << "prefix: " << QUACKLE_ALPHABET_PARAMETERS->userVisible(prefix) << ", children: " << children.size() << endl; - - if (children.size() > 0) { - pointer = nodelist.size(); - children[children.size() - 1].lastchild = true; - } - - for (size_t i = 0; i < children.size(); i++) { - nodelist.push_back(&children[i]); - } - - for (size_t i = 0; i < children.size(); i++) { - children[i].print(prefix + children[i].c); - } -} - - -void Node::pushword(Quackle::LetterString word) { - if (word.length() == 0) { - t = true; - } - else { - Quackle::Letter first = Quackle::String::front(word); - Quackle::LetterString rest = Quackle::String::allButFront(word); - int index = -1; - - // cout << "first: " << first << ", rest: " << rest << endl; - - for (size_t i = 0; i < children.size(); i++) { - if (children[i].c == first) { - index = i; - i = children.size(); - } - } - - if (index == -1) { - Node n; - n.c = first; - n.t = false; - n.pointer = 0; - n.lastchild = false; - children.push_back(n); - index = children.size() - 1; - } - - children[index].pushword(rest); - } -} int main(int argc, char **argv) @@ -127,21 +60,9 @@ int main(int argc, char **argv) if (outputFilename.isNull()) outputFilename = "output.gaddag"; - Quackle::AlphabetParameters *alphas = 0; QString alphabetFile = QString("../data/alphabets/%1.quackle_alphabet").arg(alphabet); UVcout << "Using alphabet file: " << QuackleIO::Util::qstringToString(alphabetFile) << endl; - QuackleIO::FlexibleAlphabetParameters *flexure = new QuackleIO::FlexibleAlphabetParameters; - flexure->load(alphabetFile); - alphas = flexure; - - // So the separator is sorted to last. - Quackle::Letter internalSeparatorRepresentation = QUACKLE_FIRST_LETTER + QUACKLE_MAXIMUM_ALPHABET_SIZE; - - Node root; - root.t = false; - root.c = QUACKLE_NULL_MARK; // "_" - root.pointer = 0; - root.lastchild = true; + GaddagFactory factory(alphabetFile); QFile file(inputFilename); if (!file.exists()) @@ -159,11 +80,6 @@ int main(int argc, char **argv) QTextStream stream(&file); stream.setCodec(QTextCodec::codecForName("UTF-8")); - int encodableWords = 0; - int unencodableWords = 0; - - Quackle::WordList gaddagizedWords; - while (!stream.atEnd()) { QString originalQString; @@ -172,115 +88,24 @@ int main(int argc, char **argv) if (stream.atEnd()) break; - UVString originalString = QuackleIO::Util::qstringToString(originalQString); - - UVString leftover; - Quackle::LetterString encodedWord = alphas->encode(originalString, &leftover); - if (leftover.empty()) - { - //for (Quackle::LetterString::iterator it = encodedWord.begin(); it != encodedWord.end(); ++it) - //UVcout << "got encoded letter: " << (int)(*it) << endl; - - ++encodableWords; - - for (unsigned i = 1; i <= encodedWord.length(); i++) { - Quackle::LetterString newword; - - for (int j = i - 1; j >= 0; j--) { - newword.push_back(encodedWord[j]); - } - - if (i < encodedWord.length()) { - newword.push_back(internalSeparatorRepresentation); // "^" - for (unsigned j = i; j < encodedWord.length(); j++) { - newword.push_back(encodedWord[j]); - } - } - gaddagizedWords.push_back(newword); - } - } - else - { - UVcout << "not encodable without leftover: " << originalString << endl; - ++unencodableWords; - } + factory.pushWord(originalQString); } - UVcout << "Sorting " << gaddagizedWords.size () << " words..." << endl; - sort(gaddagizedWords.begin(), gaddagizedWords.end()); + UVcout << "Sorting " << factory.wordCount() << " words..." << endl; + factory.sortWords(); UVcout << "Generating nodes..."; - Quackle::WordList::const_iterator wordsEnd = gaddagizedWords.end(); - for (Quackle::WordList::const_iterator wordsIt = gaddagizedWords.begin(); wordsIt != wordsEnd; ++wordsIt) - { - root.pushword(*wordsIt); - } + factory.generate(); UVcout << "Writing index..."; - - nodelist.push_back(&root); - - root.print(""); - - ofstream out(QuackleIO::Util::qstringToStdString(outputFilename).c_str(), ios::out | ios::binary); - - for (size_t i = 0; i < nodelist.size(); i++) { - // UVcout << nodelist[i]->c << " " << nodelist[i]->pointer << " " << nodelist[i]->t << " " << nodelist[i]->lastchild << endl; - - unsigned int p = (unsigned int)(nodelist[i]->pointer); - if (p != 0) { - p -= i; // offset indexing - } - - char bytes[4]; - unsigned char n1 = (p & 0x00FF0000) >> 16; - /* - UVcout << "byte 1: " << ((p & 0xFF000000) >> 24); - UVcout << ", byte 2: " << ((p & 0x00FF0000) >> 8); - UVcout << ", byte 3: " << ((p & 0x0000FF00) >> 8); - UVcout << ", byte 4: " << ((p & 0x000000FF) >> 0) << endl; - */ - - unsigned char n2 = (p & 0x0000FF00) >> 8; - unsigned char n3 = (p & 0x000000FF) >> 0; - unsigned char n4; - - /* - UVcout << "p: " << p << ", crap: " << (((unsigned int)(n1) << 24) | - ((unsigned int)(n2) << 16) | - ((unsigned int)(n3) << 8)) << endl; - */ - n4 = nodelist[i]->c; - if (n4 == internalSeparatorRepresentation) - n4 = QUACKLE_GADDAG_SEPARATOR; - - if (nodelist[i]->t) { - n4 |= 64; - } - if (nodelist[i]->lastchild) { - n4 |= 128; - } - - /* - UVcout << "p: " << p << endl;; - UVcout << "n4:" << (int)(n4) << - ", n1: " << (int)(n1) << - ", n2: " << (int)(n2) << - ", n3: " << (int)(n3) << endl; - */ - - //bytes[0] = n4; bytes[1] = n1; bytes[2] = n2; bytes[3] = n3; - bytes[0] = n1; bytes[1] = n2; bytes[2] = n3; bytes[3] = n4; - //out.write((const char*) &p, 4); - out.write(bytes, 4); - } + factory.writeIndex(outputFilename); UVcout << endl; - UVcout << "Wrote " << encodableWords << " words over " << nodelist.size() << " nodes to " << QuackleIO::Util::qstringToString(outputFilename) << "." << endl; + UVcout << "Wrote " << factory.encodableWords() << " words over " << factory.nodeCount() << " nodes to " << QuackleIO::Util::qstringToString(outputFilename) << "." << endl; - if (unencodableWords > 0) - UVcout << "There were " << unencodableWords << " words left out." << endl; + if (factory.unencodableWords() > 0) + UVcout << "There were " << factory.unencodableWords() << " words left out." << endl; return 0; } -- cgit v1.2.3 From 4ef5b33708a4ff0435d5c8254b860cd03a264c66 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Thu, 20 Aug 2015 04:49:46 -0500 Subject: Bug fixes to GaddagFactory A few things from my last commit needed to be fixed or improved. --- gaddagize/.gitignore | 1 + makegaddag/makegaddag.cpp | 3 ++- quackle.sublime-project | 3 ++- quackleio/gaddagfactory.cpp | 24 ++++++++++++++---------- quackleio/gaddagfactory.h | 13 ++++++++++--- 5 files changed, 29 insertions(+), 15 deletions(-) (limited to 'makegaddag/makegaddag.cpp') diff --git a/gaddagize/.gitignore b/gaddagize/.gitignore index f878785..3c70113 100644 --- a/gaddagize/.gitignore +++ b/gaddagize/.gitignore @@ -4,3 +4,4 @@ Makefile.Debug Makefile.Release debug release +gaddagize diff --git a/makegaddag/makegaddag.cpp b/makegaddag/makegaddag.cpp index b8fe276..dc38a5f 100644 --- a/makegaddag/makegaddag.cpp +++ b/makegaddag/makegaddag.cpp @@ -88,7 +88,8 @@ int main(int argc, char **argv) if (stream.atEnd()) break; - factory.pushWord(originalQString); + if (!factory.pushWord(originalQString)) + UVcout << "not encodable without leftover: " << QuackleIO::Util::qstringToString(originalQString) << endl; } UVcout << "Sorting " << factory.wordCount() << " words..." << endl; diff --git a/quackle.sublime-project b/quackle.sublime-project index a219eb1..2ca8db5 100644 --- a/quackle.sublime-project +++ b/quackle.sublime-project @@ -5,7 +5,8 @@ "path": ".", "file_exclude_patterns" : ["*.tgz", "*.sublime-workspace", ".tags*", "dawginput.raw", "playabilities.raw", "smaller.raw", ".gitattributes", - "*.Debug", "*.Release", "*.pfx", "*.cer"], + "*.Debug", "*.Release", "*.pfx", "*.cer", + "makegaddag", "makeminidawg", "gaddagize", "Makefile"], "folder_exclude_patterns" : ["obj", "moc", "build", "*.xcodeproj", "lib", "lexica", "strategy", "debug", "release", "makeswelexicon", "lisp", "DerivedData"] } diff --git a/quackleio/gaddagfactory.cpp b/quackleio/gaddagfactory.cpp index 3a608f0..e2c726d 100644 --- a/quackleio/gaddagfactory.cpp +++ b/quackleio/gaddagfactory.cpp @@ -36,7 +36,12 @@ GaddagFactory::GaddagFactory(const QString& alphabetFile) root.lastchild = true; } -void GaddagFactory::pushWord(const QString& word) +GaddagFactory::~GaddagFactory() +{ + delete alphas; +} + +bool GaddagFactory::pushWord(const QString& word) { UVString originalString = QuackleIO::Util::qstringToString(word); @@ -61,12 +66,11 @@ void GaddagFactory::pushWord(const QString& word) } gaddagizedWords.push_back(newword); } + return true; } - else - { - UVcout << "not encodable without leftover: " << originalString << endl; - ++m_unencodableWords; - } + + ++m_unencodableWords; + return false; } void GaddagFactory::generate() @@ -82,7 +86,7 @@ void GaddagFactory::writeIndex(const QString& fname) { nodelist.push_back(&root); - root.print(nodelist, ""); + root.print(nodelist); ofstream out(QuackleIO::Util::qstringToStdString(fname).c_str(), ios::out | ios::binary); @@ -114,7 +118,7 @@ void GaddagFactory::writeIndex(const QString& fname) } -void GaddagFactory::Node::print(vector< Node* > nodelist, Quackle::LetterString prefix) +void GaddagFactory::Node::print(vector< Node* >& nodelist) { if (children.size() > 0) { @@ -126,11 +130,11 @@ void GaddagFactory::Node::print(vector< Node* > nodelist, Quackle::LetterString nodelist.push_back(&children[i]); for (size_t i = 0; i < children.size(); i++) - children[i].print(nodelist, prefix + children[i].c); + children[i].print(nodelist); } -void GaddagFactory::Node::pushWord(Quackle::LetterString word) +void GaddagFactory::Node::pushWord(const Quackle::LetterString& word) { if (word.length() == 0) { diff --git a/quackleio/gaddagfactory.h b/quackleio/gaddagfactory.h index ca3bc40..9eb8d72 100644 --- a/quackleio/gaddagfactory.h +++ b/quackleio/gaddagfactory.h @@ -16,6 +16,9 @@ * along with this program. If not, see . */ +#ifndef QUACKLE_GADDAGFACTORY_H +#define QUACKLE_GADDAGFACTORY_H + #include "flexiblealphabet.h" @@ -25,13 +28,14 @@ public: static const Quackle::Letter internalSeparatorRepresentation = QUACKLE_FIRST_LETTER + QUACKLE_MAXIMUM_ALPHABET_SIZE; GaddagFactory(const QString& alphabetFile); + ~GaddagFactory(); int wordCount() const { return gaddagizedWords.size(); }; int nodeCount() const { return nodelist.size(); }; int encodableWords() const { return m_encodableWords; }; int unencodableWords() const { return m_unencodableWords; }; - void pushWord(const QString& word); + bool pushWord(const QString& word); void sortWords() { sort(gaddagizedWords.begin(), gaddagizedWords.end()); }; void generate(); void writeIndex(const QString& fname); @@ -44,8 +48,8 @@ private: vector children; int pointer; bool lastchild; - void pushWord(Quackle::LetterString word); - void print(vector< Node* > nodelist, Quackle::LetterString prefix); + void pushWord(const Quackle::LetterString& word); + void print(vector< Node* >& nodelist); }; int m_encodableWords; @@ -57,3 +61,6 @@ private: }; + +#endif + -- cgit v1.2.3 From 9ea9637922ca68d24d7517cf61870d8cee31f6c5 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Sun, 30 Aug 2015 09:21:26 -0500 Subject: Add hash query methods for dawgs, gaddags. --- lexiconparameters.cpp | 4 ++++ lexiconparameters.h | 3 +++ makegaddag/makegaddag.cpp | 2 ++ makeminidawg/makeminidawgmain.cpp | 2 ++ quackleio/dawgfactory.h | 2 ++ quackleio/gaddagfactory.h | 3 +++ 6 files changed, 16 insertions(+) (limited to 'makegaddag/makegaddag.cpp') diff --git a/lexiconparameters.cpp b/lexiconparameters.cpp index e014048..f6e646b 100644 --- a/lexiconparameters.cpp +++ b/lexiconparameters.cpp @@ -203,3 +203,7 @@ string LexiconParameters::findDictionaryFile(const string &lexicon) return DataManager::self()->findDataFile("lexica", lexicon); } +QString hashString() const +{ + return QString(QByteArray(m_hash, sizeof(m_hash)).toHex()); +} diff --git a/lexiconparameters.h b/lexiconparameters.h index 04ad4e7..b5bc564 100644 --- a/lexiconparameters.h +++ b/lexiconparameters.h @@ -19,6 +19,7 @@ #ifndef QUACKLE_LEXICONPARAMETERS_H #define QUACKLE_LEXICONPARAMETERS_H +#include #include "alphabetparameters.h" #include "gaddag.h" @@ -76,6 +77,8 @@ public: } const GaddagNode *gaddagRoot() const { return (GaddagNode *) &m_gaddag[0]; }; + QString hashString() const; + protected: unsigned char *m_dawg; unsigned char *m_gaddag; diff --git a/makegaddag/makegaddag.cpp b/makegaddag/makegaddag.cpp index dc38a5f..7a768cd 100644 --- a/makegaddag/makegaddag.cpp +++ b/makegaddag/makegaddag.cpp @@ -105,6 +105,8 @@ int main(int argc, char **argv) UVcout << "Wrote " << factory.encodableWords() << " words over " << factory.nodeCount() << " nodes to " << QuackleIO::Util::qstringToString(outputFilename) << "." << endl; + UVcout << "Hash: " << QString(QByteArray(factory.hashBytes(), 16).toHex()).toStdString() << endl; + if (factory.unencodableWords() > 0) UVcout << "There were " << factory.unencodableWords() << " words left out." << endl; diff --git a/makeminidawg/makeminidawgmain.cpp b/makeminidawg/makeminidawgmain.cpp index 89afb68..eee2b37 100644 --- a/makeminidawg/makeminidawgmain.cpp +++ b/makeminidawg/makeminidawgmain.cpp @@ -138,6 +138,8 @@ int main(int argc, char **argv) factory.generate(); UVcout << "Compressed nodelist.size(): " << factory.nodeCount() << endl; + UVcout << "Hash: " << QString(QByteArray(factory.hashBytes(), 16).toHex()).toStdString() << endl; + factory.writeIndex("output.dawg"); return 0; diff --git a/quackleio/dawgfactory.h b/quackleio/dawgfactory.h index 13837c4..23bb4f5 100644 --- a/quackleio/dawgfactory.h +++ b/quackleio/dawgfactory.h @@ -40,6 +40,8 @@ public: void generate(); void writeIndex(const QString& fname); + const char* hashBytes() { return m_hash.charptr; }; + private: class Node { public: diff --git a/quackleio/gaddagfactory.h b/quackleio/gaddagfactory.h index 2d21192..03cb546 100644 --- a/quackleio/gaddagfactory.h +++ b/quackleio/gaddagfactory.h @@ -41,6 +41,9 @@ public: void generate(); void writeIndex(const QString& fname); + const char* hashBytes() { return m_hash.charptr; }; + + private: class Node { public: -- cgit v1.2.3 From 86e8d2a1247e8c6b00cefda10b2a96376a1540ca Mon Sep 17 00:00:00 2001 From: John Fultz Date: Wed, 14 Oct 2015 04:37:27 -0500 Subject: Windows build fixes. --- encodeleaves/encodeleaves.pro | 10 +++++++--- makegaddag/makegaddag.cpp | 6 +++--- makegaddag/makegaddag.pro | 10 +++++++--- makeminidawg/makeminidawg.pro | 10 +++++++--- makeminidawg/makeminidawgmain.cpp | 2 +- quacker/quacker.pro | 11 ++++------- quackle.pro | 2 ++ quackleio/dawgfactory.h | 3 ++- quackleio/gaddagfactory.h | 3 ++- quackleio/iotest/iotest.pro | 10 +++++++--- quackleio/quackleio.pro | 2 ++ test/test.pro | 10 +++++++--- 12 files changed, 51 insertions(+), 28 deletions(-) (limited to 'makegaddag/makegaddag.cpp') diff --git a/encodeleaves/encodeleaves.pro b/encodeleaves/encodeleaves.pro index f1a51bb..559df28 100644 --- a/encodeleaves/encodeleaves.pro +++ b/encodeleaves/encodeleaves.pro @@ -11,16 +11,20 @@ CONFIG -= app_bundle debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug } release { OBJECTS_DIR = obj/release + QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release } -LIBS += -lquackleio -lquackle +win32:!win32-g++ { + LIBS += -lquackleio -llibquackle +} else { + LIBS += -lquackleio -lquackle +} -QMAKE_LFLAGS_RELEASE += -L../lib/release -L../quackleio/lib/release -QMAKE_LFLAGS_DEBUG += -L../lib/debug -L../quackleio/lib/debug # Input SOURCES += encodeleaves.cpp diff --git a/makegaddag/makegaddag.cpp b/makegaddag/makegaddag.cpp index 7a768cd..ef2c439 100644 --- a/makegaddag/makegaddag.cpp +++ b/makegaddag/makegaddag.cpp @@ -62,7 +62,7 @@ int main(int argc, char **argv) QString alphabetFile = QString("../data/alphabets/%1.quackle_alphabet").arg(alphabet); UVcout << "Using alphabet file: " << QuackleIO::Util::qstringToString(alphabetFile) << endl; - GaddagFactory factory(alphabetFile); + GaddagFactory factory(QuackleIO::Util::qstringToString(alphabetFile)); QFile file(inputFilename); if (!file.exists()) @@ -88,7 +88,7 @@ int main(int argc, char **argv) if (stream.atEnd()) break; - if (!factory.pushWord(originalQString)) + if (!factory.pushWord(QuackleIO::Util::qstringToString(originalQString))) UVcout << "not encodable without leftover: " << QuackleIO::Util::qstringToString(originalQString) << endl; } @@ -99,7 +99,7 @@ int main(int argc, char **argv) factory.generate(); UVcout << "Writing index..."; - factory.writeIndex(outputFilename); + factory.writeIndex(outputFilename.toUtf8().constData()); UVcout << endl; diff --git a/makegaddag/makegaddag.pro b/makegaddag/makegaddag.pro index dfd1259..9895c99 100755 --- a/makegaddag/makegaddag.pro +++ b/makegaddag/makegaddag.pro @@ -5,10 +5,12 @@ CONFIG += release debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug } release { OBJECTS_DIR = obj/release + QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release } MOC_DIR = moc @@ -19,10 +21,12 @@ MOC_DIR = moc CONFIG += console CONFIG -= app_bundle -LIBS += -lquackleio -lquackle +win32:!win32-g++ { + LIBS += -lquackleio -llibquackle +} else { + LIBS += -lquackleio -lquackle +} -QMAKE_LFLAGS_RELEASE += -L../lib/release -L../quackleio/lib/release -QMAKE_LFLAGS_DEBUG += -L../lib/debug -L../quackleio/lib/debug # Input SOURCES += makegaddag.cpp diff --git a/makeminidawg/makeminidawg.pro b/makeminidawg/makeminidawg.pro index 729e6b4..e728a8a 100644 --- a/makeminidawg/makeminidawg.pro +++ b/makeminidawg/makeminidawg.pro @@ -12,16 +12,20 @@ CONFIG -= app_bundle debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug } release { OBJECTS_DIR = obj/release + QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release } -LIBS += -lquackleio -lquackle +win32:!win32-g++ { + LIBS += -lquackleio -llibquackle +} else { + LIBS += -lquackleio -lquackle +} -QMAKE_LFLAGS_RELEASE += -L../lib/release -L../quackleio/lib/release -QMAKE_LFLAGS_DEBUG += -L../lib/debug -L../quackleio/lib/debug # Input HEADERS += diff --git a/makeminidawg/makeminidawgmain.cpp b/makeminidawg/makeminidawgmain.cpp index eee2b37..dfd3c82 100644 --- a/makeminidawg/makeminidawgmain.cpp +++ b/makeminidawg/makeminidawgmain.cpp @@ -125,7 +125,7 @@ int main(int argc, char **argv) if (stream.atEnd()) break; - if (!factory.pushWord(word, inSmaller, pb)) + if (!factory.pushWord(QuackleIO::Util::qstringToString(word), inSmaller, pb)) UVcout << "not encodable without leftover: " << QuackleIO::Util::qstringToString(word) << endl; } diff --git a/quacker/quacker.pro b/quacker/quacker.pro index 9906e45..8bd1e4f 100644 --- a/quacker/quacker.pro +++ b/quacker/quacker.pro @@ -12,17 +12,12 @@ CONFIG += release debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug } release { OBJECTS_DIR = obj/release -} - -debug { - QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug -} -release { - QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release + QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release } win32:!win32-g++ { @@ -32,6 +27,8 @@ win32:!win32-g++ { } macx:LIBS += -framework CoreFoundation +QMAKE_CXXFLAGS += -std=c++11 + # Input HEADERS += *.h SOURCES += *.cpp diff --git a/quackle.pro b/quackle.pro index 18d9a33..4bd40f4 100644 --- a/quackle.pro +++ b/quackle.pro @@ -17,6 +17,8 @@ release { DESTDIR = lib/release } +QMAKE_CXXFLAGS += -std=c++11 + # enable/disable debug symbols #CONFIG += debug staticlib CONFIG += release staticlib diff --git a/quackleio/dawgfactory.h b/quackleio/dawgfactory.h index efcc455..7af4d68 100644 --- a/quackleio/dawgfactory.h +++ b/quackleio/dawgfactory.h @@ -19,6 +19,7 @@ #ifndef QUACKLE_DAWGFACTORY_H #define QUACKLE_DAWGFACTORY_H +#include #include #include #include "flexiblealphabet.h" @@ -82,7 +83,7 @@ private: Node m_root; union { char charptr[16]; - int32_t int32ptr[4]; + std::int32_t int32ptr[4]; } m_hash; static const char m_versionNumber = 1; diff --git a/quackleio/gaddagfactory.h b/quackleio/gaddagfactory.h index 415baff..3017085 100644 --- a/quackleio/gaddagfactory.h +++ b/quackleio/gaddagfactory.h @@ -19,6 +19,7 @@ #ifndef QUACKLE_GADDAGFACTORY_H #define QUACKLE_GADDAGFACTORY_H +#include #include "flexiblealphabet.h" @@ -65,7 +66,7 @@ private: Node m_root; union { char charptr[16]; - int32_t int32ptr[4]; + std::int32_t int32ptr[4]; } m_hash; }; diff --git a/quackleio/iotest/iotest.pro b/quackleio/iotest/iotest.pro index 0bf472e..c7e994f 100644 --- a/quackleio/iotest/iotest.pro +++ b/quackleio/iotest/iotest.pro @@ -8,16 +8,20 @@ CONFIG += release debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../../lib/debug ../../quackleio/lib/debug } release { OBJECTS_DIR = obj/release + QMAKE_LIBDIR += ../../lib/release ../../quackleio/lib/release } -LIBS += -lquackleio -lquackle +win32:!win32-g++ { + LIBS += -lquackleio -llibquackle +} else { + LIBS += -lquackleio -lquackle +} -QMAKE_LFLAGS_RELEASE += -L../../lib/release -L../../quackleio/lib/release -QMAKE_LFLAGS_DEBUG += -L../../lib/debug -L../../quackleio/lib/debug # Input HEADERS += trademarkedboards.h diff --git a/quackleio/quackleio.pro b/quackleio/quackleio.pro index 195b0ad..8e43d29 100644 --- a/quackleio/quackleio.pro +++ b/quackleio/quackleio.pro @@ -15,6 +15,8 @@ release { MOC_DIR = moc +QMAKE_CXXFLAGS += -std=c++11 + # enable/disable debug symbols #CONFIG += debug staticlib CONFIG += release staticlib diff --git a/test/test.pro b/test/test.pro index 0284f47..99a378e 100644 --- a/test/test.pro +++ b/test/test.pro @@ -12,16 +12,20 @@ CONFIG += release debug { OBJECTS_DIR = obj/debug + QMAKE_LIBDIR += ../lib/debug ../quackleio/lib/debug } release { OBJECTS_DIR = obj/release + QMAKE_LIBDIR += ../lib/release ../quackleio/lib/release } -LIBS += -lquackleio -lquackle +win32:!win32-g++ { + LIBS += -lquackleio -llibquackle +} else { + LIBS += -lquackleio -lquackle +} -QMAKE_LFLAGS_RELEASE += -L../lib/release -L../quackleio/lib/release -QMAKE_LFLAGS_DEBUG += -L../lib/debug -L../quackleio/lib/debug # Input HEADERS += testharness.h trademarkedboards.h -- cgit v1.2.3