-
-
Notifications
You must be signed in to change notification settings - Fork 44
Building Felix From Source
To build Felix from source you need to run one of these commands:
bash on OSX using clang:
. buildscript/osxsetup.sh
make
Notes: OSX10 comes with a old clang. I upgraded from the provider website directly. C++11 support is required. Please use libc++, clang's library, NOT libstdc++, gcc's library. clang 3.7 works. [It is also possible to build with gcc5 but you should bootstrap with clang first]
bash on Linux using gcc>5:
. buildscript/linuxsetup.sh
make
[It is also possible to build with clang, but you should bootstrap with gcc first]
Console on Windows with
-
Visual Studio 14 environment variables set up
-
64 but Windows ocaml installed
-
Python3 on path
buildscript\winsetup.bat nmake
On Appveyor we do this to effect the setup:
install:
- call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
- git clone -q https://github.com/felix-lang/win64ocaml.git
- move win64ocaml c:\ocaml
- set PATH=C:\Python35-x64;c:\ocaml\bin;%PATH%
- set PWD=.
- set PATH=build\release\host\bin;build\release\host\lib\rtl;%PATH%
- set FLX_MIN_MEM=10000
If you have the "free" compilers you will have to use the 32->64 bit cross compiler tools instead. Be warned standard vsvarsall.bat has a bug and doesn't setup the correct environment for 32->64 cross compiler.
Cygwin64: Just pretend you're running Linux.
Updated 12/18/2020
Here are step-by-step instructions for installing Felix with Visual Studio 2019 in Windows 10.
Requirements:
- Install Visual Studio 2019. Ideally, Community, but Build Tools should also work.
- While installing Visual Studio 2019, make sure to install Python. If not, install Python separately.
- Grab OCaml 4.06 from here and place it anywhere. Then make a symbolic link from
C:\ocamlms64
to wherever you put the OCaml folder -mklink /d "C:\ocamlms64" <path to your OCaml install here>
(this may be unnecessary, but I did receive an error at one point that stated that it couldn't find something at this location).
Building Felix:
- Open the
x64 Native Tools Command Prompt for VS 2019
or open a command line window and callvcvars64.bat
. - Clone the Felix GitHub repo and
cd
into it. - Open
buildscript\winsetup.bat
and change all references ofc:\ocaml
toc:\ocamlms64
. You absolutely have to make sure that theocamllib
environment variable is set properly orfbuild
will test your OCaml compiler and it will fail. - Open
src\re2\re2\util\util.h
. Find the following code:Change it to:#include <unordered_set> #if defined(WIN32) || defined(OS_ANDROID) using std::tr1::unordered_set; #else using std::unordered_set; #endif
This is just a temporary solution.#include <unordered_set> #if defined(WIN32) || defined(OS_ANDROID) using std::unordered_set; #endif
std::tr1
was deprecated in previous versions of the C++ standard and has officially been removed from the latest version of MSVC. - If Python is not already on your
PATH
, add it viaset PATH=<path\to\python>;%PATH%
. - Run the command
buildscript\winsetup
. - If your OCaml install was not added to your
PATH
, add it the same way you added Python. - Run the command
nmake
. It will likely take quite some time to build, but it should work.
Running Felix:
-
To run Felix, you need to first open the
x64 Native Tools Command Prompt for VS 2019
or open a command line window and callvcvars64.bat
. -
Once opened, the following items need to be in your
PATH
:<path\to\felix\repo>\build\release\host\bin
<path\to\felix\repo>\build\release\host\lib\rtl
-
The following environment variables also need to be set:
-
FLX_TARGET_DIR
needs to be set to<path\to\felix\repo>\build\release\host
. -
FLX_SHARE_DIR
needs to be set to<path\to\felix\repo>\build\release\share
.
If these are not set properly, Felix will look for critical files in the wrong place.
-
-
Path to wherever your code is and run
flx <your file>
. It should just work.
Setting up SDL2:
SDL2 is unfortunately a bit more complicated. First, ensure that the folder that contains your SDL2 DLLs is in your PATH
. Next, go to build\release\share\src\config\win
and open sdl2.fpc
, sdl2_image.fpc
, and sdl2_ttf.fpc
. Edit them so that line 4 points to the folder holding the SDL2 headers, for example cflags: /I"D:\Code\CLibraries\SDL-2.0.10\include"
. Then, edit line 6 so that it points to the SDL2 DLL in question, sans the extension, for example provides_dlib: /DEFAULTLIB:"D:\Code\CLibraries\SDL-2.0.10\x64\SDL2"
.
Once that is done, go to build\release\host\config
and do the same thing.
Once you have edited both sets of config files to point to the proper places, go to src\web\tutopt\sdlgui
and run the command flx gui_01_window_01.fdoc
. It should build and run an application with an empty window that stays open for 15 seconds and then closes. If so, SDL2 is properly set up.