[ismrmrd] 236/281: major rewrite of cmake files

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:19 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 eabc5671f572e956f5817a32d744a27bac0044b2
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Tue May 13 12:14:15 2014 +0100

    major rewrite of cmake files
    
    Includes:
    - use of global vars for more flexible handling of paths
    - build ismrmrd_xsd library from xsd sources
    - install still provides both the generated xsd source files in schema/
      and additionally the ismrmrd_xsd library in lib/
    - on Windows, binaries are still generated using the xsd sources
    - on OSX / Linux, binaries are linked with ismrmrd_xsd instead
---
 CMakeLists.txt                 | 121 +++++++++++++++++++++++++++--------------
 bindings/java/CMakeLists.txt   |   9 ++-
 bindings/python/CMakeLists.txt |  18 +++---
 examples/c++/CMakeLists.txt    |  58 +++++++++++---------
 matlab/CMakeLists.txt          |   8 ++-
 tests/c++/CMakeLists.txt       |  28 +++++++---
 tests/c/CMakeLists.txt         |   5 +-
 utilities/CMakeLists.txt       |  44 +++++++++------
 8 files changed, 184 insertions(+), 107 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be68159..2ddf8d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,23 +3,39 @@ project(ISMRMRD)
 
 enable_testing()
 
+# define install paths globally
+set(ISMRMRD_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/ismrmrd)
+set(ISMRMRD_INSTALL_LIB_DIR ${ISMRMRD_INSTALL_PREFIX}/lib)
+set(ISMRMRD_INSTALL_INCLUDE_DIR ${ISMRMRD_INSTALL_PREFIX}/include)
+set(ISMRMRD_INSTALL_BIN_DIR ${ISMRMRD_INSTALL_PREFIX}/bin)
+set(ISMRMRD_INSTALL_MODULE_DIR ${ISMRMRD_INSTALL_PREFIX}/cmake)
+set(ISMRMRD_INSTALL_SCHEMA_DIR ${ISMRMRD_INSTALL_PREFIX}/schema)
+set(ISMRMRD_INSTALL_MATLAB_DIR ${ISMRMRD_INSTALL_PREFIX}/matlab)
+set(ISMRMRD_INSTALL_JAVA_DIR ${ISMRMRD_INSTALL_PREFIX}/java)
+set(ISMRMRD_INSTALL_PYTHON_DIR ${ISMRMRD_INSTALL_PREFIX}/python)
+set(ISMRMRD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(ISMRMRD_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+set(ISMRMRD_SCHEMA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/schema)
+set(ISMRMRD_SCHEMA_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/xsd)
+
+# add project specific cmake find modules
+list(APPEND CMAKE_MODULE_PATH ${ISMRMRD_MODULE_DIR})
+
 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")
-    SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
-    SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
-    SET (CMAKE_STATIC_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
-    SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
+    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")
+    set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
+    set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
+    set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
+    set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
 endif (WIN32)
 
-set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/ismrmrd)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-
-find_package(XSD REQUIRED)
-find_package(XercesC REQUIRED)
+# required packages for main library
+find_package(Boost COMPONENTS thread system REQUIRED)
+find_package(HDF5 1.8 COMPONENTS C CXX REQUIRED)
 
 if(WIN32)
     set(Boost_NO_BOOST_CMAKE ON)
@@ -30,39 +46,62 @@ if(WIN32)
   add_definitions( -DBOOST_ALL_DYN_LINK )
 endif(WIN32)
 
-find_package(Boost COMPONENTS thread system program_options REQUIRED)
+add_library(ismrmrd SHARED ismrmrd_hdf5.cpp)
+include_directories(${HDF5_C_INCLUDE_DIR} ${HDF5_CXX_INCLUDE_DIR}
+    ${Boost_INCLUDE_DIR})
 
-find_package(HDF5 1.8 COMPONENTS C CXX REQUIRED)
+#The findHDF5.cmake does not work very well on Windows, let's help it out
+if(WIN32)
+    target_link_libraries(ismrmrd optimized ${HDF5_hdf5_LIBRARY_RELEASE}
+        optimized ${HDF5_hdf5_cpp_LIBRARY_RELEASE})
+    target_link_libraries(ismrmrd debug ${HDF5_hdf5_LIBRARY_DEBUG}
+        debug ${HDF5_hdf5_cpp_LIBRARY_DEBUG})
+    target_link_libraries(ismrmrd ${Boost_LIBRARIES})
+else(WIN32)
+    target_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_THREAD_LIBRARY}
+        ${Boost_SYSTEM_LIBRARY})
+endif(WIN32)
+
+install(TARGETS ismrmrd
+    DESTINATION ${ISMRMRD_INSTALL_LIB_DIR})
+
+install(FILES ${ISMRMRD_SOURCE_DIR}/ismrmrd.h
+    ${ISMRMRD_SOURCE_DIR}/ismrmrd_hdf5.h
+    ${ISMRMRD_SOURCE_DIR}/ismrmrd_hdf5_datatypes.h
+    ${ISMRMRD_SOURCE_DIR}/ismrmrd_export.h
+    DESTINATION ${ISMRMRD_INSTALL_INCLUDE_DIR})
 
