-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from dkazanc/cmaking
CMake interface, major restructure of the package. Updated demos.
- Loading branch information
Showing
82 changed files
with
4,723 additions
and
576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2017 Edoardo Pasca | ||
# | ||
# 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 | ||
# | ||
# 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. | ||
|
||
cmake_minimum_required (VERSION 3.0) | ||
|
||
project(TomoPhantom) | ||
#https://stackoverflow.com/questions/13298504/using-cmake-with-setup-py | ||
|
||
# The version number. | ||
set (CIL_VERSION_MAJOR 0) | ||
set (CIL_VERSION_MINOR 11) | ||
set (CIL_VERSION_PATCH 0) | ||
|
||
set (CIL_VERSION '${CIL_VERSION_MAJOR}.${CIL_VERSION_MINOR}.${CIL_VERSION_PATCH}' CACHE INTERNAL "Core Imaging Library version" FORCE) | ||
|
||
# set the Python variables for the Conda environment | ||
#include(${CMAKE_SOURCE_DIR}/CMake/FindAnacondaEnvironment.cmake) | ||
|
||
set(CMAKE_BUILD_TYPE "Release") | ||
|
||
option (BUILD_MATLAB_WRAPPER "Build Matlab Wrappers" OFF) | ||
option (BUILD_PYTHON_WRAPPER "Build Python Wrappers" ON) | ||
option (CONDA_BUILD "Conda Build" OFF) | ||
|
||
add_subdirectory(Core) | ||
add_subdirectory(Wrappers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
# -*- coding: utf-8 -*- | ||
# This work is part of the Core Imaging Library developed by | ||
# Visual Analytics and Imaging System Group of the Science Technology | ||
# Facilities Council, STFC | ||
# Copyright 2018 CCPi | ||
# 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 | ||
# 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. | ||
# Code is derived from code developed by Prof. Brian Bay | ||
*/ | ||
|
||
#ifndef CCPIDEFINES_H | ||
#define CCPIDEFINES_H | ||
|
||
#if defined(_WIN32) || defined(__WIN32__) | ||
#if defined(cilDVC_EXPORTS) || defined(CCPiNexusWidget_EXPORTS) || defined(CCPi_EXPORTS)// add by CMake | ||
#define CCPI_EXPORT __declspec(dllexport) | ||
#define EXPIMP_TEMPLATE | ||
#else | ||
#define CCPI_EXPORT __declspec(dllimport) | ||
#define EXPIMP_TEMPLATE extern | ||
#endif CCPi_EXPORTS | ||
#elif defined(linux) || defined(__linux) || defined(__APPLE__) | ||
#define CCPI_EXPORT | ||
#endif | ||
|
||
// Revised: | ||
|
||
#define DAY_REV 25 | ||
#define MONTH_REV "Nov" | ||
#define YEAR_REV 2017 | ||
|
||
#define VERSION 1.30 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Copyright 2018 Edoardo Pasca | ||
#cmake_minimum_required (VERSION 3.0) | ||
|
||
project(RGL_core) | ||
#https://stackoverflow.com/questions/13298504/using-cmake-with-setup-py | ||
|
||
# The version number. | ||
|
||
#set (CIL_VERSION $ENV{CIL_VERSION} CACHE INTERNAL "Core Imaging Library version" FORCE) | ||
|
||
# conda orchestrated build | ||
message("CIL_VERSION ${CIL_VERSION}") | ||
#include (GenerateExportHeader) | ||
|
||
|
||
find_package(OpenMP REQUIRED) | ||
if (OPENMP_FOUND) | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_STATIC_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
|
||
endif() | ||
|
||
## Build the regularisers package as a library | ||
message("Creating Regularisers as a shared library") | ||
|
||
message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") | ||
message("CMAKE_C_FLAGS ${CMAKE_C_FLAGS}") | ||
message("CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}") | ||
message("CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}") | ||
message("CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS}") | ||
|
||
set(CMAKE_BUILD_TYPE "Release") | ||
|
||
if(WIN32) | ||
set (FLAGS "/DWIN32 /EHsc /DCCPi_EXPORTS") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT.lib") | ||
|
||
set (EXTRA_LIBRARIES) | ||
|
||
message("library lib: ${LIBRARY_LIB}") | ||
|
||
elseif(UNIX) | ||
set (FLAGS "-O2 -funsigned-char -Wall -Wl,--no-undefined -DCCPiReconstructionIterative_EXPORTS ") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
if (OPENMP_FOUND) | ||
set (EXTRA_LIBRARIES | ||
"gomp" | ||
"m" | ||
) | ||
else() | ||
set (EXTRA_LIBRARIES | ||
"m" | ||
) | ||
endif() | ||
endif() | ||
message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") | ||
|
||
## Build the regularisers package as a library | ||
message("Adding regularisers as a shared library") | ||
|
||
#set(CMAKE_C_COMPILER /apps/pgi/linux86-64/17.4/bin/pgcc) | ||
#set(CMAKE_C_FLAGS "-acc -Minfo -ta=tesla:cc20 -openmp") | ||
#set(CMAKE_C_FLAGS "-acc -Minfo -ta=multicore -openmp -fPIC") | ||
add_library(ctomophantom "SHARED" | ||
${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DModel_core.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DModelSino_core.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/TomoP3DModel_core.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/utils.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DSinoNum_core.c | ||
) | ||
#add_library(ctomophantom_static "STATIC" | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DModel_core.c | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DModelSino_core.c | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/TomoP3DModel_core.c | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/utils.c | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/TomoP2DSinoNum_core.c | ||
# ) | ||
target_link_libraries(ctomophantom ${EXTRA_LIBRARIES} ) | ||
include_directories(ctomophantom PUBLIC | ||
${LIBRARY_INC}/include | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
## Install | ||
|
||
set(INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin) | ||
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib) | ||
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) | ||
|
||
if (UNIX) | ||
message ("I'd install into ${CMAKE_INSTALL_PREFIX}/lib") | ||
install(TARGETS ctomophantom | ||
LIBRARY DESTINATION lib | ||
CONFIGURATIONS ${CMAKE_BUILD_TYPE} | ||
) | ||
elseif(WIN32) | ||
message ("I'd install into ${CMAKE_INSTALL_PREFIX} lib bin") | ||
install(TARGETS ctomophantom | ||
RUNTIME DESTINATION bin | ||
ARCHIVE DESTINATION lib | ||
CONFIGURATIONS ${CMAKE_BUILD_TYPE} | ||
) | ||
endif() | ||
|
||
|
||
#install(TARGETS ctomophantom | ||
# LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT lib | ||
# PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT dev | ||
# RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin | ||
# ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT lib | ||
# CONFIGURATIONS ${CMAKE_BUILD_TYPE} | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.