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

Refactor cmake includes into functions #350

Merged
merged 3 commits into from Jul 25, 2016
Merged

Conversation

@tammoippen
Copy link
Contributor

@tammoippen tammoippen commented May 19, 2016

The includes of cmake modules from NEST (within <src>/cmake/) result in executing the contained code at the include position. Due to a not optimal distribution of the code into modules in commit 7488005 at PR #213, this resulted in, e.g., incorrect building of the conngen module, if libneurosim is given.

Built-in modules    : models;precise;topology           # << conngen is missing
• • •
Use libneurosim     : Yes (LibNeurosim 1.0.0)           # although libneurosim is given
    Includes        : /path/to/libneurosim/install/include
    Libraries       : /path/to/libneurosim/install/lib/libneurosim.dylib;/path/to/libneurosim/install/lib/libpyneurosim.dylib

In this PR the cmake functionality is put into fine grain functions, e.g. each command line parameter like -Dwith-gsl=... is put into a function nest_process_with_gsl() that performs all necessary checks and linking. These functions can then be executed in the correct order.

Most of the changes in this PR is putting code into cmake functions and increasing the indent level of the function body. Thus the diff might be easier to view using Githubs whitespace ignore feature - put ?w=1 behind the diff URL like this.
Further, PARENT_SCOPE is the 'return' feature from cmake functions, but it sets the variable only in the parent scope and not in the function scope, this results in some interesting constructs like cmake/CheckExtraCompilerFeatures.cmake:98, where a local variable is set again in parent scope. Also see this discussion on PARENT_SCOPE.

I propose @jougs and @apeyser as reviewers.

@apeyser
Copy link
Contributor

@apeyser apeyser commented May 20, 2016

@tammoippen
Has this been tested on all architectures? It looks like a simple refactor, but unexpected interactions can be painful.

@tammoippen
Copy link
Contributor Author

@tammoippen tammoippen commented May 23, 2016

Have bin tested on OS X, Lubuntu 14.04 and BG/Q.

@tammoippen tammoippen force-pushed the refactor_cmake branch 3 times, most recently from 4ef6e16 to 85c6a52 Jun 10, 2016
@tammoippen
Copy link
Contributor Author

@tammoippen tammoippen commented Jun 10, 2016

@apeyser I also tested the recipes from #385 .

@jougs
Copy link
Contributor

@jougs jougs commented Jun 23, 2016

I've just reviewed the code and tested it on top of my conngen-refactoring branch. It now detects libneurosim flawlessly, which used to not work before. Nice work and 👍

@apeyser apeyser merged commit 96a2c1c into nest:master Jul 25, 2016
1 check passed
@tammoippen tammoippen deleted the refactor_cmake branch Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants