polyscope icon indicating copy to clipboard operation
polyscope copied to clipboard

CMake ExternalProject

Open petrasvestartas opened this issue 3 years ago • 1 comments
trafficstars

Hi,

How you download Polyscope with its main dependencies using CMake ExternalProject command:

https://cmake.org/cmake/help/latest/module/ExternalProject.html

This is a command that downloads github repository. But it must be setup so that dependencies are included and built. Do you have any example using it?

I use this command to download Eigen, Boost, CGAL and would like to add Polyscope in the same workflow, but it is out of my learning knowledge since it is not a header only library. This is one example how I use this command in my CMake projects: https://github.com/petrasvestartas/CMAKE/blob/main/super_build/example_eigen/CMakeLists.txt

petrasvestartas avatar Jun 26 '22 20:06 petrasvestartas

I've been looking at the same thing.

You'd need to add an installation step like so https://github.com/danieldugas/polyscope/blob/master/CMakeLists.txt#L20 , which tells cmake where to export headers and the library files.

Then, in the other project,

include(ExternalProject)
file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/include)
ExternalProject_Add(polyscope_src
  GIT_REPOSITORY https://github.com/danieldugas/polyscope.git
  GIT_TAG 92aa91e198d1f886c6b3caf74a1cf9b93cc6a972
  UPDATE_COMMAND ""
  PATCH_COMMAND ""
  CONFIGURE_COMMAND cmake -DCMAKE_INSTALL_PREFIX:PATH=${CATKIN_DEVEL_PREFIX}
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ../polyscope_src
  BUILD_COMMAND make -j2
  INSTALL_COMMAND make install
)

(see for example https://github.com/danieldugas/polyscope_catkin/blob/master/CMakeLists.txt#L8 )

The problem is that the polyscope dependencies would then be missing. You could either add them to the polyscope install sequence (but potentially run into conflicts if they are already installed some other way), or install them separately.

danieldugas avatar Aug 12 '22 14:08 danieldugas