-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix python dest #160
Fix python dest #160
Conversation
CMakeLists.txt
Outdated
@@ -75,7 +75,10 @@ find_package(PythonInterp) | |||
find_package(PythonLibs) | |||
set (BUILD_PYTHON ${PYTHONLIBS_FOUND}) | |||
if (BUILD_PYTHON) | |||
set(PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/python") | |||
if (PYTHON_DEST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearer to say
if (NOT PYTHON_DEST)
set(...)
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that work? from the docs I understood it wouldn't with a variable
I understand that this will do the following: if This circumvents the original problem creating it as a cached variable which we fixed in #77. Does it also work when the user creates It is of course somewhat non-CMake-like as the unsuspecting user will never see the possibility of using this variable (as it won't appear in the GUI for instance). I guess we could/should document it. A possibly better alternative would be to do this trick with another cached variable, e.g. if (BUILD_PYTHON)
set(PYTHON_INSTALL_DIR "" CACHE ....)
if (PYTHON_INSTALL_DIR)
set(PYTHON_DEST "${PYTHON_INSTALL_DIR }")
else()
set(PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/python")
endif() This should work due to the rules for Opinions? Clearly, we'd have to do the same for |
CMakeLists.txt
Outdated
if (PYTHON_DEST) | ||
else() | ||
set(PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/python") | ||
endif() | ||
message(STATUS "Python libraries found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add the install location to the message
- depends on SyneRBI/SIRF#160 - fixes #107
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; no-brainer
If we're (re)allowing setting the destination, I'd rather get this right now (especially as we'll do this for SIRF, SIRF-SuperBuild and STIR). I'm therefore leaning towards the cached variable. We could call that PS: I checked that Gadgetron doesn't allow to set this. They have an internal variable for it and install in |
Even if we did use the gadgetron python things, we'd use their framework to install it - not ours. |
@KrisThielemans do you intend to have a cached variable only in the SuperBuild, or also in SIRF/STIR? To me it makes sense to have a cached variable only in the SuperBuild. Possibly in STIR, which is independent on SIRF. Who is going to install SIRF without the SuperBuild? |
Let's therefore put it in SIRF and SIRF-SuperBuild and STIR. Before going ahead, can you just do a check that with your current set-up, changing the Clearly, we'd want it for matlab as well. Just had a conversation about naming of the cached variables with @bathomas. It's not so easy to choose a name that is immediately clear to people ( |
I think |
Shouldn't |
@casperdcl I'm actually thinking that that would be the preferred way. However, the SuperBuild will always overwrite the sources directory, so you'll always loose your changes. A good enhancement would be to select whether to download SIRF or not during a SuperBuild. |
I've only ever used the SuperBuild for all my dev work and never had a problem with overwriting. Maybe I've been doing things a bit differently from everyone else? May want to add this to the discussion on Fri. |
Incidentally for those of you who have VMs and don't (can't) use docker directly, you can always use docker in your VM. This is what many windows devs in industry do https://blog.docker.com/2016/04/containers-and-vms-together/ Perhaps we could consider shipping a docker image(s) and a VM with the image, and drop the current VM? related: SyneRBI/SIRF-SuperBuild#91 |
@casperdcl, the potential problem is when using the SuperBuild, it will normally extract a revision of SIRF, so if you edit, the next run of the superbuild might get the revision again, silently removing your edits (git can be crazy). So you do have to use a Regarding shipping with docker. I have no clue if you can run interactive scripts then on the VM (without a bunch of trickery). It'd be a somewhat bad user-experience if they have to write |
- depends on SyneRBI/SIRF#160 - fixes #107
can we rebase this (removing non-surviving commits) and merge? |
things to fix first:
|
name for cached variable: |
- depends on SyneRBI/SIRF#160 - fixes #107
@casperdcl I guess so, and that might be the reason that travis fails? |
No, the reason travis failed is that the CMakeLists.txt had syntax error. Should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add this in CHANGES.md. I guess also in installation instructions (if they're on the wiki, we'd have to wait until the release I guess).
.travis.yml
Outdated
@@ -63,7 +63,7 @@ env: | |||
global: | |||
- BUILD_FLAGS="-DCMAKE_BUILD_TYPE=Release" | |||
# don't use too many threads - may crash | |||
- MAKEFLAGS="-j 2" | |||
- MAKEFLAGS="-j 1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, but is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I use 1 thread when I debug, otherwise I don't understand what's gone wrong. will put it back to 2
CMakeLists.txt
Outdated
@@ -75,18 +75,31 @@ find_package(PythonInterp) | |||
find_package(PythonLibs) | |||
set (BUILD_PYTHON ${PYTHONLIBS_FOUND}) | |||
if (BUILD_PYTHON) | |||
set(PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/python") | |||
set(PYTHON_INSTALL_DIR "" CACHE PATH "Directory of the SIRF Python modules") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to recall we chose PYTHON_DEST_DIR
to avoid confusion with "my files" vs "system files"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
damn you're right! #160 (comment)
@@ -75,18 +75,31 @@ find_package(PythonInterp) | |||
find_package(PythonLibs) | |||
set (BUILD_PYTHON ${PYTHONLIBS_FOUND}) | |||
if (BUILD_PYTHON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment saying why we do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. I'd add something like "If PYTHON_DEST_DIR is not set, we will install in ${CMAKE_INSTALL_PREFIX}/python". I know, obvious maybe...
CMakeLists.txt
Outdated
message(STATUS "Python libraries found") | ||
message(STATUS "Location of Python modules: " ${PYTHON_DEST}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confusing text. maybe "SIRF Python modules will be installed in..."
CMakeLists.txt
Outdated
set(MATLAB_DEST "${CMAKE_INSTALL_PREFIX}/matlab") | ||
endif() | ||
message(STATUS "Matlab libraries found") | ||
message(STATUS "Location of Matlab libraries: " ${MATLAB_DEST}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here obviously
#160 (comment) some clearer message to user build with 2 threads.
- related to SyneRBI/SIRF#160 - fixes (partially) #107
The
PYTHON_DEST
variable was always overwritten to `${CMAKE_INSTALL_PREFIX}/python'