-
-
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 11/16/2021
This has currently only been tested in Visual Studio 2022, hence the name of this section, but it should work in older versions of Visual Studio, as well.
Here are step-by-step instructions for installing Felix with Visual Studio 2022 in Windows 10.
Requirements:
- Install Visual Studio 2022. Ideally, Community, but Build Tools should also work.
- While installing Visual Studio 2022, if you do not already have Python 3 installed, make sure to choose the Python install option.
- Grab OCaml 4.11.1 from here and place it anywhere. Then, using an elevated command line prompt, 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 2022
or open a command line window and callvcvars64.bat
. - Clone the Felix GitHub repo and
cd
into it. - If Python is not already on your
PATH
, add it viaset PATH=<path\to\python>;%PATH%
. - Run the command
buildscript\winsetup
. - 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 2022
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.