-
Notifications
You must be signed in to change notification settings - Fork 25
Configuring OpenStudio Application Build Environments
Wiki ▸ Configuring OpenStudio Application Build Environments
Building OpenStudio Application:
Advanced: Building OpenStudio Application Dependencies
This is the fastest, most reliable method of getting a working OpenStudio build. These instructions assume that you have successfully cloned the OpenStudio Application repository already. For these instructions we will refer to the root of the OpenStudio checkout as .
.
We are now using conan to manage build dependencies. To install conan you need to install python (install version 3 or greater) and pip install conan
or sudo pip install conan
, and make sure that your python bin dir is in your path. After that the rest of it should be automatic.
Information on maintaining conan packages for OpenStudio is in conan-openstudio-ruby. The NREL OpenStudio packages are distributed through (bintray)[https://bintray.com/commercialbuilding/nrel].
We are no longer downloading Qt via CMake, and you will need to install Qt 6.6.1 manually via the online installer or via an automated tool such as aqtinstall (Note that by using this tool, you agree to the Qt License agreement).
Using the Online Installer:
Install the open source edition of Qt via the online installer. You will need to register for a free account on Qt's website too.
In the installer: make sure to select Qt 6.6.1 with the "Desktop XXX 64 bit" (eg: msvc, gcc) + "Qt WebEngine" + +"Qt Positioning" + "Qt 5 Compatibility Module" at least. While you're at it, under "Developer and Designer Tools", tick the "Qt Installer Framework 4.6" (or whichever version is current) so you can build installer packages.
Using aqtinstall:
The best source for aqtinstall
is the Github Actions workflow we use (cf app_build.yml), but as an example for windows:
cd C:\src\OpenStudioApplication
pip3 install aqtinstall
aqt install --outputdir ./build/Qt-install/ 6.6.1 windows desktop win64_msvc2019_64 -m qtwebchannel qtwebengine qtwebview qt5compat qtpositioning
Install Visual Studio 2019, CMake 3.15 or greater (prefer latest, 3.28.1 as of this writing), and Git for windows. Install conan (see section above), and optionally QtIFW (to build installers, see section below).
Set the PreferredToolArchitecture
environment variable to x64
(this is the default anyways in MSVC 2019), this will use 64 bit compiler tools and performs much better (you may still create 32 bit builds with the 64 bit compiler tools).
Clone the OpenStudio repository, launch the CMake GUI, and select the source and build directories. Configure build options and press generate. Certain configuration options may require installation of additional dependencies, these are documented below. After generating, open OpenStudio.sln in the build directory with Visual Studio and choose Build Solution.
Note: Long paths issues have arisen due to some dependencies of openstudio. We recommend cloning the repository to C:\src\OpenStudioApplication
for example, and build in C:\src\OpenStudioApplication\build\
Here are terminal instructions for cloning the repository, but you can achieve the same using your favorite Git GUI (Github for Windows, Atlassian Sourcetree, Gitkraken, to name a few)
cd C:\
mkdir src
cd src
git clone https://github.com/openstudiocoalition/OpenStudioApplication.git
cd OpenStudioApplication
mkdir build/
# Then configure using CMake-GUI
Then configure using CMake-GUI
In CMake-GUI:
- "Where is the source code":
C:/src/OpenStudioApplication
- "Where to build the binaries the source code":
C:/src/OpenStudioApplication/build
- Hit configure. This takes a while as it will download dependencies (conan + others such as
If you haven't set QT_INSTALL_DIR before the first configure, an error will be noted. Locate the QT_INSTALL_DIR
variable in the list after ticking the "Advanced" box next to the search bar, and fill it up with the path to where you have installed Qt. For eg, on Windows with aqtinstall
instructions given above, it would be C:\src\OpenStudioApplication\build\Qt-install\6.6.1\msvc2019_64
. Then hit configure again.
Tweaks options as needed, hit configure until you can click "Generate". When Generating is done, you can open the solution placed in ./build
in Microsoft Visual Studio 2019.
Ubuntu 22.04 is the primary version of Linux supported. To install build dependencies:
sudo apt update
sudo apt install build-essential git cmake-curses-gui cmake-gui libssl-dev libxt-dev \
libncurses5-dev libgl1-mesa-dev autoconf libexpat1-dev libpng-dev libfreetype6-dev \
libdbus-glib-1-dev libglib2.0-dev libfontconfig1-dev libxi-dev libxrender-dev \
libgeographic-dev libicu-dev chrpath bison libffi-dev libgdbm-dev libqdbm-dev \
libreadline-dev libyaml-dev libharfbuzz-dev libgmp-dev patchelf python3-pip \
mesa-common-dev patchelf ninja-build libxkbcommon-x11-dev
Install CMake.
Note: there is now an up-to-date PPA from kitware! Refer to the instructions on https://apt.kitware.com/. Prefer this method!
Old way: manual build:
CMAKE_VERSION=3.20.3 # Update with latest by checking https://cmake.org/download/
wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION.tar.gz
tar xfz cmake-$CMAKE_VERSION.tar.gz
cd cmake-$CMAKE_VERSION
./configure
make -j$(nproc)
sudo make install
Install Xcode and CMake.
Clone the OpenStudio repository, launch the CMake GUI, and select the source and build directories. Configure build options and press generate. Certain configuration options may require installation of additional dependencies, these are documented below. After generating, change directories into the build directory and run make -j$(nproc)
.
Clone the OpenStudio repository, create a build directory, and run ccmake:
git clone https://github.com/NREL/OpenStudioApplication.git
cd OpenStudioApplication
mkdir build
cd build
ccmake -DCMAKE_BUILD_TYPE=Release ../
You can also specify build options using CMake args. For example, if you wanted to build a debug version, you can specify this.
ccmake -DCMAKE_BUILD_TYPE=Debug ../
Configure build options and generate. Certain configuration options may require installation of additional dependencies, these are documented below. After generating, change directories into the build directory and run make
.
Install QtIFW
Install QtIFW
Install QtIFW