-#Process the XSD files
-SET(XSDS schema/ismrmrd.xsd)
-SET(XSD_ARGS cxx-tree --generate-serialization)
+# required packages for support xsd library
+find_package(XSD REQUIRED)
+find_package(XercesC REQUIRED)
+
+# process the XSD files
+set(XSDS ${ISMRMRD_SCHEMA_DIR}/ismrmrd.xsd)
+set(XSD_ARGS cxx-tree --generate-serialization)
 #SET(XSD_ARGS cxx-tree --generate-serialization --export-symbol EXPORTISMRMRDXSD --hxx-prologue-file ${CMAKE_SOURCE_DIR}/ismrmrd_xsd_export.h)
-WRAP_XSD(XSDS_SOURCES XSD_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/schema ${XSDS} OPTIONS ${XSD_ARGS})
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/xsd ${XSD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${HDF5_CXX_INCLUDE_DIR} ${HDF5_C_INCLUDE_DIR})
-LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
+wrap_xsd(XSDS_SOURCES XSD_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/schema ${XSDS}
+    OPTIONS ${XSD_ARGS})
+#include_directories(${ISMRMRD_SCHEMA_SOURCE_DIR} ${XSD_INCLUDE_DIR}
+    #${XERCESC_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${HDF5_CXX_INCLUDE_DIR}
+    #${HDF5_C_INCLUDE_DIR})
+#link_directories(${Boost_LIBRARY_DIRS})
 
-# This dummy is required to trigger autogeneration of ${XSDS_SOURCES}
-add_library(dummy SHARED ${XSDS_SOURCES})
-target_link_libraries(dummy ${XERCESC_LIBRARIES})
+add_library(ismrmrd_xsd SHARED ${XSDS_SOURCES})
+include_directories(${XERCESC_INCLUDE_DIR})
+target_link_libraries(ismrmrd_xsd ${XERCESC_LIBRARIES})
 
-# Add library ismrmrd
-add_library(ismrmrd SHARED ismrmrd_hdf5.cpp schema/ismrmrd.xsd)
+install(FILES ${XSDS} ${XSDS_SOURCES}
+    DESTINATION ${ISMRMRD_INSTALL_SCHEMA_DIR})
 
-#The findHDF5.cmake does not work very well on Windows, let's help it out
-IF(WIN32)
-    target_link_libraries(ismrmrd optimized ${HDF5_hdf5_LIBRARY_RELEASE} optimized ${HDF5_hdf5_cpp_LIBRARY_RELEASE})
-    target_link_libraries(ismrmrd debug ${HDF5_hdf5_LIBRARY_DEBUG} debug ${HDF5_hdf5_cpp_LIBRARY_DEBUG})
-    target_link_libraries(ismrmrd ${Boost_LIBRARIES})
-ELSE (WIN32)
-    target_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_LIBRARIES})
-ENDIF(WIN32)
-
-INSTALL(FILES ismrmrd.h ismrmrd_hdf5.h ismrmrd_hdf5_datatypes.h ismrmrd_export.h DESTINATION include)
-INSTALL(FILES schema/ismrmrd.xsd ${XSDS_SOURCES} DESTINATION schema)
-INSTALL(FILES cmake/FindIsmrmrd.cmake cmake/FindFFTW3.cmake cmake/FindXSD.cmake
-        cmake/FindXercesC.cmake cmake/FindNumPy.cmake DESTINATION cmake)
-INSTALL(TARGETS ismrmrd DESTINATION lib)
+install(TARGETS ismrmrd_xsd
+    DESTINATION ${ISMRMRD_INSTALL_LIB_DIR})
+
+install(FILES ${ISMRMRD_MODULE_DIR}/FindIsmrmrd.cmake
+    ${ISMRMRD_MODULE_DIR}/FindFFTW3.cmake
+    ${ISMRMRD_MODULE_DIR}/FindXSD.cmake
+    ${ISMRMRD_MODULE_DIR}/FindXercesC.cmake
+    ${ISMRMRD_MODULE_DIR}/FindNumPy.cmake
+    DESTINATION ${ISMRMRD_INSTALL_MODULE_DIR})
 
 add_subdirectory(examples/c++)
 add_subdirectory(utilities)
diff --git a/bindings/java/CMakeLists.txt b/bindings/java/CMakeLists.txt
index 1355612..503c7f9 100644
--- a/bindings/java/CMakeLists.txt
+++ b/bindings/java/CMakeLists.txt
@@ -33,9 +33,12 @@ add_custom_command(
 )
 add_custom_target(ismrmrdjar ALL DEPENDS ${JAVA_OUTPUTS})
 
-install(TARGETS jismrmrd DESTINATION java)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd.jar DESTINATION java)
+install(TARGETS jismrmrd
+    DESTINATION ${ISMRMRD_INSTALL_JAVA_DIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd.jar
+    DESTINATION ${ISMRMRD_INSTALL_JAVA_DIR})
 
 # Note: the API documentation is only for the XML header, and is installed
 # in ${INSTALL_PREFIX}/matlab/doc
-install(DIRECTORY ${JAVADOC_OUTPUT} DESTINATION matlab)
+install(DIRECTORY ${JAVADOC_OUTPUT}
+    DESTINATION ${ISMRMRD_INSTALL_MATLAB_DIR})
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index e051939..29bc524 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -15,18 +15,21 @@ IF(WIN32)
     swig_link_libraries(ismrmrd debug ${HDF5_hdf5_LIBRARY_DEBUG} debug ${HDF5_hdf5_cpp_LIBRARY_DEBUG})
     swig_link_libraries(ismrmrd ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
 ELSE (WIN32)
-    swig_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
+    swig_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_THREAD_LIBRARY}
+        ${Boost_SYSTEM_LIBRARY} ${PYTHON_LIBRARIES})
 ENDIF(WIN32)
 
