[ismrmrd] 141/281: Do no create the ismrmrd_xsd library. On Windows it would export symbols from std:: which caused duplicate defined symbols when linking different libraries together. Instead we now autogenerate ismrmrd.hxx and ismrmrd.cxx in the schema folder.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:07 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 50b8487a606b10e6cb159caa9215c3b93768cc7c
Author: Thomas Sangild Sorensen <sangild at cs.au.dk>
Date:   Tue Apr 16 18:12:46 2013 +0000

    Do no create the ismrmrd_xsd library. On Windows it would export symbols from std:: which caused duplicate defined symbols when linking different libraries together. Instead we now autogenerate ismrmrd.hxx and ismrmrd.cxx in the schema folder.
---
 CMakeLists.txt              | 29 ++++++++++++++---------------
 examples/c++/CMakeLists.txt | 19 +++++++++++++------
 tests/c++/CMakeLists.txt    | 12 +++++++-----
 utilities/CMakeLists.txt    | 15 +++++++--------
 4 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9eeef74..3b892d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,30 +11,33 @@ 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)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 
 find_package(XSD REQUIRED)
 find_package(XercesC REQUIRED)
+
 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)
+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(${XSD_INCLUDES} ${XSD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}/cpp)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/xsd ${XSD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}/cpp)
 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
 add_library(ismrmrd SHARED ismrmrd_hdf5.cpp)
-add_library(ismrmrd_xsd SHARED ${XSDS_SOURCES})
 
 # Process the MATLAB files
-file(GLOB MatlabMFiles  ${CMAKE_SOURCE_DIR}/matlab/+ismrmrd/*.m)
-# Convert the schema to Java Classes
-
+file(GLOB MatlabMFiles ${CMAKE_SOURCE_DIR}/matlab/+ismrmrd/*.m)
 
 #The findHDF5.cmake does not work very well on Windows, let's help it out
 IF(WIN32)
@@ -57,17 +60,13 @@ ELSE (WIN32)
 	target_link_libraries(ismrmrd ${HDF5_LIBRARIES} ${Boost_LIBRARIES})
 ENDIF(WIN32)
 
-target_link_libraries(ismrmrd_xsd ${XERCESC_LIBRARIES})
-
-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 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 DESTINATION cmake)
 INSTALL(TARGETS ismrmrd DESTINATION lib)
-INSTALL(TARGETS ismrmrd_xsd DESTINATION lib)
 INSTALL(FILES ${MatlabMFiles} DESTINATION matlab/+ismrmrd)
 
-add_subdirectory(doc)
 add_subdirectory(examples/c++)
-add_subdirectory(tests)
 add_subdirectory(utilities)
-
+add_subdirectory(tests)
+add_subdirectory(doc)
diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt
index 6620624..948db50 100644
--- a/examples/c++/CMakeLists.txt
+++ b/examples/c++/CMakeLists.txt
@@ -1,16 +1,23 @@
 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)
-       target_link_libraries(ismrmrd_create_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+
+       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)
-       target_link_libraries(ismrmrd_recon_dataset ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+
+       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(read_timing_test read_timing_test.cpp)
-       target_link_libraries(read_timing_test ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd ${FFTW3_LIBRARIES})
+
+       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)
diff --git a/tests/c++/CMakeLists.txt b/tests/c++/CMakeLists.txt
index 465da23..548ec50 100644
--- a/tests/c++/CMakeLists.txt
+++ b/tests/c++/CMakeLists.txt
@@ -1,10 +1,12 @@
 enable_testing()
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../..)
 
-add_executable(t_ndarraycontainer t_ndarraycontainer.cpp)
-target_link_libraries(t_ndarraycontainer ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd)
+SET_SOURCE_FILES_PROPERTIES(${XSDS_SOURCES} PROPERTIES GENERATED TRUE)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/schema)
+
+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)
-target_link_libraries(t_image ${XERCESC_LIBRARIES} ismrmrd ismrmrd_xsd)
+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)
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
index 5d6ff02..3d5668b 100644
--- a/utilities/CMakeLists.txt
+++ b/utilities/CMakeLists.txt
@@ -1,20 +1,19 @@
-find_package(Boost COMPONENTS program_options REQUIRED REQUIRED)
+find_package(Boost COMPONENTS program_options REQUIRED)
 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)
-
-	#Process the XSD files
-	SET(XSDS ${CMAKE_CURRENT_SOURCE_DIR}/../schema/ismrmrd.xsd)
-	SET(XSD_ARGS cxx-tree --generate-serialization)
-	WRAP_XSD(XSDS_SOURCES XSD_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/schema ${XSDS} OPTIONS ${XSD_ARGS})
-	INCLUDE_DIRECTORIES(${XSD_INCLUDES} ${XSD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR})
-
 	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

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