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

Add CCPi CIL to SuperBuild #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ if (BUILD_petmr_rd_tools)
list(APPEND ${PRIMARY_PROJECT_NAME}_DEPENDENCIES petmr_rd_tools)
endif()

if ("${PYTHON_STRATEGY}" STREQUAL "CONDA")
set (BUILD_CIL OFF)
endif()
if (BUILD_CIL)
list(APPEND ${PRIMARY_PROJECT_NAME}_DEPENDENCIES CIL)
endif()

ExternalProject_Include_Dependencies(${proj} DEPENDS_VAR ${PRIMARY_PROJECT_NAME}_DEPENDENCIES)

message(STATUS "")
Expand Down
129 changes: 129 additions & 0 deletions SuperBuild/External_CCPi-Framework.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#========================================================================
# Author: Benjamin A Thomas
# Author: Kris Thielemans
# Author: Edoardo Pasca
# Copyright 2017 University College London
# Copyright 2017 STFC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dates

#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) SuperBuild.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================

#This needs to be unique globally
set(proj CCPi-Framework)

# Set dependency list
set(${proj}_DEPENDENCIES "")

# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} DEPENDS_VAR ${proj}_DEPENDENCIES)

# Set external name (same as internal for now)
set(externalProjName ${proj})

set(${proj}_SOURCE_DIR "${SOURCE_ROOT_DIR}/${proj}" )
set(${proj}_BINARY_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/build" )
set(${proj}_DOWNLOAD_DIR "${SUPERBUILD_WORK_DIR}/downloads/${proj}" )
set(${proj}_STAMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/stamp" )
set(${proj}_TMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/tmp" )

if(NOT ( DEFINED "USE_SYSTEM_${externalProjName}" AND "${USE_SYSTEM_${externalProjName}}" ) )
message(STATUS "${__indent}Adding project ${proj}")

### --- Project specific additions here
set(libcilreg_Install_Dir ${SUPERBUILD_INSTALL_DIR})

#message(STATUS "HDF5_ROOT in External_SIRF: " ${HDF5_ROOT})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${SUPERBUILD_INSTALL_DIR})
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${SUPERBUILD_INSTALL_DIR})

set(ENV{CIL_VERSION} 0.10.1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why an env variable. and shouldn't it be in version_config.cmake ? also some hard-wired 0.10.1 below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for a silly reason on the CCPi package. It should be removed from it, but it's needed for the time being.

#set(CCPi-Framework_URL https://github.com/vais-ral/CCPi-Framework.git)
#set(CCPi-Framework_TAG origin/master)
message("CIL URL " ${${proj}_URL} )
message("CIL TAG " ${${proj}_TAG} )

# conda build should never get here
if("${PYTHON_STRATEGY}" STREQUAL "PYTHONPATH")
# in case of PYTHONPATH it is sufficient to copy the files to the
# $PYTHONPATH directory
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY ${${proj}_URL}
GIT_TAG ${${proj}_TAG}
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
INSTALL_DIR ${libcilreg_Install_Dir}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${${proj}_SOURCE_DIR}/Wrappers/Python/ccpi ${PYTHON_DEST}/ccpi
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${libcilreg_Install_Dir}
DEPENDS
${${proj}_DEPENDENCIES}
)

else()
# if SETUP_PY one can launch the conda build.sh script setting
# the appropriate variables.
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY ${${proj}_URL}
GIT_TAG ${${proj}_TAG}
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
INSTALL_DIR ${libcilreg_Install_Dir}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=0.10.0 SRC_DIR=${${proj}_BINARY_DIR} RECIPE_DIR=${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe PYTHON=${PYTHON_EXECUTABLE} bash ${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe/build.sh
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${libcilreg_Install_Dir}
DEPENDS
${${proj}_DEPENDENCIES}
)
endif()


set(${proj}_ROOT ${${proj}_SOURCE_DIR})
set(${proj}_INCLUDE_DIR ${${proj}_SOURCE_DIR})

else()
if(${USE_SYSTEM_${externalProjName}})
find_package(${proj} ${${externalProjName}_REQUIRED_VERSION} REQUIRED)
message("USING the system ${externalProjName}, set ${externalProjName}_DIR=${${externalProjName}_DIR}")
endif()
ExternalProject_Add_Empty(${proj} DEPENDS "${${proj}_DEPENDENCIES}"
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
)
endif()

mark_as_superbuild(
VARS
${externalProjName}_DIR:PATH
LABELS
"FIND_PACKAGE"
)
140 changes: 140 additions & 0 deletions SuperBuild/External_CCPi-RGL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#========================================================================
# Author: Benjamin A Thomas
# Author: Kris Thielemans
# Author: Edoardo Pasca
# Copyright 2017 University College London
# Copyright 2017 STFC
#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) SuperBuild.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================

#This needs to be unique globally
set(proj CCPi-RGL)

# Set dependency list
set(${proj}_DEPENDENCIES "")

# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} DEPENDS_VAR ${proj}_DEPENDENCIES)

# Set external name (same as internal for now)
set(externalProjName ${proj})

set(${proj}_SOURCE_DIR "${SOURCE_ROOT_DIR}/${proj}" )
set(${proj}_BINARY_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/build" )
set(${proj}_DOWNLOAD_DIR "${SUPERBUILD_WORK_DIR}/downloads/${proj}" )
set(${proj}_STAMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/stamp" )
set(${proj}_TMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/tmp" )

if(NOT ( DEFINED "USE_SYSTEM_${externalProjName}" AND "${USE_SYSTEM_${externalProjName}}" ) )
message(STATUS "${__indent}Adding project ${proj}")

### --- Project specific additions here
set(libcilreg_Install_Dir ${SUPERBUILD_INSTALL_DIR})

#message(STATUS "HDF5_ROOT in External_SIRF: " ${HDF5_ROOT})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${SUPERBUILD_INSTALL_DIR})
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${SUPERBUILD_INSTALL_DIR})

set(ENV{CIL_VERSION} 0.10.1)
#set(CCPi-RGL_URL https://github.com/vais-ral/CCPi-Regularisation-Toolkit.git)
#set(CCPi-RGL_TAG origin/windows_fix)
message("CIL URL " ${${proj}_URL} )
message("CIL TAG " ${${proj}_TAG} )

# conda build should never get here
if("${PYTHON_STRATEGY}" STREQUAL "PYTHONPATH")
# in case of PYTHONPATH it is sufficient to copy the files to the
# $PYTHONPATH directory
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY ${${proj}_URL}
GIT_TAG ${${proj}_TAG}
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
INSTALL_DIR ${libcilreg_Install_Dir}

#CONFIGURE_COMMAND ""
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy_directory ${${proj}_SOURCE_DIR} ${${proj}_BINARY_DIR}
COMMAND grep -vx "make install" ${${proj}_SOURCE_DIR}/recipes/regularisers/build.sh > ${${proj}_BINARY_DIR}/recipes/regularisers/build.sh
#COMMAND grep -vx "\$PYTHON setup-regularisers.py install" ${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe/build.sh > ${${proj}_BINARY_DIR}/Wrappers/Python/conda-recipe/build.sh
COMMAND sed -e "s/install/build_ext --inplace/" ${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe/build.sh > ${${proj}_BINARY_DIR}/Wrappers/Python/conda-recipe/build.sh

BUILD_COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=0.10.0 SRC_DIR=${${proj}_BINARY_DIR} RECIPE_DIR=${${proj}_SOURCE_DIR}/recipes/regularisers PYTHON=${PYTHON_EXECUTABLE} CONDA_PREFIX=${${proj}_BINARY_DIR} bash ${${proj}_BINARY_DIR}/recipes/regularisers/build.sh
COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=0.10.0 SRC_DIR=${${proj}_BINARY_DIR} RECIPE_DIR=${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe PYTHON=${PYTHON_EXECUTABLE} CONDA_PREFIX=${${proj}_BINARY_DIR} PREFIX=${libcilreg_Install_Dir} LIBRARY_PATH=${${proj}_BINARY_DIR}/build/build/:$ENV{LIBRARY_PATH} bash ${${proj}_BINARY_DIR}/Wrappers/Python/conda-recipe/build.sh

#INSTALL_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${${proj}_BINARY_DIR}/build/build/libcilreg.so ${libcilreg_Install_Dir}/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${${proj}_BINARY_DIR}/ccpi/Python/ccpi ${PYTHON_DEST}/ccpi
#BUILD_COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=0.10.0 SRC_DIR=${${proj}_BINARY_DIR} RECIPE_DIR=${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe PYTHON=${PYTHON_EXECUTABLE}
#INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${${proj}_SOURCE_DIR}/Wrappers/Python/ccpi ${PYTHON_DEST}/ccpi
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${libcilreg_Install_Dir}
DEPENDS
${${proj}_DEPENDENCIES}
)

else()
# if SETUP_PY one can launch the conda build.sh script setting
# the appropriate variables.
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY ${${proj}_URL}
GIT_TAG ${${proj}_TAG}
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
INSTALL_DIR ${libcilreg_Install_Dir}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=0.10.0 SRC_DIR=${${proj}_BINARY_DIR} RECIPE_DIR=${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe PYTHON=${PYTHON_EXECUTABLE} bash ${${proj}_SOURCE_DIR}/Wrappers/Python/conda-recipe/build.sh
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${libcilreg_Install_Dir}
DEPENDS
${${proj}_DEPENDENCIES}
)
endif()


set(${proj}_ROOT ${${proj}_SOURCE_DIR})
set(${proj}_INCLUDE_DIR ${${proj}_SOURCE_DIR})

else()
if(${USE_SYSTEM_${externalProjName}})
find_package(${proj} ${${externalProjName}_REQUIRED_VERSION} REQUIRED)
message("USING the system ${externalProjName}, set ${externalProjName}_DIR=${${externalProjName}_DIR}")
endif()
ExternalProject_Add_Empty(${proj} DEPENDS "${${proj}_DEPENDENCIES}"
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
)
endif()

mark_as_superbuild(
VARS
${externalProjName}_DIR:PATH
LABELS
"FIND_PACKAGE"
)
55 changes: 55 additions & 0 deletions SuperBuild/External_CIL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#========================================================================
# Author: Benjamin A Thomas
# Author: Kris Thielemans
# Author: Edoardo Pasca
# Copyright 2017 University College London
# Copyright 2017 STFC
#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) SuperBuild.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================

#This needs to be unique globally
set(proj CIL)

# Set dependency list
set(${proj}_DEPENDENCIES CCPi-Framework CCPi-RGL)

# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} DEPENDS_VAR ${proj}_DEPENDENCIES)

# Set external name (same as internal for now)
set(externalProjName ${proj})

set(${proj}_SOURCE_DIR "${SOURCE_ROOT_DIR}/${proj}" )
set(${proj}_BINARY_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/build" )
set(${proj}_DOWNLOAD_DIR "${SUPERBUILD_WORK_DIR}/downloads/${proj}" )
set(${proj}_STAMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/stamp" )
set(${proj}_TMP_DIR "${SUPERBUILD_WORK_DIR}/builds/${proj}/tmp" )

ExternalProject_Add_Empty(${proj} DEPENDS "${${proj}_DEPENDENCIES}"
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
STAMP_DIR ${${proj}_STAMP_DIR}
TMP_DIR ${${proj}_TMP_DIR}
)

mark_as_superbuild(
VARS
${externalProjName}_DIR:PATH
LABELS
"FIND_PACKAGE"
)
2 changes: 1 addition & 1 deletion SuperBuild/External_glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if(NOT ( DEFINED "USE_SYSTEM_${externalProjName}" AND "${USE_SYSTEM_${externalPr
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY ${${proj}_URL}
GIT_TAG ${STIR_TAG}
GIT_TAG ${${proj}_TAG}
SOURCE_DIR ${${proj}_SOURCE_DIR}
BINARY_DIR ${${proj}_BINARY_DIR}
DOWNLOAD_DIR ${${proj}_DOWNLOAD_DIR}
Expand Down
2 changes: 1 addition & 1 deletion env_ccppetmr.csh.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif
##### Environment variables for Matlab
@ENV_MATLAB_CSH@

set path=( $path @CCPPETMR_INSTALL@/bin )
set path=( @CCPPETMR_INSTALL@/bin $path )

# Export Gadgetron Home
@ENV_GADGETRON_HOME_CSH@
2 changes: 1 addition & 1 deletion env_ccppetmr.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export DYLD_FALLBACK_LIBRARY_PATH
##### Environment variables for Matlab
@ENV_MATLAB_BASH@

PATH=$PATH:@CCPPETMR_INSTALL@/bin
PATH=@CCPPETMR_INSTALL@/bin:$PATH

# Export Gadgetron Home
@ENV_GADGETRON_HOME_SH@
Loading