From 156cbb698e287c9da510204ffdbea063cce2a27e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 8 Apr 2016 22:16:30 +0200 Subject: Updated the README, changed the build system to use Qt 5. --- README | 22 ++++++++++++---------- configure.ac | 31 ++++++++++++++++++++----------- src/Makefile.am | 12 ++++++------ src/mainwindow.h | 2 +- src/settings.h | 2 +- src/solverwindow.cc | 2 +- src/sudokuwidget.h | 4 ++-- 7 files changed, 43 insertions(+), 32 deletions(-) diff --git a/README b/README index be089b2..711cd89 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ SUDOKU SOLVER - README I'm not a fervent sudoku solver but I always wanted to try implementing a program to solve the puzzles faster than I can. This is my first attempt. - This program uses the Qt 4.x library for its user interface, you will need + This program uses Qt 5 for its user interface, you will need to have it installed to build or run the program. BUILDING INSTRUCTIONS @@ -14,13 +14,13 @@ BUILDING INSTRUCTIONS autoreconf -i mkdir build cd build - ../configure + ../configure --with-qt-includes=/usr/include/qt make - The binary will be called 'sudokusolver' and be located in the 'src' directory. + The binary is called 'sudoku' and will be located in the 'src' directory. You can run it from within the build directory: - src/sudokusolver + src/sudoku USAGE @@ -60,7 +60,7 @@ USAGE SAVE GAME FILE FORMAT The file format is extremely simple: the files can be opened and edited - with a text editor. Note that unsolved positions are saved too + with a text editor. Unsolved positions are saved as well and are indicated by zeroes. Example: @@ -79,7 +79,7 @@ SAVE GAME FILE FORMAT While the file format is optimized for readability, the program will actually ignore extra whitespace while loading a file. This allows you to - load games from a simple file with a sequence if 81 numbers. + load games from a simple file with a sequence of 81 numbers. ALGORITHM @@ -87,17 +87,19 @@ ALGORITHM two sets of sudoko constraints: the sudoku elimination rules, where every number from 1 to 9 can only appear once in every row, column and subgrid, and the sudoko inclusion rules, where every number has to appear exactly once - in every row, column and subgrid, + in every row, column and subgrid. The search solver will apply constraints until there are no cells left with a unique solution. - From there, it will pick a random unsolved cell and fill it with one of the remaining possibilities. - From there it recurses into the next iteration. + From there, it will pick a random unsolved cell, fill it with one of the remaining possibilities + and recurse into the next iteration. COPYRIGHT This sudoku solver was written by Stijn "Ingar" Buys and is available under the terms and conditions of the GNU Public License, version 3 or higher. - Copyright (c) 2012-2013 + Copyright (c) 2012-2016 ingar@osirion.org + http://ingar.satgnu.net + diff --git a/configure.ac b/configure.ac index 999f166..ed07639 100644 --- a/configure.ac +++ b/configure.ac @@ -19,9 +19,9 @@ dnl AC_MSG_CHECKING(Qt installation prefix) QTDIR=xxx AC_ARG_WITH([qt-prefix], - AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt 4.8 installation prefix.]), + AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt installation prefix.]), [QTPATHS="$withval"], - [QTPATHS="/usr /usr/qt4 /opt/qt4"]) + [QTPATHS="/usr /usr/qt"]) for x in $QTPATHS; do if test -d $x ; then @@ -29,7 +29,7 @@ for x in $QTPATHS; do fi done if test $QTDIR = xxx ; then - AC_MSG_ERROR(Could not locate Qt 4.8) + AC_MSG_ERROR(Could not locate Qt) fi AC_MSG_RESULT($QTDIR) @@ -39,7 +39,7 @@ dnl AC_MSG_CHECKING(Qt includes directory) AC_ARG_WITH([qt-includes], - AC_HELP_STRING([--with-qt-includes=], [to specify the path to directory containing the Qt 4.8 includes.]), + AC_HELP_STRING([--with-qt-includes=], [to specify the path to directory containing the Qt includes.]), [QTINCLUDEDIR="$withval"], [QTINCLUDEDIR="$QTDIR/include"]) AC_MSG_RESULT($QTINCLUDEDIR) @@ -49,7 +49,7 @@ dnl libraries directory dnl AC_MSG_CHECKING(Qt libraries directory) AC_ARG_WITH([qt-libraries], - AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the Qt 4.8 libraries.]), + AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the Qt libraries.]), [QTLIBDIR="$withval"], [QTLIBDIR="$QTDIR/lib"]) AC_MSG_RESULT($QTLIBDIR) @@ -59,16 +59,16 @@ host=`uname -a` case "$host" in MINGW32*) AC_MSG_RESULT(win32) - QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQtGui4 -lQtCore4 -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" + QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQt5Widgets -lQt5Gui -lQt5Core -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtWidgets -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" QTBIN="$QTDIR/bin" EXEICON="icon.o" ;; *) AC_MSG_RESULT(generic unix) AC_PATH_XTRA - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtCore $X_CFLAGS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" - QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQtGui -lQtCore -lpthread" + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtWidgets -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" + QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQt5Widgets -lQt5Gui -lQt5Core -lpthread" QTBIN="$QTDIR/bin" EXEICON="" ;; @@ -81,7 +81,16 @@ INCLUDES="$INCLUDES $QTINC" PATH="$PATH:$QTBIN" CXXFLAGS="$CXXFLAGS $QTINC" -# Now we check whether we can actually build a Qt app. +AC_MSG_CHECKING(if the compiler accepts -fPIC) +SAVED_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS -fPIC" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], + [AC_MSG_RESULT(yes) + CXXFLAGS="$SAVED_CXXFLAGS -fPIC"], + [AC_MSG_RESULT(no) + CXXFLAGS="$SAVED_CXXFLAGS"]) + +dnl Now we check whether we can actually build a Qt app. cat > myqt.h << EOF #include class Test : public QObject @@ -162,4 +171,4 @@ libraries ................. $LIBS preprocessor flags ........ $CXXFLAGS compiler flags ............ $CXXFLAGS -]) \ No newline at end of file +]) diff --git a/src/Makefile.am b/src/Makefile.am index fbdb4a9..e49d55f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,10 +7,10 @@ moc_%.cc: %.h .rc.o: windres $< -o $@ -bin_PROGRAMS = sudokusolver +bin_PROGRAMS = sudoku # Project C++ source files -sudokusolver_SOURCES = \ +sudoku_SOURCES = \ cell.cc \ main.cc \ mainwindow.cc \ @@ -19,17 +19,17 @@ sudokusolver_SOURCES = \ sudoku.cc \ sudokuwidget.cc -EXTRA_sudokusolver_SOURCES = \ +EXTRA_sudoku_SOURCES = \ icon.rc -sudokusolver_DEPENDENCIES = \ +sudoku_DEPENDENCIES = \ $(EXEICON) -sudokusolver_LDADD =\ +sudoku_LDADD =\ $(EXEICON) # moc generated C++ source files -nodist_sudokusolver_SOURCES = \ +nodist_sudoku_SOURCES = \ moc_mainwindow.cc \ moc_solverwindow.cc \ moc_sudokuwidget.cc diff --git a/src/mainwindow.h b/src/mainwindow.h index f18d212..f4ec070 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -2,7 +2,7 @@ #ifndef __INCLUDED_SUDOKUSOLVER_MAINWINDOW__ #define __INCLUDED_SUDOKUSOLVER_MAINWINDOW__ -#include +#include #include class SudokuWidget; diff --git a/src/settings.h b/src/settings.h index 18c4437..d0e5982 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,7 +1,7 @@ #ifndef __INCLUDED_SUDOKUSOLVER_SETTINGS__ #define __INCLUDED_SUDOKUSOLVER_SETTINGS__ -#include +#include class Settings { public: diff --git a/src/solverwindow.cc b/src/solverwindow.cc index de768cf..38ade51 100644 --- a/src/solverwindow.cc +++ b/src/solverwindow.cc @@ -6,7 +6,7 @@ #include "config.h" -#include +#include #include #include #include diff --git a/src/sudokuwidget.h b/src/sudokuwidget.h index fb13234..b32d794 100644 --- a/src/sudokuwidget.h +++ b/src/sudokuwidget.h @@ -2,7 +2,7 @@ #ifndef __INCLUDED_SUDOKUSOLVER_SUDOKUWIDGET__ #define __INCLUDED_SUDOKUSOLVER_SUDOKUWIDGET__ -#include +#include #include #include "sudoku.h" @@ -60,4 +60,4 @@ private slots: void verify(const QString & text); }; -#endif // __INCLUDED_SUDOKUSOLVER_SUDOKUWIDGET__ \ No newline at end of file +#endif // __INCLUDED_SUDOKUSOLVER_SUDOKUWIDGET__ -- cgit v1.2.3