How to build newly added models which are written in C++ and python

Hello There are some custom models we are able to build it using old version of slicer 4.05, VS 2013 and QT 4.X.

Now I wanted to upgrade the slicer into latest version that is 4.13 and along with custom models.

While I was building our custom models. Cmake files are throwing error.

Please let me know what is correct format to build the slicer with custom models(which are written in C++,Qt,Python)

Please share me if there is any example cmake files for building that is written in C++.

You can have a look at how other extensions that were ported from old Slicer versions and Qt4 to current version. For example SlicerIGT and SlicerRT. You can search for Qt5 in commits to see what changes were required for Qt5 compatibility.

I ran below command for building.

“C:\Program Files\CMake\bin\cmake.exe” -G “Visual Studio 16 2019” -A x64 -DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 C:\D\S4

After running above command I got below error.

– SuperBuild - JOM_EXECUTABLE:D:/W2/SPMTR-rel/jom/jom.exe
– SuperBuild - Qt4[OK]
CMake Error at CMake/Superbuild/External_Qt4.cmake:71 (message):
Building Qt using visual studio 1928 is NOT supported !
Call Stack (most recent call first):
D:/W2/SPMTR-rel/slicersources-src/CMake/ExternalProjectDependency.cmake:842 (include)

External_Qt4.cmake file snapshot is like below.

Through above config openSSL file not downloaded.

I have marked the line where the error occurs. Actually the above one is worked for old QT, Now Its is giving error for building through QT5.15.2.

Please guide me how can i fix these build issues.

I would recommend to first build Slicer by following build instructions word by word. Once that you confirm that everything works well, then if you want you can start experimenting with changing things (building your own Qt, using different versions of libraries, etc.), one step at a time, and always starting from a clean build.

Hi, Thanks for the reply. I have followed the build instruction. I have built the SlicerCAT without any problem. I have added some models to it and started building. I got following build error.

38>-- Setting AB LAUNCHER_SPLASHSCREEN_FILE to ‘D:/W4/AB/Applications/App/Resources/Images/SplashScreen.png’
38>-- Setting AB APPLE_ICON_FILE to ‘D:/W4/AB/Applications/App/Resources/Icons/XLarge/DesktopIcon.icns’
38>-- Setting AB WIN_ICON_FILE to ‘D:/W4/AB/Applications/App/Resources/App.ico’
38>-- Setting AB LICENSE_FILE to ‘D:/W4/AB/LICENSE’
38>-- Setting AB executable name to ‘ABApp-real.exe’
38>-- Setting AB EXECUTABLE to ‘D:/W4/AB-rel/S-bld/Slicer-build/bin/ABApp-real.exe’
38>-- --------------------------------------------------

38>-- Setting ‘CTEST_MODEL’ variable with default value ‘Experimental’
38>-- Setting ‘MIDAS_PACKAGE_URL’ variable with default value ‘Slicer Server by Kitware - Release
38>-- Setting ‘MIDAS_PACKAGE_EMAIL’ variable with default value ‘OBFUSCATED’
38>-- Setting ‘MIDAS_PACKAGE_API_KEY’ variable with default value ‘OBFUSCATED’
38>-- Setting ‘SLICER_PACKAGE_MANAGER_CLIENT_EXECUTABLE’ variable with default value ‘SLICER_PACKAGE_MANAGER_CLIENT_EXECUTABLE-NOTDEFINED’
38>-- Setting ‘SLICER_PACKAGE_MANAGER_URL’ variable with default value ‘SLICER_PACKAGE_MANAGER_URL-NOTDEFINED’
38>-- Setting ‘SLICER_PACKAGE_MANAGER_API_KEY’ variable with default value ‘OBFUSCATED’
38>-- Trying to find DCMTK expecting DCMTKConfig.cmake
38>-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
38>-- Setting CPACK_PACKAGE_NAME to ‘AB’
38>-- Setting CPACK_PACKAGE_VENDOR to ‘AB Corporation’
38>-- Setting CPACK_PACKAGE_VERSION_MAJOR to ‘0’
38>-- Setting CPACK_PACKAGE_VERSION_MINOR to ‘1’
38>-- Setting CPACK_PACKAGE_VERSION_PATCH to ‘0’
38>-- Setting CPACK_PACKAGE_VERSION to ‘0.1.0-2021-06-11’
38>-- Setting CPACK_PACKAGE_INSTALL_DIRECTORY to ‘AB 0.1.0-2021-06-11’
38>CMake Error at CMake/SlicerCPack.cmake:290 (message):
38> Failed to set variable CPACK_PACKAGE_DESCRIPTION_FILE. Neither
38> Slicer_CPACK_PACKAGE_DESCRIPTION_FILE or
38> AB_CPACK_PACKAGE_DESCRIPTION_FILE are defined.
38>Call Stack (most recent call first):
38> CMake/SlicerCPack.cmake:333 (slicer_cpack_set)
38> CMake/LastConfigureStep/CMakeLists.txt:44 (include)
38>
38>
38>-- Configuring incomplete, errors occurred!
38>See also “D:/W4/AB-rel/S-bld/Slicer-build/CMakeFiles/CMakeOutput.log”.
38>See also “D:/W4/AB-rel/S-bld/Slicer-build/CMakeFiles/CMakeError.log”.
38>D:\Visual Studio 2019\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: Custom build for ‘D:\W4\AB-rel\S-bld\CMakeFiles\988e155199b8f1a7ecac7f93bffe4834\Slicer-configure.rule;D:\W4\AB-rel\S-bld\CMakeFiles\988e155199b8f1a7ecac7f93bffe4834\Slicer-build.rule;D:\W4\AB-rel\S-bld\CMakeFiles\988e155199b8f1a7ecac7f93bffe4834\Slicer-forcebuild.rule;D:\W4\AB-rel\S-bld\CMakeFiles\988e155199b8f1a7ecac7f93bffe4834\Slicer-install.rule;D:\W4\AB-rel\S-bld\CMakeFiles\ef186b732632fd846b27be20eeffe050\Slicer-complete.rule;D:\W4\AB-rel\S-bld\CMakeFiles\0f36f1efb3987a0e049d3f8d21feab06\Slicer.rule’ exited with code 1.
38>Done building project “Slicer.vcxproj” – FAILED.

Please suggest me how can i fix this issue.

Which files did you modify? How? Can you send a link to your repository?