Move bundled Expat to new home.

Renamed bundled Expat headers to avoid any
possibility of accidental including system headers when
using bundled Expat, or vice-versa. Should help with SVN
crashes reported by Thomas.
This commit is contained in:
James Turner 2013-09-19 20:12:32 +01:00
parent 4f2e36ca46
commit a922aaa68e
30 changed files with 76 additions and 35 deletions

4
3rdparty/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,4 @@
if (NOT SYSTEM_EXPAT)
add_subdirectory(expat)
endif()

42
3rdparty/expat/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,42 @@
configure_file (
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
"${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h"
)
set(expat_sources
asciitab.h
hashtable.h
iasciitab.h
latin1tab.h
nametab.h
utf8tab.h
xmldef.h
xmlparse.h
xmlrole.h
xmltok.h
xmltok_impl.h
hashtable.c
xmlparse.c
xmlrole.c
xmltok.c
internal.h
ascii.h
sg_expat.h
sg_expat_external.h
)
# this code will be linked into SimGearCore shared object, so it
# must be compiled with -fPIC too
if(SIMGEAR_SHARED AND UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
add_library(local_expat STATIC ${expat_sources})

View File

@ -227,12 +227,18 @@ if (SYSTEM_EXPAT)
message(STATUS "Requested to use system Expat library, forcing SIMGEAR_SHARED to true") message(STATUS "Requested to use system Expat library, forcing SIMGEAR_SHARED to true")
set(SIMGEAR_SHARED ON) set(SIMGEAR_SHARED ON)
find_package(EXPAT REQUIRED) find_package(EXPAT REQUIRED)
include_directories(${EXPAT_INCLUDE_DIRS})
else() else()
message(STATUS "Using built-in expat code") message(STATUS "Using built-in expat code")
add_definitions(-DHAVE_EXPAT_CONFIG_H) add_definitions(-DHAVE_EXPAT_CONFIG_H)
set(EXPAT_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/3rdparty/expat
${PROJECT_BINARY_DIR}/3rdparty/expat)
set(EXPAT_LIBRARIES local_expat)
endif(SYSTEM_EXPAT) endif(SYSTEM_EXPAT)
include_directories(${EXPAT_INCLUDE_DIRS})
check_include_file(inttypes.h HAVE_INTTYPES_H) check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H) check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
@ -346,7 +352,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include) include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
include_directories(${PROJECT_BINARY_DIR}/simgear) include_directories(${PROJECT_BINARY_DIR}/simgear)
include_directories(${PROJECT_BINARY_DIR}/simgear/xml)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
@ -364,11 +369,6 @@ configure_file (
"${PROJECT_BINARY_DIR}/simgear/simgear_config.h" "${PROJECT_BINARY_DIR}/simgear/simgear_config.h"
) )
configure_file (
"${PROJECT_SOURCE_DIR}/simgear/xml/expat_config_cmake.in"
"${PROJECT_BINARY_DIR}/simgear/xml/expat_config.h"
)
if(ENABLE_TESTS) if(ENABLE_TESTS)
# enable CTest / make test target # enable CTest / make test target
message(STATUS "Tests: ENABLED") message(STATUS "Tests: ENABLED")
@ -402,6 +402,8 @@ if(NOT SIMGEAR_HEADLESS)
endif() endif()
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)
add_subdirectory(3rdparty)
add_subdirectory(simgear) add_subdirectory(simgear)
if (NOT EMBEDDED_SIMGEAR) if (NOT EMBEDDED_SIMGEAR)

View File

@ -16,6 +16,10 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_CONFIG_H
# include <simgear_config.h>
#endif
#include "DAVMultiStatus.hxx" #include "DAVMultiStatus.hxx"
#include <iostream> #include <iostream>
@ -27,10 +31,15 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "simgear/debug/logstream.hxx" #include "simgear/debug/logstream.hxx"
#include "simgear/xml/xmlparse.h"
#include "simgear/misc/strutils.hxx" #include "simgear/misc/strutils.hxx"
#include "simgear/structure/exception.hxx" #include "simgear/structure/exception.hxx"
#ifdef SYSTEM_EXPAT
# include <expat.h>
#else
# include "sg_expat.h"
#endif
using std::string; using std::string;
using namespace simgear; using namespace simgear;

View File

@ -16,6 +16,10 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_CONFIG_H
# include <simgear_config.h>
#endif
#include "SVNReportParser.hxx" #include "SVNReportParser.hxx"
#include <iostream> #include <iostream>
@ -30,11 +34,16 @@
#include "simgear/misc/sg_path.hxx" #include "simgear/misc/sg_path.hxx"
#include "simgear/misc/sg_dir.hxx" #include "simgear/misc/sg_dir.hxx"
#include "simgear/debug/logstream.hxx" #include "simgear/debug/logstream.hxx"
#include "simgear/xml/xmlparse.h"
#include "simgear/xml/easyxml.hxx" #include "simgear/xml/easyxml.hxx"
#include "simgear/misc/strutils.hxx" #include "simgear/misc/strutils.hxx"
#include "simgear/package/md5.h" #include "simgear/package/md5.h"
#ifdef SYSTEM_EXPAT
# include <expat.h>
#else
# include "sg_expat.h"
#endif
#include "SVNDirectory.hxx" #include "SVNDirectory.hxx"
#include "SVNRepository.hxx" #include "SVNRepository.hxx"
#include "DAVMultiStatus.hxx" #include "DAVMultiStatus.hxx"

View File

@ -10,28 +10,4 @@ set(SOURCES
easyxml.cxx easyxml.cxx
) )
if (NOT SYSTEM_EXPAT)
list(APPEND SOURCES
asciitab.h
hashtable.h
iasciitab.h
latin1tab.h
nametab.h
utf8tab.h
xmldef.h
xmlparse.h
xmlrole.h
xmltok.h
xmltok_impl.h
hashtable.c
xmlparse.c
xmlrole.c
xmltok.c
internal.h
ascii.h
expat.h
expat_external.h
)
endif()
simgear_component(xml xml "${SOURCES}" "${HEADERS}") simgear_component(xml xml "${SOURCES}" "${HEADERS}")

View File

@ -17,7 +17,7 @@
#ifdef SYSTEM_EXPAT #ifdef SYSTEM_EXPAT
# include <expat.h> # include <expat.h>
#else #else
# include "xmlparse.h" # include "sg_expat.h"
#endif #endif
#include <fstream> #include <fstream>
@ -136,7 +136,6 @@ XMLAttributesDefault::setValue (const char * name, const char * value)
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Attribute list wrapper for Expat. // Attribute list wrapper for Expat.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////