win32 support

- support for win graphic console
- correct versioning
- document mkwin script
This commit is contained in:
vscosta 2014-11-04 01:27:58 +00:00
parent 83a34ad849
commit 58734fe2e7
7 changed files with 100 additions and 10 deletions

View File

@ -511,13 +511,13 @@ JIT_Compiler.o: IT/JIT_Compiler.cpp
$(CC) -c $(CFLAGS) $< -o $@
pl-ntcon.o: console/LGPL/pl-ntcon.c config.h
$(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include $< -o $@
$(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir)/include $< -o $@
pl-ntconsole.o: console/LGPL/pl-ntconsole.c config.h
$(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@
$(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@
pl-ntmain.o: console/LGPL/pl-ntmain.c config.h
$(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@
$(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@
yapres.o: console/LGPL/yap.rc console/LGPL/manifest.xml config.h
$(RC) $(RCFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I. -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os -I$(srcdir)/console/LGPL @EXTRA_INCLUDES_FOR_WIN32@ -i $< -o $@

View File

@ -28,7 +28,7 @@
#define MAX_FILE_NAME 1024
#include "config.h"
#include "console/LGPL/resource.h"
#ifdef THREADSx
#ifdef THREADS
#define O_PLMT 1
#endif
#else
@ -1087,7 +1087,7 @@ set_window_title(rlc_console c)
int v = (int)PL_query(PL_QUERY_VERSION);
int major = v / 10000;
int minor = (v / 100) % 100;
int patch = v % 100;
int patch = v / 100;
#ifdef O_PLMT
TCHAR *mt = _T("Multi-threaded, ");
#else

83
misc/mkwin.md Normal file
View File

@ -0,0 +1,83 @@
AT the time of this writing (Nov 2014), YAP uses the mkwin script to
compile in WIN32. The script requires either a WIN32 environment, or a
cross-compiler/emulator package.
YAP has been known to compile under VISUAL C++, and should compile and
work under cygwin, but the favorite approach is to use a native
msys/mingw environment. This approach has two key advantages:
+ it does not need an interface layer and a DLL, like cygwin.
+ it enables cross-compilation.
YAP uses rge `mkwin` script to generate a new YAP installer. The script is
controlled by a set of of variables that should be defined early on in
the text. It executes by first calling `configure`, next running `make`, and
last (if all went well) executing `nsys`.
In more detail, the following mingw based environments have been
tested to develop YAP:
* MSYS 1 and mingw32/64: most WIN32 development did occur in this
native environment. Best results were achieved with
MSYS-1.0.* and TDM-GCC:
mingw: http://www.mingw.org/
original msys: http://www.mingw.org/wiki/MSYS
mingw64: http://mingw-w64.sourceforge.net/
TDM-GCC: http://tdm-gcc.tdragon.net/
* This distribution was compiled with the MSYS2 integrated
development, that supports 32 and 64 bit compilation. Setting up
MSYS2 should be done with care, but it is worth it as the
distribution works nicely in MINGW32 and MINGW64 mode. A third
compilation mode, MSYS mode, has problems with compiling sockets.
msys2: http://sourceforge.net/projects/msys2/
* cygwin and cygwin64 now can generate native applications
cygwin: https://www.cygwin.com/
* Linux has a nice cross-compilation environment, with some of the best
work done for Fedora.
fedora mingw cross-compiler: http://fedoraproject.org/wiki/MinGW/CrossCompilerFramework
One problem is that this environment requires emulation of WIN32
executables to generate the initial saved state and to compile
`chr`. `wine` sometimes does the task, but it sometimes fails.
* OSX has the `mxe` package, a port of mingw that is in active
development.
mxe: http://mxe.cc/
Note that OSX has technical limitations that preclude porting
wine64. wine32 is distributed with package managers such as ports
and brew.
=== Setting up WIN32 compilation
Compiling WIN32 packages depends on a number of parameters: chosen compiler,
packages to install, directory setup. You may have to change these ones that
control the `mkwin` script:
* `VER`: major/minor number
* `PATCHID`: third digit
* `SRC`: directory containing yap sources, in the local environment notation.
* `SRC_WIN`: same, but in WIN32 standard notation.
* `THREADS`: yes or no? controllable from the command line.
* `ABI`: "32" or "64", controllable from the command line.
* `NSIS`: installer generator, usually "/c/Program Files (x86)/NSIS/makensis".
* `DOCS_DIR`: where you have the doxygen output.
* `GCC_DIR`: root of gcc seup.
* `HOST`: argument to `--host` configure command.
* `BUILD`: build directory
* `GMP`: multi-precision package; yes, no, or the installation directory; usually in the distribution.
* `CUDD`: BDD package, usually in the distribution.
* `JAVA`: Java sdk directory, usually in the distribution.
* `PYTHON`: Python package, usually in the distribution.
* `R`: R environment package, usually in the distribution.
* `GECODE`: constraint solver package, usually not in the WIN32 distribution.

View File

@ -18,9 +18,9 @@ ReserveFile "${NSISDIR}\Plugins\x86-unicode\InstallOptions.dll"
ReserveFile "${OPTIONS}"
!ifdef WIN64
InstallDir "$PROGRAMFILES64\${ROOTDIR}"
InstallDir "$PROGRAMFILES64\${TARGET}"
!else
InstallDir "$PROGRAMFILES\${ROOTDIR}"
InstallDir "$PROGRAMFILES\${TARGET}"
!endif
InstallDirRegKey HKLM ${REGKEY} "home"
@ -72,7 +72,7 @@ Section "Base system (required)"
File /r ${ROOTDIR}\share\Yap\*
SetOutPath $INSTDIR\share\doc\Yap
File ${ROOTDIR}\share\doc\Yap\html\index.html
File ${ROOTDIR}\share\doc\Yap\html\*
; File ${ROOTDIR}\share\doc\Yap\refman.pdf
; File ${ROOTDIR}\share\doc\Yap\yap.info
File ${ROOTDIR}\share\doc\Yap\Artistic

View File

@ -886,6 +886,13 @@ put_code(int c, IOSTREAM *s)
unsigned char *q = (unsigned char *)&chr;
unsigned char *e = &q[sizeof(pl_wchar_t)];
#if __WINDOWS__
if (s == Soutput || s == Serror ) {
if (!(*s->functions->write)(s->handle, (char *)q, sizeof(wchar_t)))
return -1;
break;
}
#endif
while(q<e)
{ if ( put_byte(*q++, s) < 0 )
return -1;

View File

@ -21,7 +21,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if defined(_WIN32) || defined(__MINGW32__)
#if defined(_WIN32) || defined(__MINGW32__) || defined(__MSYS__)
#define UNICODE 1
#define _UNICODE 1

View File

@ -36,7 +36,7 @@ elif test -e "$srcdir"/packages/python/Makefile.in ; then
if test -d "$PYTHONHOME/libs"; then
#mingw
PYTHON_DIR="$PYTHONHOME"
PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll`
PYTHON_DLL=`echo "$PYTHON_DIR"/DLLs/python*.dll`
PYTHON_LIBS="\"$PYTHON_DLL\""
PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include"
elif test -d "$PYTHONHOME/lib"; then