Building on Windows

This is intended to be a guide for building the sequence of cmb-superbuild, smtk, and cmb on Windows.

In Windows, you are limited to build Release or RelWithDebInfo (Release with Debug Info). CMake will not configure either the cmb-superbuild or smtk in Debug for reasons [INSERT REASON HERE].

You should take care to not make your build path too verbose. Especially for smtk, the nested directories and file name can be quite long. If you use a build path longer than about 42 characters, you may run afoul of the windows path length limit.

These steps were performed on:
Windows 11
Qt 5.15.2
MSVC 2019 (compiler)
Qt Creator 6.0.0

CMB_SUPERBUILD

Command Line:

Run

cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 -DCMAKE_PREFIX_PATH:STRING=install -DDEVELOPER_MODE_cmb:BOOL=ON -DDEVELOPER_MODE_smtk:BOOL=ON ../source

in the build directory.

In an exploded format:

cmake 
-GNinja 
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo 
-DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5    <--- set to location of Qt5Config.cmake
-DCMAKE_PREFIX_PATH:STRING=install 
-DDEVELOPER_MODE_cmb:BOOL=ON 
-DDEVELOPER_MODE_smtk:BOOL=ON 
../source    <--- path adjusted for your build environment

Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

In the Key-Value edit window, you should find and set:

DEVELOPER_MODE_cmb:BOOL=ON
DEVELOPER_MODE_smtk:BOOL=ON

SMTK

Command line:

Run

cmake -GNinja -CC:\projects\cmb-superbuild\RelWithDebInfo\smtk-developer-config.cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -D_smtk_superbuild_prefix:PATH=C:\projects\cmb-superbuild\RelWithDebInfo\install -DSMTK_UNIFIED_INSTALL_TREE:BOOL=ON  -DSMTK_DLL_PATHS:STRING=C:/Qt/5.15.2\msvc2019_64/bin -DSMTK_USE_SYSTEM_MOAB:BOOL=ON -DLibArchive_INCLUDE_DIR=C:\projects\cmb-superbuild-commandline/RelWithDebInfo\install\include -DLibArchive_LIBRARY=C:\projects\cmb-superbuild-commandline/RelWithDebInfo\install\lib\archive.lib ../source

in the build directory.

In an exploded format:

cmake 
-GNinja 
-CC:\projects\cmb-superbuild\RelWithDebInfo\smtk-developer-config.cmake    <--- path adjusted for your build environment
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo 
-D_smtk_superbuild_prefix:PATH=C:\projects\cmb-superbuild\RelWithDebInfo\install    <--- path adjusted for your build environment
-DSMTK_UNIFIED_INSTALL_TREE:BOOL=ON  
-DSMTK_DLL_PATHS:STRING=C:/Qt/5.15.2\msvc2019_64/bin    <--- set to location of Qt DLLs
-DSMTK_USE_SYSTEM_MOAB:BOOL=ON 
-DLibArchive_INCLUDE_DIR=C:\projects\cmb-superbuild/RelWithDebInfo\install\include    <--- path adjusted for your build environment
-DLibArchive_LIBRARY=C:\projects\cmb-superbuild/RelWithDebInfo\install\lib\archive.lib    <--- path adjusted for your build environment
../source    <--- path adjusted for your build environment

Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

Add/Edit these Initial CMake Parameters to those already present:

-CC:/projects/cmb-superbuild/5_15_VS19_64RDb/smtk-developer-config.cmake
-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/share/cmake/pybind11
-DLibArchive_INCLUDE_DIR=C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/include
-DLibArchive_LIBRARY=C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/lib/archive.lib

CMB

Command line:

Run

cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=RelWithDebInf -Dsmtk_DIR:PATH=C:\projects\smtk\RelWithDebInfo ../source

in the build directory.

In an exploded format:

cmake 
-GNinja 
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInf 
-Dsmtk_DIR:PATH=C:\projects\smtk\RelWithDebInfo    <--- path adjusted for your build environment
../source    <--- path adjusted for your build environment

Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

Add/Edit these Initial CMake Parameters to those already present:

-Dsmtk_DIR:PATH=C:/projects/smtk/5_15_VS19_64RDb    <--- path adjusted for your build environment

Open the Project Run settings (in Project tab).
In the Environment section, edit the Path variable to include:

C:\projects\cmb-superbuild\5_15_VS19_64RDb\install\Python    <--- path adjusted for your build environment

Add a value for PYTHOMHOME (if it is not yet present) to be:

C:\projects\cmb-superbuild\5_15_VS19_64RDb\install\Python    <--- path adjusted for your build environment

Once the paths are adjusted for the specifics of your build environment, these steps should allow you work around the configuration difference you will encounter in a Windows development environment.

@Bob_Obara @johnt
“New users can only mention two users in a post”
Can one of you @ the rest of the crowd for me?
ben.boeckel aron.helser Ryan_Krattiger dcthomp C_Wetterer-Nelson

@ben.boeckel @aron.helser @Ryan_Krattiger @dcthomp @C_Wetterer-Nelson FYI