-
Notifications
You must be signed in to change notification settings - Fork 6
Building for Windows
Ren/C++ should build with reasonably up-to-date versions of MinGW and Clang. It relies on some tricky C++11 features, so it's highly unlikely that Ren/C++ will build with Microsoft Visual Studio. At the time of writing, MSVC still does not support (for instance) constructor inheritance.
The simplest way to build Ren/C++ is to use CMake. These instructions will assume you are doing so and using MinGW, so you will need:
-
A recent version of MinGW (e.g. GCC 4.8.2+ with POSIX threads works. GCC 4.7.2 is too old.)
If you don't have a version of MinGW recent enough and you also want to build the "Ren Garden" GUI console demo, then you'll have to download the Qt binaries with the corresponding MinGW version:
- Qt 5.4+ if you also want to build Ren Garden (choose the MinGW binaries in "Other Downloads")
Building Ren/C to use in Ren/C++
To build Ren/C++, you will need to build Ren/C first. Git clone it from the source (or you can choose "Download ZIP"):
git clone https://github.com/metaeducation/ren-c rebol
(Note: Depending on the likelihood of Rebol taking back the changes in Ren/C or not, the directory used may start saying "ren-c" instead of Rebol. Yet there are some signs that Ren/C will be adopted back into the Core of the various Rebol builds. So we'll still say it's a "rebol build" for now.)
The Rebol build process includes preprocessing steps that are--themselves--Rebol scripts. So download an interpreter, put it in the make subdirectory of Rebol's source code, and rename it r3-make.exe. (If you are using a shell other than CMD.EXE, then you might have to simply name it r3-make).
Next step is to tell Rebol to build a makefile for use with MinGW. So in the make subdirectory of Rebol's source code, run this line for a 32-bit build:
make -f makefile.boot OS_ID=0.3.1
If you will be doing a 64-bit build, instead type:
make -f makefile.boot OS_ID=0.3.2
(Note: MinGW-w64 allows 32-bits builds, and you can also stick the flag -m32 onto the compiler options.)
Now you should have a new subdirectory objs full of .o files, as well as an executable named r3.exe in the make directory. Great! You have built Rebol!
Next step: Ren/C++.
Building Ren/C++
Download the source code of Ren/C++ and put it in a directory next to the one that you named rebol. Having these two directories side by side is the default assumption of the build process. If you put rebol somewhere else, you will need to specify -DRUNTIME_PATH=/wherever/you/put/rebol-source.
Make sure that you have cmake, make and the other MinGW executables in your PATH. (MinGW may have named its make mingw32-make if make alone is not working for you.) Then open a console in Ren/C++'s main directory and type the following instructions:
cmake -G"MinGW Makefiles" -DRUNTIME=rebol
make
If all goes well, you should get a libRenCpp.a as well as some executables in the examples directory to try out.
Building Ren Garden
If you want to build Ren Garden along with Ren/C++, then CMake will need to be able to find where Qt installed its CMake "package finders". This is generally done via the environment variable CMAKE_PREFIX_PATH. So if you installed Qt in C:\Qt\5.4, then be sure something along these lines is set in whatever environment you are invoking cmake from:
CMAKE_PREFIX_PATH=C:\Qt\5.4\mingw491_32\lib\cmake
(Note: Be sure to check to make sure this directory is actually there, and make the necessary adjustments if not.)
Once that's ready, type the following instructions:
cmake -G"MinGW Makefiles" -DRUNTIME=rebol -DCLASSLIB_QT=1 -DGARDEN=yes
make
If everything went smoothly, you should have an executable! However, the required DLLs for the C++ runtime, pthreads, and Qt will likely not be in your path. So odds are you'll get several DLL not found errors when you try to run.
Should all else fail, you can go through the DLL errors one by one and put those alongside the executable. The DLLs should be somewhere like:
C:\Qt\5.4\mingw491_32\bin
If adding that to your system path does the trick, you might be happy with that. A less invasive option is to create a small batch file to launch the process that does it only for that session:
echo off
set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin
start workbench.exe