Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not modify source directory during build #270

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

wxmerkt
Copy link
Member

@wxmerkt wxmerkt commented Nov 28, 2019

This separates out two commits from #269. No need to merge them now, but to keep open for inclusion in next minor release.

@ahornung
Copy link
Member

ahornung commented Dec 4, 2019

Here's the related issue and previous discussion: #133

@mwoehlke-kitware
Copy link

ninja: error: '/tmp/octomap-src/octovis/src/extern/QGLViewer/libQGLViewer.so', needed by 'octovis/lib/liboctovis.so.1.9.1', missing and no known rule to make it

...?

@mwoehlke-kitware
Copy link

Ugh. Okay, for testing, I'd deleted source tree artifacts. Apparently, that gets built at configure time? Yuck. It's also still in the source tree:

$ git status --ignored
On branch wxm-do-not-modify-source
Ignored files:
  (use "git add -f <file>..." to include in what will be committed)
        octovis/src/extern/QGLViewer/.moc/
        octovis/src/extern/QGLViewer/.obj/
        octovis/src/extern/QGLViewer/Makefile
        octovis/src/extern/QGLViewer/libQGLViewer.prl
        octovis/src/extern/QGLViewer/libQGLViewer.so
        octovis/src/extern/QGLViewer/libQGLViewer.so.2
        octovis/src/extern/QGLViewer/libQGLViewer.so.2.6
        octovis/src/extern/QGLViewer/libQGLViewer.so.2.6.3
        octovis/src/extern/QGLViewer/ui_ImageInterface.h
        octovis/src/extern/QGLViewer/ui_VRenderInterface.h

...but at least things seem better with this PR than without...

@wxmerkt
Copy link
Member Author

wxmerkt commented Dec 5, 2019

Hi @mwoehlke-kitware,
I forgot to add that you need to clean the source directory with git clean -fdx to test the changes. This PR is a first step but not yet complete: Ideally, the included QGLViewer gets either built to the build directory when required (e.g., as an ExternalProject) at build time or removed completely now that it appears to be available as binaries on most distributions?

Looking forward to get your expertise and insights on next steps as well :-).

Best wishes,
Wolfgang

@ahornung
Copy link
Member

ahornung commented Dec 5, 2019

Yes, the inclusion / build of the bundled QGLViewer is still quite messy. Currently the Find... script tries to find or build it (related issue: #225).

Nowadays, an ExternalProjct would be the best solution, which was not available back then. Due to the common availability of QGLViewer, we could also just remove the bundled version.

@mwoehlke-kitware
Copy link

I'm not sure even ExternalProject is necessary... the pattern I usually see is to have an option whether to use the internal version or not. (A failed attempt to find an external version might set the default value of this.) If using the internal version, just add it as another target to the build.

Roughly¹:

find_package(QGLViewer)
if(QGLViewer_FOUND)
  set(_use_qglviewer_default OFF)
else()
  set(_use_qglviewer_default OFF)
endif()
option(OCTOMAP_USE_BUNDLED_QGLVIEWER "..." ${_use_qglviewer_default})
if(OCTOMAP_USE_BUNDLED_QGLVIEWER)
  set(QGLViewer_LIBRARIES QGLViewer)
  add_subdirectory(thirdparty/QGLViewer)
else()
  find_package(QGLViewer REQUIRED)
endif()

It's actually very difficult to (correctly) use external projects to build dependencies unless you use the "superbuild" pattern.

(¹ This is off the top of my head without checking the sources, and should be considered pseudo-code. In particular, variable names may be wrong.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants