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")
set(SIMGEAR_SHARED ON)
find_package(EXPAT REQUIRED)
include_directories(${EXPAT_INCLUDE_DIRS})
else()
message(STATUS "Using built-in expat code")
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)
include_directories(${EXPAT_INCLUDE_DIRS})
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(sys/time.h HAVE_SYS_TIME_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}/simgear/canvas/ShivaVG/include)
include_directories(${PROJECT_BINARY_DIR}/simgear)
include_directories(${PROJECT_BINARY_DIR}/simgear/xml)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
@ -364,11 +369,6 @@ configure_file (
"${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)
# enable CTest / make test target
message(STATUS "Tests: ENABLED")
@ -402,6 +402,8 @@ if(NOT SIMGEAR_HEADLESS)
endif()
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)
add_subdirectory(3rdparty)
add_subdirectory(simgear)
if (NOT EMBEDDED_SIMGEAR)

View File

@ -16,6 +16,10 @@
// along with this program; if not, write to the Free Software
// 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 <iostream>
@ -27,10 +31,15 @@
#include <boost/foreach.hpp>
#include "simgear/debug/logstream.hxx"
#include "simgear/xml/xmlparse.h"
#include "simgear/misc/strutils.hxx"
#include "simgear/structure/exception.hxx"
#ifdef SYSTEM_EXPAT
# include <expat.h>
#else
# include "sg_expat.h"
#endif
using std::string;
using namespace simgear;

View File

@ -16,6 +16,10 @@
// along with this program; if not, write to the Free Software
// 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 <iostream>
@ -30,11 +34,16 @@
#include "simgear/misc/sg_path.hxx"
#include "simgear/misc/sg_dir.hxx"
#include "simgear/debug/logstream.hxx"
#include "simgear/xml/xmlparse.h"
#include "simgear/xml/easyxml.hxx"
#include "simgear/misc/strutils.hxx"
#include "simgear/package/md5.h"
#ifdef SYSTEM_EXPAT
# include <expat.h>
#else
# include "sg_expat.h"
#endif
#include "SVNDirectory.hxx"
#include "SVNRepository.hxx"
#include "DAVMultiStatus.hxx"

View File

@ -10,28 +10,4 @@ set(SOURCES
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}")

View File

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