-install(TARGETS ${SWIG_MODULE_ismrmrd_REAL_NAME} DESTINATION python)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd.py DESTINATION python)
+install(TARGETS ${SWIG_MODULE_ismrmrd_REAL_NAME}
+    DESTINATION ${ISMRMRD_INSTALL_PYTHON_DIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd.py
+    DESTINATION ${ISMRMRD_INSTALL_PYTHON_DIR})
 
 find_program(PYXBGEN pyxbgen
     HINTS ${PYTHON_HOME} ${PYTHON_LIBRARY}/..
     PATH_SUFFIXES bin)
 
 if(PYXBGEN)
-    set(SCHEMA "${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd")
+    set(SCHEMA "${ISMRMRD_SCHEMA_DIR}/ismrmrd.xsd")
     set(XSD_PY_FILE "${CMAKE_CURRENT_BINARY_DIR}/ismrmrd_xsd.py")
     set(XSD_PY_DIR "${CMAKE_CURRENT_BINARY_DIR}/raw")
 
@@ -39,9 +42,10 @@ if(PYXBGEN)
 
     add_custom_target(pyismrmrd_xsd ALL DEPENDS ${XSD_PY_FILE})
 
-    install(FILES ${XSD_PY_FILE} DESTINATION python)
-    install(DIRECTORY ${XSD_PY_DIR} DESTINATION python)
-
+    install(FILES ${XSD_PY_FILE}
+        DESTINATION ${ISMRMRD_INSTALL_PYTHON_DIR})
+    install(DIRECTORY ${XSD_PY_DIR}
+        DESTINATION ${ISMRMRD_INSTALL_PYTHON_DIR})
 else(PYXBGEN)
     message("Can't find pyxbgen executable. Not building ismrmrd_xsd.py")
 endif(PYXBGEN)
diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt
index 7eee4c4..93b268c 100644
--- a/examples/c++/CMakeLists.txt
+++ b/examples/c++/CMakeLists.txt
@@ -1,28 +1,36 @@
 find_package(FFTW3 COMPONENTS single)
 
-SET_SOURCE_FILES_PROPERTIES(${XSDS_SOURCES} PROPERTIES GENERATED TRUE )
-
-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 ${XSDS_SOURCES})
-       target_link_libraries(ismrmrd_create_dataset ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
-       INSTALL(TARGETS ismrmrd_create_dataset DESTINATION bin)
-
-       add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp ${XSDS_SOURCES})
-       target_link_libraries(ismrmrd_recon_dataset ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
-       INSTALL(TARGETS ismrmrd_recon_dataset DESTINATION bin)
-
-       add_executable(ismrmrd_publication_recon publication_recon_dataset.cpp ${XSDS_SOURCES})
-       target_link_libraries(ismrmrd_publication_recon ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
-       INSTALL(TARGETS ismrmrd_publication_recon DESTINATION bin)
-
-       add_executable(read_timing_test read_timing_test.cpp ${XSDS_SOURCES})
-       target_link_libraries(read_timing_test ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
-       INSTALL(TARGETS read_timing_test DESTINATION bin)
-
-ELSE(FFTW3_FOUND)
-       MESSAGE("FFTW3 NOT Found....cannot build test applications")
-ENDIF(FFTW3_FOUND)
+if(FFTW3_FOUND)
+    message("FFTW3 Found, building examples")
+    include_directories(${ISMRMRD_SOURCE_DIR} ${ISMRMRD_SCHEMA_SOURCE_DIR}
+        ${FFTW3_INCLUDE_DIR})
+    if(WIN32)
+        # building with xsd sources on Windows
+        set_source_files_properties(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
+        add_executable(ismrmrd_create_dataset test_create_dataset.cpp ${XSDS_SOURCES})
+        target_link_libraries(ismrmrd_create_dataset ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
+        add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp ${XSDS_SOURCES})
+        target_link_libraries(ismrmrd_recon_dataset ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
+        add_executable(ismrmrd_publication_recon publication_recon_dataset.cpp ${XSDS_SOURCES})
+        target_link_libraries(ismrmrd_publication_recon ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
+        add_executable(read_timing_test read_timing_test.cpp ${XSDS_SOURCES})
+        target_link_libraries(read_timing_test ${XERCESC_LIBRARIES} ismrmrd ${FFTW3_LIBRARIES})
+    else(WIN32)
+        # linking with ismrmrd_xsd on Linux / OSX
+        add_executable(ismrmrd_create_dataset test_create_dataset.cpp)
+        target_link_libraries(ismrmrd_create_dataset ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+        add_executable(ismrmrd_recon_dataset test_recon_dataset.cpp)
+        target_link_libraries(ismrmrd_recon_dataset ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+        add_executable(ismrmrd_publication_recon publication_recon_dataset.cpp)
+        target_link_libraries(ismrmrd_publication_recon ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+        add_executable(read_timing_test read_timing_test.cpp)
+        target_link_libraries(read_timing_test ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+    endif(WIN32)
+    install(TARGETS ismrmrd_create_dataset DESTINATION ${ISMRMRD_INSTALL_BIN_DIR})
+    install(TARGETS ismrmrd_recon_dataset DESTINATION ${ISMRMRD_INSTALL_BIN_DIR})
+    install(TARGETS ismrmrd_publication_recon DESTINATION ${ISMRMRD_INSTALL_BIN_DIR})
+    install(TARGETS read_timing_test DESTINATION ${ISMRMRD_INSTALL_BIN_DIR})
+else(FFTW3_FOUND)
+       message("FFTW3 NOT Found, cannot build examples")
+endif(FFTW3_FOUND)
 
diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt
index 2b92ab0..9af92d6 100644
--- a/matlab/CMakeLists.txt
+++ b/matlab/CMakeLists.txt
@@ -4,7 +4,7 @@ if (NOT JAVA_FOUND)
     message(STATUS "Java (xjc) Not Found - Not generating XML bindings")
 else (NOT JAVA_FOUND)
 
-    set(ISMRMRD_SCHEMA ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd)
+    set(ISMRMRD_SCHEMA "${ISMRMRD_SCHEMA_DIR}/ismrmrd.xsd")
     set(ISMRMRD_JAR "${CMAKE_CURRENT_BINARY_DIR}/ismrmrd-matlab.jar")
     set(ISMRMRD_PACKAGE "org/ismrm/ismrmrd")
     set(ISMRMRD_PACKAGE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${ISMRMRD_PACKAGE}")
@@ -68,5 +68,7 @@ else (NOT JAVA_FOUND)
     add_custom_target(ismrmrd-matlab-jar ALL DEPENDS ${ISMRMRD_JAR})
 endif(NOT JAVA_FOUND)
 
-INSTALL(DIRECTORY +ismrmrd DESTINATION matlab)
-INSTALL(FILES ${ISMRMRD_JAR} DESTINATION matlab/+ismrmrd/+util)
+install(DIRECTORY +ismrmrd
+    DESTINATION ${ISMRMRD_INSTALL_MATLAB_DIR})
+install(FILES ${ISMRMRD_JAR}
+    DESTINATION ${ISMRMRD_INSTALL_MATLAB_DIR}/+ismrmrd/+util)
diff --git a/tests/c++/CMakeLists.txt b/tests/c++/CMakeLists.txt
index 548ec50..d20b9be 100644
--- a/tests/c++/CMakeLists.txt
+++ b/tests/c++/CMakeLists.txt
@@ -1,12 +1,22 @@
 enable_testing()
 
-SET_SOURCE_FILES_PROPERTIES(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/schema)
+include_directories(${ISMRMRD_SOURCE_DIR} ${ISMRMRD_SCHEMA_SOURCE_DIR})
 
-add_executable(t_ndarraycontainer t_ndarraycontainer.cpp )
-target_link_libraries(t_ndarraycontainer ${XERCESC_LIBRARIES} ismrmrd)
-add_test(t_ndarraycontainer ${CMAKE_CURRENT_BINARY_DIR}/t_ndarraycontainer)
-
-add_executable(t_image t_image.cpp ${XSDS_SOURCES})
-target_link_libraries(t_image ${XERCESC_LIBRARIES} ismrmrd)
-add_test(t_image ${CMAKE_CURRENT_BINARY_DIR}/t_image)
+if(WIN32)
+    # building with xsd sources on Windows
+    set_source_files_properties(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
+    add_executable(t_ndarraycontainer t_ndarraycontainer.cpp ${XSDS_SOURCES})
+    target_link_libraries(t_ndarraycontainer ${XERCESC_LIBRARIES} ismrmrd)
+    add_test(t_ndarraycontainer ${CMAKE_CURRENT_BINARY_DIR}/t_ndarraycontainer)
+    add_executable(t_image t_image.cpp ${XSDS_SOURCES})
+    target_link_libraries(t_image ${XERCESC_LIBRARIES} ismrmrd)
+    add_test(t_image ${CMAKE_CURRENT_BINARY_DIR}/t_image)
+else(WIN32)
+    # linking with ismrmrd_xsd on Linux / OSX
+    add_executable(t_ndarraycontainer t_ndarraycontainer.cpp)
+    target_link_libraries(t_ndarraycontainer ismrmrd ismrmrd_xsd)
+    add_test(t_ndarraycontainer ${CMAKE_CURRENT_BINARY_DIR}/t_ndarraycontainer)
+    add_executable(t_image t_image.cpp)
+    target_link_libraries(t_image ismrmrd ismrmrd_xsd)
+    add_test(t_image ${CMAKE_CURRENT_BINARY_DIR}/t_image)
+endif(WIN32)
diff --git a/tests/c/CMakeLists.txt b/tests/c/CMakeLists.txt
index fdd26f8..8fdcc1b 100644
--- a/tests/c/CMakeLists.txt
+++ b/tests/c/CMakeLists.txt
@@ -1,10 +1,11 @@
 enable_testing()
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
+include_directories(${ISMRMRD_SOURCE_DIR})
 
 add_executable(t_cstructs t_cstructs.cpp)
 add_test(t_cstructs ${CMAKE_CURRENT_BINARY_DIR}/t_cstructs)
 
-add_executable(t_cquaternions ../../ismrmrd.h t_cquaternions.cpp)
+#add_executable(t_cquaternions ../../ismrmrd.h t_cquaternions.cpp)
+add_executable(t_cquaternions t_cquaternions.cpp)
 add_test(t_cquaternions ${CMAKE_CURRENT_BINARY_DIR}/t_cquaternions)
 
 if (NOT WIN32)
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
index 3d5668b..003adbd 100644
--- a/utilities/CMakeLists.txt
+++ b/utilities/CMakeLists.txt
@@ -1,19 +1,29 @@
-find_package(Boost COMPONENTS program_options REQUIRED)
+find_package(Boost COMPONENTS program_options)
 find_package(FFTW3 COMPONENTS single)
 
-SET_SOURCE_FILES_PROPERTIES(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..  ${Boost_INCLUDE_DIR})
-
-ADD_LIBRARY(ismrmrd_utilities SHARED ismrmrd_phantom.cpp)
-INSTALL(TARGETS ismrmrd_utilities DESTINATION lib)
-
-IF(FFTW3_FOUND)
-	INCLUDE_DIRECTORIES(${FFTW3_INCLUDE_DIR})
-	ADD_EXECUTABLE(ismrmrd_generate_cartesian_shepp_logan generate_cartesian_shepp_logan.cpp ${XSDS_SOURCES})
-if(WIN32)
-	TARGET_LINK_LIBRARIES(ismrmrd_generate_cartesian_shepp_logan ismrmrd_utilities ismrmrd ${FFTW3_LIBRARIES} ${XERCESC_LIBRARIES})
-else(WIN32)
-	TARGET_LINK_LIBRARIES(ismrmrd_generate_cartesian_shepp_logan ismrmrd_utilities ismrmrd ${FFTW3_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES})
-endif(WIN32)
-	INSTALL(TARGETS ismrmrd_generate_cartesian_shepp_logan DESTINATION bin)
-ENDIF(FFTW3_FOUND)
\ No newline at end of file
+if(FFTW3_FOUND)
+	message("FFTW3 Found, building utilities")
+	include_directories(${ISMRMRD_SOURCE_DIR} ${ISMRMRD_SCHEMA_SOURCE_DIR}
+		${Boost_INCLUDE_DIR} ${FFTW3_INCLUDE_DIR})
+	add_library(ismrmrd_utilities SHARED ismrmrd_phantom.cpp)
+	install(TARGETS ismrmrd_utilities DESTINATION ${ISMRMRD_INSTALL_LIB_DIR})	
+	
+	if(WIN32)
+		set_source_files_properties(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
+		add_executable(ismrmrd_generate_cartesian_shepp_logan
+			generate_cartesian_shepp_logan.cpp ${XSDS_SOURCES})
+		target_link_libraries(ismrmrd_generate_cartesian_shepp_logan
+			ismrmrd ismrmrd_utilities ${Boost_LIBRARIES} ${FFTW3_LIBRARIES}
+			${XERCESC_LIBRARIES})
+	else(WIN32)
+		add_executable(ismrmrd_generate_cartesian_shepp_logan
+			generate_cartesian_shepp_logan.cpp)
+		target_link_libraries(ismrmrd_generate_cartesian_shepp_logan
+			ismrmrd ismrmrd_utilities ismrmrd_xsd
+			${Boost_PROGRAM_OPTIONS_LIBRARY} ${FFTW3_LIBRARIES})
+	endif(WIN32)
+		install(TARGETS ismrmrd_generate_cartesian_shepp_logan
+			DESTINATION ${ISMRMRD_INSTALL_BIN_DIR})
+else(FFTW3_FOUND)
+	message("FFTW3 NOT Found, cannot build utilities")
+endif(FFTW3_FOUND)

-- 
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