Difference between revisions of "Compiling"
(→Step 3: Download BRL-CAD) |
(→Step 5: Configure) |
||
Line 54: | Line 54: | ||
== Step 5: Configure == | == Step 5: Configure == | ||
− | Next, you'll | + | Next, you'll run CMake to configure and generate a build system. CMake needs to know where the top-level source directory is and where your build directory is located. This is the "brlcad" directory you cloned and the "build" directory you created. For your first time, we also recommend setting these CMake variables to avoid trivial issues: |
BRLCAD_ENABLE_STRICT=OFF | BRLCAD_ENABLE_STRICT=OFF | ||
− | + | BRLCAD_ENABLE_COMPILER_WARNINGS=OFF | |
BRLCAD_BUNDLED_LIBS=ON | BRLCAD_BUNDLED_LIBS=ON | ||
CMAKE_BUILD_TYPE=Release | CMAKE_BUILD_TYPE=Release | ||
− | * Windows: you can use the CMake GUI where you specify your source dir, build dir, and variables. [[File:Running_cmake_on_windows.png|200px|thumb|right|Running CMake GUI on Windows]] | + | * Windows: you can use the CMake GUI where you specify your source dir (i.e. path to the "brlcad" folder that has README), the build dir, and variables. CMake does not display variables the first time you run, but you can "+ Add Entry" to add them or "Configure" to have it list them. Once variables are set, run "Configure" again and finally "Generate". This will create a Visual Studio build system. [[File:Running_cmake_on_windows.png|200px|thumb|right|Running CMake GUI on Windows]] |
* Mac: You can either run CMake GUI specifying your source dir, build dir, and the above variables, or you can follow the steps for Linux in Terminal. | * Mac: You can either run CMake GUI specifying your source dir, build dir, and the above variables, or you can follow the steps for Linux in Terminal. | ||
Line 69: | Line 69: | ||
If CMake was successful, there will be a summary of the build printed at the end and it will have generated a build system for compiling BRL-CAD. | If CMake was successful, there will be a summary of the build printed at the end and it will have generated a build system for compiling BRL-CAD. | ||
− | |||
== Step 6: Compile == | == Step 6: Compile == |
Revision as of 13:28, 10 February 2022
Contents
Compiling BRL-CAD
This page has simplified steps for building quickly. See INSTALL for more detailed instruction.
Step 1: Install Dev Tools
To build, you need at least CMake and a compiler. You will also want Git to obtain the latest source code.
- Windows: Install Git, CMake, and Visual Studio Community. VS Code should also work, but you will need to install the "Build Tools for Visual Studio" from Microsoft also.
- Mac: Install CMake and XCode or run this in Terminal:
xcode-select --install
- Linux:
- Debian/Ubuntu:
aptitude install build-essential make cmake
- Debian/Ubuntu:
- Fedora:
yum install clang++ make cmake
- Fedora:
- CentOS:
yum install python3-pip devtoolset-9
pip3 install cmake
scl enable devtoolset-9 bash
- CentOS:
- BSD: we assume you know what you're doing and can follow the gist
Step 2: Install Dependencies
You can skip this step if you're building on Windows or Mac. Linux and other package-managed systems may need to install a few more things:
- Debian/Ubuntu:
aptitude install sed byacc flex xsltproc libncursesw5-dev
aptitude install libfontconfig-dev xserver-xorg-dev libx11-dev libxi-dev<pre>
- Debian/Ubuntu:
- Fedora: <pre>yum install libx11-devel
Step 3: Download BRL-CAD
We recommend obtaining BRL-CAD by forking or cloning our repository on GitHub.
- Windows: Run the Git GUI specifying this as the repository to clone:
https://github.com/BRL-CAD/brlcad.git
- Mac: You can either run the Git GUI, or you can run this in Terminal:
git clone https://github.com/BRL-CAD/brlcad.git
- Linux:
git clone https://github.com/BRL-CAD/brlcad.git
The "brlcad" folder created after cloning is a full source checkout of BRL-CAD and contains a README with additional info. If you run into trouble cloning from git, snapshot source releases are available.
Step 4: Create a Build directory
You can create a build folder anywhere, but it's typically named "build" and is in or near your "brlcad" source directory.
- Windows: create a folder named "build" inside your "brlcad" folder
- Mac, Linux:
mkdir -p brlcad/build
Step 5: Configure
Next, you'll run CMake to configure and generate a build system. CMake needs to know where the top-level source directory is and where your build directory is located. This is the "brlcad" directory you cloned and the "build" directory you created. For your first time, we also recommend setting these CMake variables to avoid trivial issues:
BRLCAD_ENABLE_STRICT=OFF BRLCAD_ENABLE_COMPILER_WARNINGS=OFF BRLCAD_BUNDLED_LIBS=ON CMAKE_BUILD_TYPE=Release
- Windows: you can use the CMake GUI where you specify your source dir (i.e. path to the "brlcad" folder that has README), the build dir, and variables. CMake does not display variables the first time you run, but you can "+ Add Entry" to add them or "Configure" to have it list them. Once variables are set, run "Configure" again and finally "Generate". This will create a Visual Studio build system.
- Mac: You can either run CMake GUI specifying your source dir, build dir, and the above variables, or you can follow the steps for Linux in Terminal.
- Linux:
cd brlcad/bulid
cmake .. -DBRLCAD_ENABLE_STRICT=NO -DBRLCAD_BUNDLED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
See INSTALL for more CMake options.
If CMake was successful, there will be a summary of the build printed at the end and it will have generated a build system for compiling BRL-CAD.
Step 6: Compile
Windows: navigate to your build directory and open the BRLCAD.sln file with Visual Studio. Compile the ALL_BUILD solution.
Mac, Linux: while still in the build directory from Step 4, run
make
If the build fails, re-run while capturing all output to a log: make 2>&1 | tee build.log Please report any build failures.
Note: Compilation can take anywhere from a couple minutes to an hour depending on hardware. If you had a quad-core CPU, you might run '"make -j4" to speed things up by compiling in parallel.
Step 7: Run!
You don't have to install to run BRL-CAD. You can run the binaries you just compiled as they are in the brlcad/build/bin directory. There are hundreds of tools in BRL-CAD. Here's a few to get started:
bin/benchmark run bin/mged bin/archer
The first command (benchmark) will evaluate system performance and you can send results to benchmark at brlcad dot org.
The second command (mged) is BRL-CAD's main graphical user interface application.
The third command (archer) is BRL-CAD's newer graphical interface under development.
What next?
Be sure to check out the docs and Main_Page for tutorials and more.
Help make BRL-CAD better! There are many ways you can contribute to open source and you don't need to be an experienced programmer. We need artists, writers, designers, software developers, and managers. Contact us on IRC.
Please report any build failures.
See Deuces for really easy ways to get started!