There are two compilers built from the OpenD source: the quick compiler, based on Digital Mars' dmd code, and the optimizing cross-capable compiler, based on LDC's llvm code.
Building the compiler
The compiler code itself is compatible with upstream D, so you can bootstrap it using those compilers.
Windows
dmd-based compiler
On Windows, you will want GNU make (make sure you get the two dlls it depends on too, from the same website) and an upstream D compiler to get started. Run make from inside the "x64 Native Tools Command Prompt" that VS install sets up. You might want to copy the make exe and dlls into the dmd bin folder.
git clone https://github.com/opendlang/opend.git cd opend cd compiler\src dmd build build cd ../../druntime make cd ../phobos make
You can then use opend\generated\windows\release\64\dmd.exe, God willing.
ldc-based compiler
You'll need cmake (from cmake.org) and llvm (at least version 11.0, no newer than 17.0.1, from releases.llvm.org/download.html) installed.
LLVM's website doesn't offer a complete download for Windows. So this won't work
https://github.com/c3lang/win-llvm/releases/tag/llvm_16_0_2 offers a download that works though...
mkdir build; cd build; cmake .. -DLLVM_ROOT_DIR="c:\Users\adamd\Downloads\llvm-16.0.2-windows-x86-msvc17-msvcrt\"
Open the .sln file in Visual Studio and click the build option in the right click menu of the ALL_BUILD project. hope it works... it didn't for me though
alternatively maybe:- Download cmake and put it in your path. Its installer can do this for you.
- Download llvm binary build. The thing from the official llvm website does NOT work but there are others out there. Put the path to llvm bin in your PATH.
- Open a x64 Native Tools Command Prompt from your VS install
cd \path\to\opend
cd ldc
mkdir build
cd build
- ...hit a wall because the cmake thing looks for llvm-config which is not included in the download. ugh. Need to adjust again.
Linux
Initial setup
git clone https://github.com/opendlang/opend.git
Make sure gnu make and gcc are installed too.
dmd-based compiler
# cd into your clone... cd opend make -j8 dmd make -j8 druntime ./generated/linux/release/64/dmd --version
ldc-based compiler
# cd into your clone... cd opend cd ldc mkdir build cd build cmake .. make -j8 ./bin/ldc2 --version
Please help!
If you know how to adapt CI scripts to do release downloads, please get in touch.
Aspirational ideas
The plan is to do something like
- Download
- Unzip
- Run
- (Optional) Install
# to install it to your path opend please install # to download optional components opend please setup-compiler opend please setup-project # to build opend yourfile # or opend please build yourfile # to precompile a library opend please build arsd.cgi