Problem in building SlicerCustomAppTemplate

Hello,

I am trying to build SlicerCustomAppTemplate to create customized Slicer application. I am following the tutorial of https://blog.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/
and https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#CHECKOUT_slicer_source_files.

While creating the directory in github, when I clone it, it is showing empty repository which has no CMakeLists.txt. I don’t understand the procedure for cloning it.

Also If I copy the CMakeLists.txt in my folder and configure it using CMake-gui, it shows me following errors -
CMake Warning at SlicerApp-rel/slicersources-src/CMake/SlicerBlockFindQtAndCheckVersion.cmake:22 (find_package):
Found package configuration file:

C:/Qt2/5.12.5/msvc2017_64/lib/cmake/Qt5/Qt5Config.cmake

but it set Qt5_FOUND to FALSE so package “Qt5” is considered to be NOT
FOUND. Reason given by package:

Failed to find Qt5 component “WebEngine” config file at
“C:/Qt2/5.12.5/msvc2017_64/lib/cmake/Qt5WebEngine/Qt5WebEngineConfig.cmake”

Failed to find Qt5 component “WebEngineWidgets” config file at
“C:/Qt2/5.12.5/msvc2017_64/lib/cmake/Qt5WebEngineWidgets/Qt5WebEngineWidgetsConfig.cmake”

Call Stack (most recent call first):
SlicerApp-rel/slicersources-src/CMake/SlicerBlockFindQtAndCheckVersion.cmake:67 (__SlicerBlockFindQtAndCheckVersion_find_qt)
SlicerApp-rel/slicersources-src/CMakeLists.txt:600 (include)

CMake Error at SlicerApp-rel/slicersources-src/CMake/SlicerBlockFindQtAndCheckVersion.cmake:30 (message):
error: Qt 5.6.0 was not found on your system.You probably need to set the
Qt5_DIR variable.
Call Stack (most recent call first):
SlicerApp-rel/slicersources-src/CMake/SlicerBlockFindQtAndCheckVersion.cmake:67 (__SlicerBlockFindQtAndCheckVersion_find_qt)
SlicerApp-rel/slicersources-src/CMakeLists.txt:600 (include)

I am using Windows with Visual Studio 2019 and QT 5.12.5.
Can someone please help me to solve the error and provide me steps in detail?

Thanks in advance.

Make sure to follow
these instructions to make sure you’ve selected the QWebEngine and Qt Script components whenever you selected to install the MSVC2017 x64 version of Qt 5.12. You can have a successful build with Qt 5.12 building Slicer with the VS2017 toolset (v141).

The rest of the Windows instructions can be found here -> https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows_2

1 Like

I have Visual Studio 2019 x64 version. Will it not work in it to build SlicerCustomAppTemplate?
Is MSVC 2017 mandatory for this installation?

Also, when we clone the repository, should it have CMakeLists.txt ? From where I can get it?
Could you please tell me exact procedure for this installation?

Thanks in advance.

Hi:

Using the Custom app template generation procedure (these are commands that should go into a bash shell or command prompt, you will need to have python installed):

pip install cookiecutter jinja2-github
cookiecutter gh:KitwareMedical/SlicerCustomAppTemplate

and following the prompts should create a directory contains the CMakeLists for your custom slicer build. You do no need to do a separate checkout of Slicer, or copy anything else in. Once you have that directory, you can configure and build starting from this point in the Slicer instructions.

This will require an appropriate Qt installation. When installing Qt you should enable QtWebEngine and Qt Script for the version of Qt you are installing. We currently test/build slicer with VS2015 and VS2017. However, Qt binaries for VS2017 should work in VS2019

Thank you for this information.
I followed the steps (without modifying any CMake variables from CMakeLists.txt) and it took lot of time to build All_Build project.
But after it, I observed there was no Slicer-superbuild directory in my bin folder, only Slicer-build directory was there. So I built the Slicer.sln from Slicer-build and it was succeeded, run the Slicer.exe successfully.
But In my application,I can not load Dicom data (maybe because Slicer_BUILD_DICOM_SUPPORT is OFF).
So what should I do now to turn some modules ON without doing this whole procedure of build again?

“Slicer-superbuild directory” refers to your top-level binary folder (e.g., “C:\S4R”). It is not created automatically but it exists by the name that you give to it.

You can go on and change any CMake options and when you build again, only impacted parts will be rebuilt, so it will be much faster than the first build from scratch.

Okay. Thanks.
But after making changes in CMakeLists.txt, do I have to build solution file from top-level build directory or build Slicer.sln file directly from Slicer-superbuild/Slicer-build directory?

You will need to rebuild from the solution in the top level build directory, as enabling DICOM adds DICOM specific dependencies that need to be built.

Sorry for asking it again, but it is really confusing me.
I did changes in CMakeLists.txt.
So now first Do I need to configure again using CMake-gui and then rebuild from the solution (All_Build) in the top-level build directory? After that I can directly open Slicer.exe from Slicer-superbuild/Slicer-build. Is it correct?
Please tell me the procedure in steps.
Thanks in advance.

Yes, that is correct.

  1. Change the CMakeLists file
  2. Configure and generate using cmake-gui. Make sure that the source and build directories are set to the folder you have already used for the first build.
  3. Open the .sln file in the to level build directory
  4. Build the ALL_BUILD target
  5. Run Slicer.exe from the Slicer-build directory.