Note
4coder needs the MSVC compiler and windows SDK from the "Desktop development with C++" component. If you don’t have this already, you can download the installer here. Make sure to at least click on "Desktop development with C++" and tick the boxes for MSVC and the Windows SDK.
- Setup the MSVC toolchain in your environment, this can be done either with the
code/custom/bin/setup_cl_x64.batscript or by using the development shell in windows terminal - Execute this command from the root of the project (the resulting executable will be under the
buildfolder in the root of the repo)
cd code && .\bin\build.batIn addition to the parameter listed below, you can specify which backend to use by passing one of those parameters to the build scripts:
/DWIN32_OPENGL(default) to use the OpenGL backend./DWIN32_DX11to use the Direct3D 11 backend.
cd code && .\bin\build.bat /DWIN32_DX11tested on Ubuntu 22.04:
- Get required libraries (apt names):
sudo apt install build-essential libx11-dev libxfixes-dev libglx-dev mesa-common-dev libasound2-dev libfreetype-dev libfontconfig-dev`- Execute this command from the root of the project (the resulting executable will be under the
buildfolder in the root of the repo)
cd code && ./bin/build-linux.sh4coder targets x86_64. If you are using a M1+ ARM CPU you need to prefix the build scripts commands with:
arch -arch x86_64
- Execute this command from the root of the project (the resulting executable will be under the
buildfolder in the root of the repo)
cd code && ./bin/build-mac.shIf you are using an older version of mac, such as 10.15.7 Catalina you need to install the realpath command:
$ sudo port install coreutils- macports names the
realpathcommandgrealpath, so make a symbolic link in order to use build-mac.sh:
$ sudo ln -s /opt/local/bin/grealpath /opt/local/bin/realpath
The build script accepts a parameter (mutually exclusive):
/DDEV_BUILD(default value) : build without optimizations. Produces debug symbols. Defines:FRED_INTERNAL,FRED_SUPER,DO_CRAZY_EXPENSIVE_ASSERTS(on Windows) macros./DOPT_BUILD(similar tobuild_optimizedscript): build with optimizations. Doesn't produce debug symbols. DefinesFRED_SUPERmacro.
4coder uses several small programs to generate some headers and source files. Those do not run automatically, you must build them and run them when needed (which shouldn't really happen).
code\4ed_font_api.cppcreates, incode\generated,font_api.h,font_api.cpp,font_api_constructor.cpp(not used) andfont_api_master_list.h(not used);code\4ed_graphics_api.cppcreates, incode\generated,graphics_api.handgraphics_api.cpp,graphics_api_constructor.cpp(not used) andgraphics_api_master_list.h(not used);code\4ed_system_api.cppcreates, incode\custom\generated,system_api.h,system_api.cpp,system_api_constructor.cpp,system_api_master_list.h;code\4ed_api_parser_main.cppis a little different, as it parses source files passed as parameters to search for functions and type preceded byapi(some_api_name)and creates 4 files in thecode\custom\generated. It is used to generatecustom_api.h,custom_api.cpp,custom_api_constructor.cppandcustom_api_master_list.hby passingcode\4ed_api_implementation.cppas a parameter.
You need to compile one of those file and run it from the code directory.
There is also code\4ed_api_check.cpp to verify the generated file but it's not clear at the moment what to check against.
code\4ed_generate_keycodes.cppis also a bit appart as it generatescode\custom\generated\4coder_event_codes.hwhich are keyboard key codes and some event hook ids.