[ismrmrd] 69/281: Moved c++ example and create standalone build cmake.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:00:57 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.
commit d4bc435d2adecc0c59b35b922fc3a125676e1470
Author: Souheil Inati <souheil.inati at nih.gov>
Date: Mon Jan 14 16:57:05 2013 -0500
Moved c++ example and create standalone build cmake.
---
CMakeLists.txt | 16 +---
examples/c++/CMakeLists-Standalone.txt | 43 ++++++++++
examples/c++/CMakeLists.txt | 14 ++++
examples/c++/cmake/FindFFTW3.cmake | 93 ++++++++++++++++++++++
examples/c++/cmake/FindIsmrmrd.cmake | 29 +++++++
.../c++/test_create_dataset.cpp | 0
.../c++/test_recon_dataset.cpp | 0
7 files changed, 180 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4b2d08..15dd979 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,6 @@ set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost COMPONENTS thread system REQUIRED)
find_package(HDF5 1.8 COMPONENTS C CXX REQUIRED)
-
#Process the XSD files
SET(XSDS schema/ismrmrd.xsd)
SET(XSD_ARGS cxx-tree --generate-serialization --export-symbol EXPORTISMRMRDXSD --hxx-prologue-file ${CMAKE_SOURCE_DIR}/ismrmrd_xsd_export.h)
@@ -58,20 +57,6 @@ ENDIF(WIN32)
target_link_libraries(ismrmrd_xsd ${XERCESC_LIBRARIES})
-find_package(FFTW3 COMPONENTS single)
-IF(FFTW3_FOUND)
- MESSAGE("FFTW3 Found, building test applications")
- INCLUDE_DIRECTORIES(${FFTW3_INCLUDE_DIR})
- add_executable(ismrmrd_create_dataset test_create_dataset.cpp)
- target_link_libraries(ismrmrd_create_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
- INSTALL(TARGETS ismrmrd_create_dataset DESTINATION bin)
- add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp)
- target_link_libraries(ismrmrd_recon_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
- INSTALL(TARGETS ismrmrd_recon_dataset DESTINATION bin)
-ELSE(FFTW3_FOUND)
- MESSAGE("FFTW3 NOT Found....cannot build test applications")
-ENDIF(FFTW3_FOUND)
-
INSTALL(FILES ismrmrd.h ${XSDS_SOURCES} ismrmrd_hdf5.h ismrmrd_hdf5_datatypes.h ismrmrd_export.h DESTINATION include)
INSTALL(FILES schema/ismrmrd.xsd DESTINATION schema)
INSTALL(FILES cmake/FindIsmrmrd.cmake DESTINATION cmake)
@@ -80,3 +65,4 @@ INSTALL(TARGETS ismrmrd_xsd DESTINATION lib)
INSTALL(FILES ${MatlabMFiles} DESTINATION matlab/+ismrmrd)
add_subdirectory(doc)
+add_subdirectory(examples/c++)
diff --git a/examples/c++/CMakeLists-Standalone.txt b/examples/c++/CMakeLists-Standalone.txt
new file mode 100644
index 0000000..dbf50bc
--- /dev/null
+++ b/examples/c++/CMakeLists-Standalone.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 2.8)
+project(ISMRMRD_EXAMPLES)
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+if (WIN32)
+ADD_DEFINITIONS(-DWIN32 -D_WIN32 -D_WINDOWS)
+ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
+ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
+endif (WIN32)
+
+set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/ismrmrd)
+
+find_package(Ismrmrd REQUIRED)
+find_package(FFTW3 COMPONENTS single REQUIRED)
+
+include_directories (
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${ISMRMRD_INCLUDE_DIR}
+ ${FFTW3_INCLUDE_DIR}
+)
+
+add_executable(ismrmrd_create_dataset test_create_dataset.cpp)
+target_link_libraries(
+ ismrmrd_create_dataset
+ ${ISMRMRD_LIBRARIES}
+ ${ISMRMRD_XSD_LIBRARIES}
+ ${FFTW3_LIBRARIES}
+)
+INSTALL(TARGETS ismrmrd_create_dataset DESTINATION bin)
+
+add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp)
+target_link_libraries(
+ ismrmrd_recon_dataset
+ ${ISMRMRD_LIBRARIES}
+ ${ISMRMRD_XSD_LIBRARIES}
+ ${FFTW3_LIBRARIES}
+)
+INSTALL(TARGETS ismrmrd_recon_dataset DESTINATION bin)
+
+
diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt
new file mode 100644
index 0000000..b15c565
--- /dev/null
+++ b/examples/c++/CMakeLists.txt
@@ -0,0 +1,14 @@
+find_package(FFTW3 COMPONENTS single)
+IF(FFTW3_FOUND)
+ MESSAGE("FFTW3 Found, building test applications")
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../.. ${FFTW3_INCLUDE_DIR})
+ add_executable(ismrmrd_create_dataset test_create_dataset.cpp)
+ target_link_libraries(ismrmrd_create_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+ INSTALL(TARGETS ismrmrd_create_dataset DESTINATION bin)
+ add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp)
+ target_link_libraries(ismrmrd_recon_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+ INSTALL(TARGETS ismrmrd_recon_dataset DESTINATION bin)
+ELSE(FFTW3_FOUND)
+ MESSAGE("FFTW3 NOT Found....cannot build test applications")
+ENDIF(FFTW3_FOUND)
+
diff --git a/examples/c++/cmake/FindFFTW3.cmake b/examples/c++/cmake/FindFFTW3.cmake
new file mode 100644
index 0000000..eccfe9f
--- /dev/null
+++ b/examples/c++/cmake/FindFFTW3.cmake
@@ -0,0 +1,93 @@
+# - Try to find FFTW3.
+# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]])
+#
+# Variables used by this module:
+# FFTW3_ROOT_DIR - FFTW3 root directory
+# Variables defined by this module:
+# FFTW3_FOUND - system has FFTW3
+# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached)
+# FFTW3_INCLUDE_DIRS - the FFTW3 include directories
+# (identical to FFTW3_INCLUDE_DIR)
+# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F),
+# long-double(L) precision (cached)
+# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F),
+# long-double(L) precision (cached)
+# FFTW3_LIBRARIES - list of all FFTW3 libraries found
+
+# Copyright (C) 2009-2010
+# ASTRON (Netherlands Institute for Radio Astronomy)
+# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
+#
+# This file is part of the LOFAR software suite.
+# The LOFAR software suite is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# The LOFAR software suite is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $
+
+# Use double precision by default.
+if(FFTW3_FIND_COMPONENTS MATCHES "^$")
+ set(_components double)
+else()
+ set(_components ${FFTW3_FIND_COMPONENTS})
+endif()
+
+# Loop over each component.
+set(_libraries)
+foreach(_comp ${_components})
+ if(_comp STREQUAL "single")
+ list(APPEND _libraries fftw3f)
+ elseif(_comp STREQUAL "double")
+ list(APPEND _libraries fftw3)
+ elseif(_comp STREQUAL "long-double")
+ list(APPEND _libraries fftw3l)
+ elseif(_comp STREQUAL "threads")
+ set(_use_threads ON)
+ else(_comp STREQUAL "single")
+ message(FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. "
+ "Valid components are `single', `double', `long-double', and `threads'.")
+ endif(_comp STREQUAL "single")
+endforeach(_comp ${_components})
+
+# If using threads, we need to link against threaded libraries as well.
+if(_use_threads)
+ set(_thread_libs)
+ foreach(_lib ${_libraries})
+ list(APPEND _thread_libs ${_lib}_threads)
+ endforeach(_lib ${_libraries})
+ set(_libraries ${_thread_libs} ${_libraries})
+endif(_use_threads)
+
+# Keep a list of variable names that we need to pass on to
+# find_package_handle_standard_args().
+set(_check_list)
+
+# Search for all requested libraries.
+foreach(_lib ${_libraries})
+ string(TOUPPER ${_lib} _LIB)
+ find_library(${_LIB}_LIBRARY ${_lib}
+ HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES lib)
+ mark_as_advanced(${_LIB}_LIBRARY)
+ list(APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
+ list(APPEND _check_list ${_LIB}_LIBRARY)
+endforeach(_lib ${_libraries})
+
+# Search for the header file.
+find_path(FFTW3_INCLUDE_DIR fftw3.h
+ HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES include)
+mark_as_advanced(FFTW3_INCLUDE_DIR)
+list(APPEND _check_list FFTW3_INCLUDE_DIR)
+
+# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW3 DEFAULT_MSG ${_check_list})
diff --git a/examples/c++/cmake/FindIsmrmrd.cmake b/examples/c++/cmake/FindIsmrmrd.cmake
new file mode 100644
index 0000000..3defaf4
--- /dev/null
+++ b/examples/c++/cmake/FindIsmrmrd.cmake
@@ -0,0 +1,29 @@
+# - Find ISMRMRRD
+# ISMRMRD_FOUND - True if ISMRMRD found.
+# ISMRMRD_INCLUDE_DIR - where to find ismrmrd.h, etc.
+# ISMRMRD_LIBRARIES - libismrmrd.so.
+# ISMRMRD_XSD_LIBRARIES - libismrmrd.so.
+# ISMRMRD_SCHEMA_DIR - Where to find ismrmrd.xsd
+
+FIND_PATH( ISMRMRD_INCLUDE_DIR ismrmrd.h
+ HINTS $ENV{ISMRMRD_HOME}
+ PATHS /usr/local/ /usr/include /usr/local/include
+ PATH_SUFFIXES ismrmrd ismrmrd/include include)
+
+FIND_PATH( ISMRMRD_SCHEMA_DIR ismrmrd.xsd
+ HINTS $ENV{ISMRMRD_HOME}
+ PATHS /usr/local/ /usr/include /usr/local/include
+ PATH_SUFFIXES ismrmrd ismrmrd/schema schema)
+
+FIND_LIBRARY( ISMRMRD_LIBRARIES
+ NAMES "ismrmrd"
+ PATHS /usr/local/lib ${ISMRMRD_INCLUDE_DIR}/../lib /usr/lib )
+
+FIND_LIBRARY( ISMRMRD_XSD_LIBRARIES
+ NAMES "ismrmrd_xsd"
+ PATHS /usr/local/lib ${ISMRMRD_INCLUDE_DIR}/../lib /usr/lib )
+
+INCLUDE( "FindPackageHandleStandardArgs" )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Ismrmrd" DEFAULT_MSG ISMRMRD_INCLUDE_DIR ISMRMRD_LIBRARIES ISMRMRD_SCHEMA_DIR)
+
+MARK_AS_ADVANCED( ISMRMRD_INCLUDE_DIR ISMRMRD_LIBRARIES ISMRMRD_SCHEMA_DIR)
diff --git a/test_create_dataset.cpp b/examples/c++/test_create_dataset.cpp
similarity index 100%
rename from test_create_dataset.cpp
rename to examples/c++/test_create_dataset.cpp
diff --git a/test_recon_dataset.cpp b/examples/c++/test_recon_dataset.cpp
similarity index 100%
rename from test_recon_dataset.cpp
rename to examples/c++/test_recon_dataset.cpp
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git
More information about the debian-science-commits
mailing list