How to create an executable/binaries of custom application

How to create an executable of the custom application? I want to dynamically link the qt libraries.
I have built software from source using this guide:
ParaView/build.md at master · Kitware/ParaView · GitHub
And then wrote my custom application. I want to create binaries/executable for windows, linux and mac.

if you want to redistribute binaries, you should use the superbuild concept.
Here is the example on how to create a superbuild for paraview based applications.

Do I need to build paraview superbuild first on my machine and then use this example or can I just clone this example and replace simple-paraview-example with my application?

What does pvsb@ 4ab568cb mean?

This is a git submodule

You can clone (and probably fork) this example, and then, as you stated, replace simple-paraview-example by your application:

  • rename and adapt files inside projects dir
  • adapt versions.cmake file

So then I would not have to first build superbuild on my machine separately? And would I be able to generate binaries of my application and distribute them?

That is the idea of this project: run only one, big but lonely, build to generate all that is needed to create a redistributable archive

1 Like

I tried to change the simpleparaview example with Clone 1 example in the superbuild example
but I am getting this error when I try to build it:

CMake Error at pvsb/superbuild/cmake/SuperbuildMacros.cmake:822 (include):
  include could not find requested file:

    clone1
Call Stack (most recent call first):
  pvsb/superbuild/CMakeLists.txt:168 (_superbuild_discover_projects)


-- Enabling cxx11 as requested.
-- Enabling paraview as requested.
-- Building projects: cxx11, paraview
CMake Warning (dev) at pvsb/superbuild/cmake/SuperbuildMacros.cmake:213 (message):
  Optional dependencies for paraview not found: adios2, cuda, boost, eigen,
  fortran, gdal, hdf5, matplotlib, mpi, numpy, png, protobuf, python3,
  visitbridge, zlib, silo, las, lookingglass, fides, xdmf3, vrpn, vtkm,
  netcdf, openpmd, openvdb, nlohmannjson, paraviewgettingstartedguide,
  paraviewtutorialdata, paraviewweb, openvr, zeromq
Call Stack (most recent call first):
  pvsb/projects/paraview.cmake:186 (superbuild_add_project)
  pvsb/superbuild/cmake/SuperbuildMacros.cmake:1061 (include)
  pvsb/superbuild/CMakeLists.txt:170 (superbuild_process_dependencies)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Please detail what you did.

You should change quite every file of the example to adapt it correctly: each mention to simple in files AND in filename.

I made following changes:

  1. In projects/unix I changed the file name to clone1.bunble.cmake
  2. In projects/unix/clone1.bundle.cmake:
  • set(CPACK_PACKAGE_NAME “Clone1-1.0-ParaView”)

  • superbuild_unix_install_program("{superbuild_install_location}/bin/clone1" “lib”
    SEARCH_DIRECTORIES “${library_paths}”)

  • Changed other paths in projects/unix/clone1.bundle.cmake from simpleparaview to clone1

  1. Same changes made in projects/win32/clone1.bundle.cmake
  2. In projects/clone1.cmake changed the superbuild_add_project from simpleparaview to clone1
  3. Did not make any changes to pvsb
  4. In main CmakeLists.txt:
  • Changed project from simpleparaview-superbuild to clone1-superbuild

  • In superbuild_find_projects function I changed simpleparaview to clone1 in set projects

  • foreach (generator IN LISTS generators)
    superbuild_add_extra_package_test(strong text****clone1 “${generator}”
    LABELS “Clone1”
    TIMEOUT 6400)

  • set the default projects: set(superbuild_defaultclone1 ON)

  1. In versions.cmake changed the superbuild_set_version name from simpleparaview to clone1, also changed the URL and URL_MD5

Oh I wasn’t changing the filenames, after I did it fixed this issue.

Getting this error right at the end of the build:

CMake Error at CMakeLists.txt:78 (message):
  Failed to find the VTK CMake directory.  Did you forget to initialize the
  submodule? (git submodule update --init --recursive)

-- Configuring incomplete, errors occurred!
CMake Error at C:/Users/msaad/build_clone/pvsb/superbuild/sb-clone1-configure.cmake:47 (message):
  Failed with exit code 1

ninja: build stopped: subcommand failed.

Could this be because the superbuild version in the example is an old one?

For sure not related to the superbuild version.

Maybe related on how you get ParaView or the clone … (in versions.cmake)

This is my versions.cmake file

superbuild_set_revision(clone1
  URL     "https://gitlab.kitware.com/paraview/paraview/-/archive/v5.11.1/paraview-v5.11.1.tar.gz"
  URL_MD5 0c9d1b2f4f6d0c09683b66387b1e3f71)

I got the URL for this

And got the MD5 from my terminal by running the following commands:

CertUtil -hashfile file_name.tar.gz MD5

You’ll also need to set SOURCE_SUBDIR to Examples/CustomApplications/Clone1 there, make some clone1.bundle.cmake module to do the packaging (cribbing from paraview.bundle.cmake is probably best), and hook in the packaging of clone1 in superbuild_add_packaging in the top-level CMakeLists.txt.

Thanks for the response, where would the SOURCE_SUBDIR would be?
what does it mean to make some clone1.bundle.cmake module? I am not sure what cribbing from paraview.bundle.cmake is. Can you please explain? Thanks

  • SOURCE_SUBDIR is part of the superbuild_set_revision call; it makes CMake look in that subdirectory for the main build instead of starting at the top-level (which would build ParaView itself).
  • clone1.bundle.cmake is the file the packaging will look at.
  • “Cribbing” means “look at paraview.bundle.cmake as a template and change what makes sense”. You probably don’t need/want paraview the executable, but the rest may be relevant (but feel free to simplify anything you know you don’t need).

This is in pvsb/versions.cmake file:

superbuild_set_revision(protobuf
  URL     "https://www.paraview.org/files/dependencies/protobuf-3.17.3.tar.gz"
  URL_MD5 "d7f8e0e3ffeac721e18cdf898eff7d31"
  SOURCE_SUBDIR cmake)

Do I need to change SOURCE_SUBDIR here? And what should it point to? to the tar.gz file of my repository?

As for the clone1.bundle.cmake, do I need to create this file? If yes, then where? Because I am trying to compare with the Paraview based superbuild example which is based on simpleParaview example and I can’t find any simpleParaview.bundle.cmake there so I am a little confused.

No, the clone1 will need to add a SOURCE_SUBDIR entry. I gave the path in this comment.

Yes, you’ll need to create clone1.bundle.cmake. Probably under projects/win32. That example might not have packaging around.

I am really sorry to keep on bugging you. But I am confused and would really appreciate if you can clear my confusion.
As I said I am using Paraview based superbuild example which uses SimpleParaview and that example works fine and generated a binary file which I can install.
Because my end goal is to create binaries for my custom application (and I was told that the way to do would be to modify the Paraview based superbuild example for my custom application) so I am just trying to modify that example, for now for the Clone1 example.
As for SimpleParaview there was no SOURCE_SUBDIR in Examples/CustomApplications/SimpleParaview so I think that’s why I am confused as to how and where I need to add that.
Same is the case for clone1.bundle.cmake.
Is there any superbuild example which has these things which I can follow?

Again, thanks for your help and patience!

I don’t know…it should have needed it? protobuf does it because its top-level CMakeLists.txt is in a subdirectory.