mirror of https://github.com/AxioDL/tinyxml2.git
Merge branch 'master' into whitespace
This commit is contained in:
commit
491d587484
168
CMakeLists.txt
168
CMakeLists.txt
|
@ -1,84 +1,84 @@
|
|||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_policy(VERSION 2.6)
|
||||
|
||||
project(tinyxml2)
|
||||
include(GNUInstallDirs)
|
||||
#enable_testing()
|
||||
|
||||
#CMAKE_BUILD_TOOL
|
||||
|
||||
################################
|
||||
# set lib version here
|
||||
|
||||
set(GENERIC_LIB_VERSION "1.0.6")
|
||||
set(GENERIC_LIB_SOVERSION "1")
|
||||
|
||||
|
||||
################################
|
||||
# Add common source
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/.")
|
||||
|
||||
################################
|
||||
# Add custom target to copy all data
|
||||
|
||||
set(TARGET_DATA_COPY DATA_COPY)
|
||||
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_custom_target(
|
||||
${TARGET_DATA_COPY}
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
|
||||
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
make_directory(${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||
add_custom_target(
|
||||
${TARGET_DATA_COPY}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/dream.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
################################
|
||||
# Add definitions
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif(MSVC)
|
||||
|
||||
################################
|
||||
# Add targets
|
||||
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
|
||||
if(BUILD_STATIC_LIBS)
|
||||
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
|
||||
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
|
||||
endif(BUILD_STATIC_LIBS)
|
||||
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
|
||||
set_target_properties(tinyxml2 PROPERTIES
|
||||
VERSION "${GENERIC_LIB_VERSION}"
|
||||
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
||||
|
||||
add_executable(test xmltest.cpp)
|
||||
add_dependencies(test tinyxml2)
|
||||
add_dependencies(test ${TARGET_DATA_COPY})
|
||||
target_link_libraries(test tinyxml2)
|
||||
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
install(TARGETS tinyxml2 tinyxml2static
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
else(BUILD_STATIC_LIBS)
|
||||
install(TARGETS tinyxml2
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(BUILD_STATIC_LIBS)
|
||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
foreach(p LIB INCLUDE)
|
||||
set(var CMAKE_INSTALL_${p}DIR)
|
||||
if(NOT IS_ABSOLUTE "${${var}}")
|
||||
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
#add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_policy(VERSION 2.6)
|
||||
|
||||
project(tinyxml2)
|
||||
include(GNUInstallDirs)
|
||||
#enable_testing()
|
||||
|
||||
#CMAKE_BUILD_TOOL
|
||||
|
||||
################################
|
||||
# set lib version here
|
||||
|
||||
set(GENERIC_LIB_VERSION "1.0.7")
|
||||
set(GENERIC_LIB_SOVERSION "1")
|
||||
|
||||
|
||||
################################
|
||||
# Add common source
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/.")
|
||||
|
||||
################################
|
||||
# Add custom target to copy all data
|
||||
|
||||
set(TARGET_DATA_COPY DATA_COPY)
|
||||
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_custom_target(
|
||||
${TARGET_DATA_COPY}
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
|
||||
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
make_directory(${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||
add_custom_target(
|
||||
${TARGET_DATA_COPY}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/dream.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
################################
|
||||
# Add definitions
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif(MSVC)
|
||||
|
||||
################################
|
||||
# Add targets
|
||||
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
|
||||
if(BUILD_STATIC_LIBS)
|
||||
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
|
||||
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
|
||||
endif(BUILD_STATIC_LIBS)
|
||||
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
|
||||
set_target_properties(tinyxml2 PROPERTIES
|
||||
VERSION "${GENERIC_LIB_VERSION}"
|
||||
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
||||
|
||||
add_executable(test xmltest.cpp)
|
||||
add_dependencies(test tinyxml2)
|
||||
add_dependencies(test ${TARGET_DATA_COPY})
|
||||
target_link_libraries(test tinyxml2)
|
||||
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
install(TARGETS tinyxml2 tinyxml2static
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
else(BUILD_STATIC_LIBS)
|
||||
install(TARGETS tinyxml2
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(BUILD_STATIC_LIBS)
|
||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
foreach(p LIB INCLUDE)
|
||||
set(var CMAKE_INSTALL_${p}DIR)
|
||||
if(NOT IS_ABSOLUTE "${${var}}")
|
||||
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
#add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|
||||
|
|
2
dox
2
dox
|
@ -32,7 +32,7 @@ PROJECT_NAME = "TinyXML-2"
|
|||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.0.6
|
||||
PROJECT_NUMBER = 1.0.7
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
|
|
@ -1600,7 +1600,7 @@ int XMLDocument::LoadFile( FILE* fp )
|
|||
}
|
||||
|
||||
|
||||
int XMLDocument::SaveFile( const char* filename )
|
||||
int XMLDocument::SaveFile( const char* filename, bool compact )
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning ( push )
|
||||
|
@ -1614,15 +1614,15 @@ int XMLDocument::SaveFile( const char* filename )
|
|||
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 );
|
||||
return errorID;
|
||||
}
|
||||
SaveFile(fp);
|
||||
SaveFile(fp, compact);
|
||||
fclose( fp );
|
||||
return errorID;
|
||||
}
|
||||
|
||||
|
||||
int XMLDocument::SaveFile( FILE* fp )
|
||||
int XMLDocument::SaveFile( FILE* fp, bool compact )
|
||||
{
|
||||
XMLPrinter stream( fp );
|
||||
XMLPrinter stream( fp, compact );
|
||||
Print( &stream );
|
||||
return errorID;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ distribution.
|
|||
|
||||
static const int TIXML2_MAJOR_VERSION = 1;
|
||||
static const int TIXML2_MINOR_VERSION = 0;
|
||||
static const int TIXML2_PATCH_VERSION = 6;
|
||||
static const int TIXML2_PATCH_VERSION = 7;
|
||||
|
||||
namespace tinyxml2
|
||||
{
|
||||
|
@ -294,7 +294,9 @@ public:
|
|||
if ( !mem ) return;
|
||||
--currentAllocs;
|
||||
Chunk* chunk = (Chunk*)mem;
|
||||
#ifdef DEBUG
|
||||
memset( chunk, 0xfe, sizeof(Chunk) );
|
||||
#endif
|
||||
chunk->next = root;
|
||||
root = chunk;
|
||||
}
|
||||
|
@ -1094,7 +1096,7 @@ public:
|
|||
Returns XML_NO_ERROR (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
int SaveFile( const char* filename );
|
||||
int SaveFile( const char* filename, bool compact = false );
|
||||
|
||||
/**
|
||||
Save the XML file to disk. You are responsible
|
||||
|
@ -1103,7 +1105,7 @@ public:
|
|||
Returns XML_NO_ERROR (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
int SaveFile( FILE* );
|
||||
int SaveFile( FILE* fp, bool compact = false );
|
||||
|
||||
bool ProcessEntities() const { return processEntities; }
|
||||
Whitespace WhitespaceMode() const { return whitespace; }
|
||||
|
|
|
@ -296,6 +296,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||
doc->Print( &streamer );
|
||||
XMLTest( "Compact mode", "<element><sub attrib=\"1\"/><sub/></element>", streamer.CStr(), false );
|
||||
}
|
||||
doc->SaveFile( "./resources/out/pretty.xml" );
|
||||
doc->SaveFile( "./resources/out/compact.xml", true );
|
||||
delete doc;
|
||||
}
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue