Commit 62fe1244 authored by Brian Panneton's avatar Brian Panneton

ENH: Initial Windows Conversion

parent 4a43c7b4
...@@ -19,6 +19,34 @@ ...@@ -19,6 +19,34 @@
ENDIF(NOT ("${dependencies}" STREQUAL "")) ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_CXX_DEPENDENCIES dependencies) ENDMACRO(ADD_TEST_CXX_DEPENDENCIES dependencies)
# Cxx Add LDPath Macro
# Author: Brian Panneton
# Description: This macro adds the cxx test ldpaths.
# Parameters:
# ld = any ldpaths needed for cxx tests
MACRO(ADD_TEST_CXX_LDPATH ld)
GET_PROPERTY(ldpath GLOBAL PROPERTY CXX_TEST_LDPATH)
IF("${ld}" STRGREATER "")
SET_PROPERTY(GLOBAL PROPERTY CXX_TEST_LDPATH
"${ldpath}${sep}${ld}"
)
ENDIF("${ld}" STRGREATER "")
ENDMACRO(ADD_TEST_CXX_LDPATH ld)
# Cxx Add Path Macro
# Author: Brian Panneton
# Description: This macro adds the cxx test paths.
# Parameters:
# p = any paths needed for cxx tests
MACRO(ADD_TEST_CXX_PATH p)
GET_PROPERTY(path GLOBAL PROPERTY CXX_TEST_PATH)
IF("${p}" STRGREATER "")
SET_PROPERTY(GLOBAL PROPERTY CXX_TEST_PATH
"${path}${sep}${p}"
)
ENDIF("${p}" STRGREATER "")
ENDMACRO(ADD_TEST_CXX_PATH p)
# CXX Test Macro # CXX Test Macro
# Author: Brian Panneton # Author: Brian Panneton
# Description: This macro builds and add the cxx test in one shot. # Description: This macro builds and add the cxx test in one shot.
...@@ -38,10 +66,32 @@ ...@@ -38,10 +66,32 @@
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx) ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES) GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES)
GET_PROPERTY(cxx_ldpath GLOBAL PROPERTY CXX_TEST_LDPATH)
GET_PROPERTY(cxx_path GLOBAL PROPERTY CXX_TEST_PATH)
TARGET_LINK_LIBRARIES(${executable}${dup} ${cxx_dependencies}) TARGET_LINK_LIBRARIES(${executable}${dup} ${cxx_dependencies})
# Take care of windowisims
IF(WIN32)
SET_TARGET_PROPERTIES(${executable}${dup} PROPERTIES
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${cxx_binary_dir}
LIBRARY_OUTPUT_DIRECTORY ${cxx_binary_dir}
ARCHIVE_OUTPUT_DIRECTORY ${cxx_binary_dir})
IF("${cxx_path}" STREQUAL "")
SET(cxx_path ${cxx_ldpath})
ENDIF("${cxx_path}" STREQUAL "")
ENDIF(WIN32)
SET_CORE("${cxx_binary_dir}") SET_CORE("${cxx_binary_dir}")
ADD_TEST(Cxx${is_core}_${executable}${dup} ${executable}${dup} ${arguments}) ADD_TEST(Cxx${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}"
-D "LDPATH=${cxx_ldpath}"
-D "PATH=${cxx_path}"
-D "SEPARATOR=${sep}"
-P "${cxx_binary_dir}/TestDriverCxx.cmake"
)
ENDMACRO(ADD_TEST_CXX executable) ENDMACRO(ADD_TEST_CXX executable)
# CXX Clean Macro # CXX Clean Macro
...@@ -55,3 +105,7 @@ ...@@ -55,3 +105,7 @@
ADDITIONAL_MAKE_CLEAN_FILES ${ARGN} ADDITIONAL_MAKE_CLEAN_FILES ${ARGN}
) )
ENDMACRO(CLEAN_TEST_CXX executable) ENDMACRO(CLEAN_TEST_CXX executable)
# Configure the cxx 'driver' file
CONFIGURE_FILE(${TESTING_SUITE_DIR}/TestingSuite/TestDriverCxx.cmake.in ${cxx_binary_dir}/TestDriverCxx.cmake @ONLY)
...@@ -40,7 +40,7 @@ MACRO(ADD_TEST_JAVA_CLASSPATH cp) ...@@ -40,7 +40,7 @@ MACRO(ADD_TEST_JAVA_CLASSPATH cp)
GET_PROPERTY(classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH) GET_PROPERTY(classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
IF(NOT ("${cp}" STREQUAL "")) IF(NOT ("${cp}" STREQUAL ""))
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_CLASSPATH SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_CLASSPATH
"${classpath}:${cp}" "${classpath}${sep}${cp}"
) )
ENDIF(NOT ("${cp}" STREQUAL "")) ENDIF(NOT ("${cp}" STREQUAL ""))
ENDMACRO(ADD_TEST_JAVA_CLASSPATH cp) ENDMACRO(ADD_TEST_JAVA_CLASSPATH cp)
...@@ -54,11 +54,25 @@ MACRO(ADD_TEST_JAVA_LDPATH ld) ...@@ -54,11 +54,25 @@ MACRO(ADD_TEST_JAVA_LDPATH ld)
GET_PROPERTY(ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH) GET_PROPERTY(ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
IF("${ld}" STRGREATER "") IF("${ld}" STRGREATER "")
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_LDPATH SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_LDPATH
"${ldpath}:${ld}" "${ldpath}${sep}${ld}"
) )
ENDIF("${ld}" STRGREATER "") ENDIF("${ld}" STRGREATER "")
ENDMACRO(ADD_TEST_JAVA_LDPATH ld) ENDMACRO(ADD_TEST_JAVA_LDPATH ld)
# Java Add Path Macro
# Author: Brian Panneton
# Description: This macro adds the java test paths.
# Parameters:
# p = any paths needed for java tests
MACRO(ADD_TEST_JAVA_PATH p)
GET_PROPERTY(path GLOBAL PROPERTY JAVA_TEST_PATH)
IF("${p}" STRGREATER "")
SET_PROPERTY(GLOBAL PROPERTY JAVA_TEST_PATH
"${path}${sep}${p}"
)
ENDIF("${p}" STRGREATER "")
ENDMACRO(ADD_TEST_JAVA_PATH p)
# Add Java Test Macro # Add Java Test Macro
# Author: Brian Panneton # Author: Brian Panneton
# Description: This macro builds and adds the java test in one shot. There is # Description: This macro builds and adds the java test in one shot. There is
...@@ -76,6 +90,7 @@ MACRO(ADD_TEST_JAVA executable) ...@@ -76,6 +90,7 @@ MACRO(ADD_TEST_JAVA executable)
JAVA_TEST_FILE_DEPENDENCIES) JAVA_TEST_FILE_DEPENDENCIES)
GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH) GET_PROPERTY(java_classpath GLOBAL PROPERTY JAVA_TEST_CLASSPATH)
GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH) GET_PROPERTY(java_ldpath GLOBAL PROPERTY JAVA_TEST_LDPATH)
GET_PROPERTY(java_path GLOBAL PROPERTY JAVA_TEST_PATH)
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${java_binary_dir}/${executable}.class OUTPUT ${java_binary_dir}/${executable}.class
...@@ -83,22 +98,30 @@ MACRO(ADD_TEST_JAVA executable) ...@@ -83,22 +98,30 @@ MACRO(ADD_TEST_JAVA executable)
DEPENDS ${java_source_dir}/${executable}.java DEPENDS ${java_source_dir}/${executable}.java
${java_file_dependencies} ${java_file_dependencies}
COMMAND ${JAVA_COMPILE} COMMAND ${JAVA_COMPILE}
ARGS -cp '${java_classpath}' ARGS -cp "\"${java_classpath}\""
-d '${java_binary_dir}' -d "\"${java_binary_dir}\""
${java_source_dir}/${executable}.java ${java_source_dir}/${executable}.java
) )
SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_TARGETS "${java_binary_dir}/${executable}.class") SET_PROPERTY(GLOBAL APPEND PROPERTY JAVA_TEST_TARGETS "${java_binary_dir}/${executable}.class")
# Dlls need to be in the path dir for java
IF(WIN32)
IF("${java_path}" STREQUAL "")
SET(java_path ${java_ldpath})
ENDIF("${java_path}" STREQUAL "")
ENDIF(WIN32)
SET_CORE("${java_binary_dir}") SET_CORE("${java_binary_dir}")
ADD_TEST(Java${is_core}_${executable}${dup} ${CMAKE_COMMAND} ADD_TEST(Java${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D EXECUTABLE=${executable} -D "EXECUTABLE=${executable}"
-D ARGUMENTS=${arguments} -D "ARGUMENTS=${arguments}"
-D CLASSPATH=${java_classpath} -D "CLASSPATH=${java_classpath}"
-D LDPATH=${java_ldpath} -D "LDPATH=${java_ldpath}"
-P ${java_binary_dir}/TestDriverJava.cmake -D "PATH=${java_path}"
-D "SEPARATOR=${sep}"
-P "${java_binary_dir}/TestDriverJava.cmake"
) )
ENDMACRO(ADD_TEST_JAVA executable) ENDMACRO(ADD_TEST_JAVA executable)
# Java Clean Macro # Java Clean Macro
......
...@@ -41,7 +41,7 @@ MACRO(ADD_TEST_PYTHON_PYTHONPATH pyp) ...@@ -41,7 +41,7 @@ MACRO(ADD_TEST_PYTHON_PYTHONPATH pyp)
GET_PROPERTY(pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH) GET_PROPERTY(pythonpath GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH)
IF(NOT ("${pyp}" STREQUAL "")) IF(NOT ("${pyp}" STREQUAL ""))
SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH SET_PROPERTY(GLOBAL PROPERTY PYTHON_TEST_PYTHONPATH
"${pythonpath}:${pyp}" "${pythonpath}${sep}${pyp}"
) )
ENDIF(NOT ("${pyp}" STREQUAL "")) ENDIF(NOT ("${pyp}" STREQUAL ""))
ENDMACRO(ADD_TEST_PYTHON_PYTHONPATH cp) ENDMACRO(ADD_TEST_PYTHON_PYTHONPATH cp)
...@@ -82,13 +82,12 @@ MACRO(ADD_TEST_PYTHON executable) ...@@ -82,13 +82,12 @@ MACRO(ADD_TEST_PYTHON executable)
SET_CORE("${python_binary_dir}") SET_CORE("${python_binary_dir}")
ADD_TEST(Python${is_core}_${executable}${dup} ${CMAKE_COMMAND} ADD_TEST(Python${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D EXECUTABLE=${executable} -D "EXECUTABLE=${executable}"
-D ARGUMENTS=${arguments} -D "ARGUMENTS=${arguments}"
-D PYTHONPATH=${python_pythonpath} -D "PYTHONPATH=${python_pythonpath}"
-P ${python_binary_dir}/TestDriverPython.cmake -D "SEPARATOR=${sep}"
-P "${python_binary_dir}/TestDriverPython.cmake"
) )
ENDMACRO(ADD_TEST_PYTHON executable) ENDMACRO(ADD_TEST_PYTHON executable)
# Python Clean Macro # Python Clean Macro
......
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
MESSAGE("| Calling:\t${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS(
COMMAND ${EXECUTABLE} ${ARGUMENTS}
RESULT_VARIABLE cxx_result
OUTPUT_VARIABLE cxx_output
ERROR_VARIABLE cxx_error
)
MESSAGE("| Call Result:\t${cxx_result}")
MESSAGE("| Call Output: Begin\n${cxx_output}")
MESSAGE("| Call Output: End")
IF(cxx_error)
MESSAGE("| Call Error: Begin\n${cxx_error}")
MESSAGE("| Call Error: End")
ENDIF(cxx_error)
MESSAGE("| Call Ended")
MESSAGE("----------------------------------------------------------")
# Let's make sure that if the test failed, it failed with CTest too
IF(cxx_error)
MESSAGE(SEND_ERROR "Test Failed.")
ENDIF(cxx_error)
IF(NOT ${cxx_result} EQUAL "0")
MESSAGE(SEND_ERROR "Test Failed.")
ENDIF(NOT ${cxx_result} EQUAL "0")
SET(java_runtime @JAVA_RUNTIME@) SET(java_runtime @JAVA_RUNTIME@)
SET(java_binary_dir @CMAKE_CURRENT_BINARY_DIR@) SET(java_binary_dir @CMAKE_CURRENT_BINARY_DIR@)
IF(WIN32) SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
STRING(REGEX REPLACE ":" ";" CLASSPATH ${CLASSPATH}) SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
ENDIF(WIN32) SET(ENV{CLASSPATH} "${CLASSPATH}${SEPARATOR}$ENV{CLASSPATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}:$ENV{LD_LIBRARY_PATH}")
SET(ENV{CLASSPATH} "${CLASSPATH}:$ENV{CLASSPATH}")
MESSAGE("| Calling:\t${java_runtime} ${EXECUTABLE} ${ARGUMENTS}") MESSAGE("| Calling:\t${java_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS( EXECUTE_PROCESS(
......
SET(python_runtime @PYTHON_EXECUTABLE@) SET(python_runtime @PYTHON_EXECUTABLE@)
SET(python_binary_dir @CMAKE_CURRENT_BINARY_DIR@) SET(python_binary_dir @CMAKE_CURRENT_BINARY_DIR@)
IF(WIN32) SET(ENV{PYTHONPATH} "${PYTHONPATH}${SEPARATOR}$ENV{PYTHONPATH}")
STRING(REGEX REPLACE ":" ";" PYTHONPATH ${PYTHONPATH})
ENDIF(WIN32)
SET(ENV{PYTHONPATH} "${PYTHONPATH}:$ENV{PYTHONPATH}")
MESSAGE("| Calling:\t${python_runtime} ${EXECUTABLE} ${ARGUMENTS}") MESSAGE("| Calling:\t${python_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS( EXECUTE_PROCESS(
......
...@@ -4,12 +4,22 @@ SET(defines ...@@ -4,12 +4,22 @@ SET(defines
JAVA_TEST_FILE_DEPENDENCIES JAVA_TEST_FILE_DEPENDENCIES
JAVA_TEST_CLASSPATH JAVA_TEST_CLASSPATH
JAVA_TEST_LDPATH JAVA_TEST_LDPATH
JAVA_TEST_PATH
JAVA_TEST_TARGETS JAVA_TEST_TARGETS
PYTHON_TEST_DEPENDENCIES PYTHON_TEST_DEPENDENCIES
PYTHON_TEST_FILE_DEPENDENCIES PYTHON_TEST_FILE_DEPENDENCIES
CXX_TEST_DEPENDENCIES CXX_TEST_DEPENDENCIES
CXX_TEST_LDPATH
CXX_TEST_PATH
) )
# Take care of Windows Path Seperators
IF(WIN32)
SET(sep ";")
ELSE(WIN32)
SET(sep ":")
ENDIF(WIN32)
# Make sure they are defined # Make sure they are defined
FOREACH(def IN LISTS defines) FOREACH(def IN LISTS defines)
GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED) GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED)
......
...@@ -67,6 +67,17 @@ if(XDMF_WRAP_PYTHON) ...@@ -67,6 +67,17 @@ if(XDMF_WRAP_PYTHON)
if("${ARGN}" STRGREATER "") if("${ARGN}" STRGREATER "")
add_dependencies(${python_name} "${ARGN}") add_dependencies(${python_name} "${ARGN}")
endif("${ARGN}" STRGREATER "") endif("${ARGN}" STRGREATER "")
if(WIN32)
set_target_properties(${SWIG_MODULE_${python_name}_REAL_NAME}
PROPERTIES
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/${python_name}.py install(FILES ${CMAKE_BINARY_DIR}/${python_name}.py
DESTINATION lib/python) DESTINATION lib/python)
install(TARGETS ${SWIG_MODULE_${python_name}_REAL_NAME} install(TARGETS ${SWIG_MODULE_${python_name}_REAL_NAME}
...@@ -98,6 +109,22 @@ if(XDMF_WRAP_JAVA) ...@@ -98,6 +109,22 @@ if(XDMF_WRAP_JAVA)
set_source_files_properties(${java_name}.i PROPERTIES CPLUSPLUS ON) set_source_files_properties(${java_name}.i PROPERTIES CPLUSPLUS ON)
swig_add_module(${java_name}Java java ${java_name}.i) swig_add_module(${java_name}Java java ${java_name}.i)
swig_link_libraries(${java_name}Java ${java_name}) swig_link_libraries(${java_name}Java ${java_name})
if(WIN32)
set_target_properties(${SWIG_MODULE_${java_name}Java_REAL_NAME}
PROPERTIES
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
set(java_compile_args "-cp \"\\\"${CMAKE_BINARY_DIR}/*.jar\\\"\" *.java")
set(java_dest "bin")
else(WIN32)
set(java_compile_args -cp '${CMAKE_BINARY_DIR}/*' ${XDMF_JAVA_DIR}/*.java)
set(java_dest "lib/java")
endif(WIN32)
add_custom_target(${java_name}_Java_Dir ALL DEPENDS add_custom_target(${java_name}_Java_Dir ALL DEPENDS
${XDMF_JAVA_DIR}) ${XDMF_JAVA_DIR})
add_custom_command(OUTPUT ${XDMF_JAVA_DIR} add_custom_command(OUTPUT ${XDMF_JAVA_DIR}
...@@ -107,14 +134,17 @@ if(XDMF_WRAP_JAVA) ...@@ -107,14 +134,17 @@ if(XDMF_WRAP_JAVA)
${${java_name}_JAVA_JAR}) ${${java_name}_JAVA_JAR})
add_custom_command(OUTPUT ${${java_name}_JAVA_JAR} add_custom_command(OUTPUT ${${java_name}_JAVA_JAR}
COMMAND ${JAVA_COMPILE} COMMAND ${JAVA_COMPILE}
ARGS -cp "'${CMAKE_BINARY_DIR}/*'" ARGS ${java_compile_args}
"${XDMF_JAVA_DIR}/*.java"
COMMAND ${JAVA_ARCHIVE} COMMAND ${JAVA_ARCHIVE}
ARGS -cvf ${${java_name}_JAVA_JAR} ARGS -cvf ${${java_name}_JAVA_JAR}
"${XDMF_JAVA_PACKAGE_DIR}/*.class" "${XDMF_JAVA_PACKAGE_DIR}/*.class"
) )
add_dependencies(${java_name}Java ${java_name}_Java_Dir) add_dependencies(${java_name}Java ${java_name}_Java_Dir)
add_dependencies(Compiled_${java_name}_Jar ${java_name}Java "${ARGN}") add_dependencies(Compiled_${java_name}_Jar ${java_name}Java)
if(NOT ${ARGN} EQUAL "")
add_dependencies(Compiled_${java_name}_Jar "${ARGN}")
endif(NOT ${ARGN} EQUAL "")
set_property(DIRECTORY APPEND PROPERTY set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES ADDITIONAL_MAKE_CLEAN_FILES
...@@ -124,7 +154,7 @@ if(XDMF_WRAP_JAVA) ...@@ -124,7 +154,7 @@ if(XDMF_WRAP_JAVA)
install(FILES ${CMAKE_BINARY_DIR}/${java_name}.jar install(FILES ${CMAKE_BINARY_DIR}/${java_name}.jar
DESTINATION lib/java) DESTINATION lib/java)
install(TARGETS ${SWIG_MODULE_${java_name}Java_REAL_NAME} install(TARGETS ${SWIG_MODULE_${java_name}Java_REAL_NAME}
DESTINATION lib/java) DESTINATION ${java_dest})
ENDMACRO(XDMF_SWIG_JAVA) ENDMACRO(XDMF_SWIG_JAVA)
endif(XDMF_WRAP_JAVA) endif(XDMF_WRAP_JAVA)
...@@ -160,6 +190,15 @@ if(NOT XDMF_BUILD_CORE_ONLY) ...@@ -160,6 +190,15 @@ if(NOT XDMF_BUILD_CORE_ONLY)
add_library(Xdmf ${XdmfSources}) add_library(Xdmf ${XdmfSources})
target_link_libraries(Xdmf XdmfCore) target_link_libraries(Xdmf XdmfCore)
if(WIN32)
set_target_properties(Xdmf PROPERTIES
DEFINE_SYMBOL Xdmf_EXPORTS
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif(WIN32)
if(XDMF_WRAP_JAVA) if(XDMF_WRAP_JAVA)
XDMF_SWIG_JAVA(Xdmf Compiled_XdmfCore_Jar) XDMF_SWIG_JAVA(Xdmf Compiled_XdmfCore_Jar)
endif(XDMF_WRAP_JAVA) endif(XDMF_WRAP_JAVA)
...@@ -179,5 +218,9 @@ if(NOT XDMF_BUILD_CORE_ONLY) ...@@ -179,5 +218,9 @@ if(NOT XDMF_BUILD_CORE_ONLY)
file(GLOB XdmfHeaders "*.hpp" "*.tpp" "*.i" "CMake/VersionSuite/*.hpp") file(GLOB XdmfHeaders "*.hpp" "*.tpp" "*.i" "CMake/VersionSuite/*.hpp")
install(FILES ${XdmfHeaders} DESTINATION include) install(FILES ${XdmfHeaders} DESTINATION include)
install(TARGETS Xdmf LIBRARY DESTINATION lib) install(TARGETS Xdmf
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif(NOT XDMF_BUILD_CORE_ONLY) endif(NOT XDMF_BUILD_CORE_ONLY)
#ifndef _XDMF_HPP
#define _XDMF_HPP
/* Keep all our Win32 Conversions here */
#ifdef _WIN32
/* Used to export/import from the dlls */
#undef XDMFCORE_EXPORT
#define XDMFCORE_EXPORT __declspec(dllimport)
#undef XDMFCORE_TEMPLATE
#define XDMFCORE_TEMPLATE extern
#ifdef Xdmf_EXPORTS
#define XDMF_EXPORT __declspec(dllexport)
#define XDMF_TEMPLATE
#else /* Xdmf_EXPORTS */
#define XDMF_EXPORT __declspec(dllimport)
#define XDMF_TEMPLATE extern
#endif /* Xdmf_EXPORTS */
/* Compiler Warnings */
#ifndef XDMF_DEBUG
#pragma warning( disable : 4231 ) /* nonstandard extension used : 'extern' before template explicit instantiation */
#pragma warning( disable : 4251 ) /* needs to have dll-interface to be used by clients (Most of these guys are in private */
#pragma warning( disable : 4275 ) /* non dll-interface class 'std::_Container_base_aux' used as base for dll-interface class */
#pragma warning( disable : 4373 ) /* virtual function overrides, parameters only differed by const/volatile qualifiers */
#pragma warning( disable : 4748 ) /* /GS can not protect parameters and local variables from local buffer overrun (turned off op)*/
#endif /* XDMF_DEBUG */
/* Compiler Optimizations will result in an 'internal compiler error', so turn them off */
#pragma optimize("g", off)
#else /* _WIN32 */
/* We don't need to export/import since there are no dlls */
#define XDMFCORE_EXPORT
#define XDMF_EXPORT
#define XDMFCORE_TEMPLATE
#define XDMF_TEMPLATE
#endif /* _WIN32 */
#endif /* _XDMF_HPP */
...@@ -5,6 +5,8 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -5,6 +5,8 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%module Xdmf %module Xdmf
%{ %{
#include <Xdmf.hpp>
// XdmfCore Includes // XdmfCore Includes
#include <XdmfArray.hpp> #include <XdmfArray.hpp>
#include <XdmfArrayType.hpp> #include <XdmfArrayType.hpp>
...@@ -268,6 +270,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -268,6 +270,7 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%shared_ptr(XdmfTopologyType) %shared_ptr(XdmfTopologyType)
%shared_ptr(XdmfUnstructuredGrid) %shared_ptr(XdmfUnstructuredGrid)
%include Xdmf.hpp
%include XdmfGrid.hpp %include XdmfGrid.hpp
%include XdmfAttribute.hpp %include XdmfAttribute.hpp
......
...@@ -6,6 +6,7 @@ class XdmfAttributeCenter; ...@@ -6,6 +6,7 @@ class XdmfAttributeCenter;
class XdmfAttributeType; class XdmfAttributeType;
// Includes // Includes
#include "Xdmf.hpp"
#include "XdmfArray.hpp" #include "XdmfArray.hpp"
/** /**
...@@ -14,7 +15,7 @@ class XdmfAttributeType; ...@@ -14,7 +15,7 @@ class XdmfAttributeType;
* XdmfAttribute contains two properties that should be set, XdmfAttributeCenter and XdmfAttributeType. * XdmfAttribute contains two properties that should be set, XdmfAttributeCenter and XdmfAttributeType.
* XdmfAttribute is a subclass of XdmfDataItem, meaning it contains an XdmfArray to store values. * XdmfAttribute is a subclass of XdmfDataItem, meaning it contains an XdmfArray to store values.
*/ */
class XdmfAttribute : public XdmfArray { class XDMF_EXPORT XdmfAttribute : public XdmfArray {
public: public:
...@@ -92,4 +93,9 @@ private: ...@@ -92,4 +93,9 @@ private:
boost::shared_ptr<const XdmfAttributeType> mType; boost::shared_ptr<const XdmfAttributeType> mType;
}; };
#ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<const XdmfAttributeType>;
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<const XdmfAttributeCenter>;
#endif
#endif /* XDMFATTRIBUTE_HPP_ */ #endif /* XDMFATTRIBUTE_HPP_ */
...@@ -79,6 +79,7 @@ boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::New(const std: ...@@ -79,6 +79,7 @@ boost::shared_ptr<const XdmfAttributeCenter> XdmfAttributeCenter::New(const std:
} }
} }
assert(false); assert(false);
return boost::shared_ptr<const XdmfAttributeCenter>();
} }
void XdmfAttributeCenter::getProperties(std::map<std::string, std::string> & collectedProperties) const void XdmfAttributeCenter::getProperties(std::map<std::string, std::string> & collectedProperties) const
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define XDMFATTRIBUTECENTER_HPP_ #define XDMFATTRIBUTECENTER_HPP_
// Includes // Includes
#include "Xdmf.hpp"
#include "XdmfItemProperty.hpp" #include "XdmfItemProperty.hpp"
/** /**
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
* Edge * Edge
* Node * Node
*/ */
class XdmfAttributeCenter : public XdmfItemProperty { class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
public: public:
......
...@@ -103,6 +103,7 @@ boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::New(const std::map ...@@ -103,6 +103,7 @@ boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::New(const std::map
} }
} }
assert(false); assert(false);
return boost::shared_ptr<const XdmfAttributeType>();
} }
void XdmfAttributeType::getProperties(std::map<std::string, std::string> & collectedProperties) const void XdmfAttributeType::getProperties(std::map<std::string, std::string> & collectedProperties) const
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define XDMFATTRIBUTETYPE_HPP_ #define XDMFATTRIBUTETYPE_HPP_
// Includes // Includes
#include "Xdmf.hpp"
#include "XdmfItemProperty.hpp" #include "XdmfItemProperty.hpp"
/** /**
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
* Tensor6 * Tensor6
* GlobalId * GlobalId
*/ */
class XdmfAttributeType : public XdmfItemProperty { class XDMF_EXPORT XdmfAttributeType : public XdmfItemProperty {
public: public:
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
class XdmfArray; class XdmfArray;
// Includes // Includes
#include "Xdmf.hpp"
#include "XdmfGrid.hpp" #include "XdmfGrid.hpp"
/** /**
...@@ -17,7 +18,7 @@ class XdmfArray; ...@@ -17,7 +18,7 @@ class XdmfArray;
* must be specified. * must be specified.
* *
*/ */
class XdmfCurvilinearGrid : public XdmfGrid { class XDMF_EXPORT XdmfCurvilinearGrid : public XdmfGrid {
public: public:
...@@ -112,4 +113,10 @@ private: ...@@ -112,4 +113,10 @@ private:
}; };
#ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<XdmfGeometry>;
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<XdmfArray>;
XDMF_TEMPLATE template class XDMF_EXPORT boost::shared_ptr<const XdmfArray>;
#endif
#endif /* XDMFCURVILINEARGRID_HPP_ */ #endif /* XDMFCURVILINEARGRID_HPP_ */
...@@ -9,6 +9,7 @@ class XdmfRegularGrid; ...@@ -9,6 +9,7 @@ class XdmfRegularGrid;
class XdmfUnstructuredGrid; class XdmfUnstructuredGrid;
// Includes // Includes
#include "Xdmf.hpp"
#include "XdmfItem.hpp" #include "XdmfItem.hpp"
/** /**
...@@ -17,7 +18,7 @@ class XdmfUnstructuredGrid; ...@@ -17,7 +18,7 @@ class XdmfUnstructuredGrid;
* XdmfDomain is the top XdmfItem in an Xdmf structure. It can store a number of grids and * XdmfDomain is the top XdmfItem in an Xdmf structure. It can store a number of grids and
* provides methods to insert, retrieve, and remove these grids. * provides methods to insert, retrieve, and remove these grids.
*/ */
class XdmfDomain : public virtual XdmfItem { class XDMF_EXPORT XdmfDomain : public virtual XdmfItem {
public: public:
...@@ -57,4 +58,17 @@ private: ...@@ -57,4 +58,17 @@ private:
}; };
#ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT std::allocator<boost::shared_ptr<XdmfGridCollection> >;
XDMF_TEMPLATE template class XDMF_EXPORT std::vector<boost::shared_ptr<XdmfGridCollection>, std::allocator<boost::shared_ptr<XdmfGridCollection> > >;
XDMF_TEMPLATE template class XDMF_EXPORT std::allocator<boost::shared_ptr<XdmfCurvilinearGrid> >;
XDMF_TEMPLATE template class XDMF_EXPORT std::vector<boost::shared_ptr<XdmfCurvilinearGrid>, std::allocator<boost::shared_ptr<XdmfCurvilinearGrid> > >;
XDMF_TEMPLATE template class XDMF_EXPORT std::allocator<boost::shared_ptr<XdmfRectilinearGrid> >;
XDMF_TEMPLATE template class XDMF_EXPORT std::vector<boost::shared_ptr<XdmfRectilinearGrid>, std::allocator<boost::shared_ptr<XdmfRectilinearGrid> > >;
XDMF_TEMPLATE template class