Added Xerces-c library to setup.sh

This commit is contained in:
Axel 2020-09-29 19:07:30 +02:00 committed by bernat
parent 0c6d27e8b7
commit a4eaba572f
4 changed files with 56 additions and 13 deletions

View File

@ -52,7 +52,7 @@ def get_libcarla_extensions():
os.path.join(pwd, 'dependencies/lib/libDetour.a'), os.path.join(pwd, 'dependencies/lib/libDetour.a'),
os.path.join(pwd, 'dependencies/lib/libDetourCrowd.a'), os.path.join(pwd, 'dependencies/lib/libDetourCrowd.a'),
os.path.join(pwd, 'dependencies/lib/libosm2odr.a')] os.path.join(pwd, 'dependencies/lib/libosm2odr.a')]
extra_link_args += ['-lxerces-c'] extra_link_args += [os.path.join(pwd, 'dependencies/lib/libxerces-c.a')]
extra_link_args += ['-lz'] extra_link_args += ['-lz']
extra_compile_args = [ extra_compile_args = [
'-isystem', 'dependencies/include/system', '-fPIC', '-std=c++14', '-isystem', 'dependencies/include/system', '-fPIC', '-std=c++14',

View File

@ -413,6 +413,51 @@ else
rm -Rf ${LIBPNG_BASENAME}-source rm -Rf ${LIBPNG_BASENAME}-source
fi fi
# ==============================================================================
# -- Get and compile libxerces 3.2.3 ------------------------------
# ==============================================================================
XERCESC_VERSION=3.2.3
XERCESC_BASENAME=xerces-c-${XERCESC_VERSION}
XERCESC_TEMP_FOLDER=${XERCESC_BASENAME}
XERCESC_REPO=https://ftp.cixug.es/apache//xerces/c/3/sources/xerces-c-${XERCESC_VERSION}.tar.gz
XERCESC_SRC_DIR=${XERCESC_BASENAME}-source
XERCESC_INSTALL_DIR=${XERCESC_BASENAME}-install
if [[ -d ${XERCESC_INSTALL_DIR} ]] ; then
log "Xerces-c already installed."
else
log "Retrieving xerces-c."
wget ${XERCESC_REPO}
log "Extracting xerces-c."
tar -xzf ${XERCESC_BASENAME}.tar.gz
mv ${XERCESC_BASENAME} ${XERCESC_SRC_DIR}
mkdir -p ${XERCESC_INSTALL_DIR}
mkdir -p ${XERCESC_SRC_DIR}/build
pushd ${XERCESC_SRC_DIR}/build >/dev/null
# define clang compiler
# export CC=/usr/bin/clang-8
# export CXX=/usr/bin/clang++-8
cmake -G "Ninja" \
-DCMAKE_CXX_FLAGS="-std=c++14 -fPIC -w" \
-DCMAKE_INSTALL_PREFIX="../../${XERCESC_INSTALL_DIR}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-Dnetwork=OFF \
..
ninja
ninja install
popd >/dev/null
rm -Rf ${XERCESC_BASENAME}.tar.gz
rm -Rf ${XERCESC_SRC_DIR}
fi
# ============================================================================== # ==============================================================================
# -- Generate Version.h -------------------------------------------------------- # -- Generate Version.h --------------------------------------------------------

View File

@ -77,14 +77,12 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import setuptools" RESULT_VARIA
#set(ENABLED_FEATURES "${ENABLED_FEATURES} Proj") #set(ENABLED_FEATURES "${ENABLED_FEATURES} Proj")
#endif (PROJ_FOUND) #endif (PROJ_FOUND)
if (WIN32) set(XERCES_PATH "../../Build/xerces-c-3.2.3-install")
set(XERCES_PATH "../../Build/xerces-c-3.2.3-install") set(XercesC_INCLUDE_DIR "${XERCES_PATH}/include")
set(XercesC_INCLUDE_DIR "${XERCES_PATH}/include") set(XercesC_LIBRARY "${XERCES_PATH}/lib")
set(XercesC_LIBRARY "${XERCES_PATH}/lib") # Install xercesc
# Install xercesc file(GLOB XERCES_LIBS "${XercesC_LIBRARY}/*.*")
file(GLOB XERCES_LIBS "${XercesC_LIBRARY}/*.*") install(FILES ${XERCES_LIBS} DESTINATION lib)
install(FILES ${XERCES_LIBS} DESTINATION lib)
endif ()
find_package(XercesC REQUIRED) find_package(XercesC REQUIRED)
if (XercesC_FOUND) if (XercesC_FOUND)
include_directories(SYSTEM ${XercesC_INCLUDE_DIRS}) include_directories(SYSTEM ${XercesC_INCLUDE_DIRS})

View File

@ -59,8 +59,8 @@ set(osm2odr_sources "${osm2odr_sources};${utils_traction_wire_sources}")
add_library(osm2odr STATIC ${osm2odr_sources}) add_library(osm2odr STATIC ${osm2odr_sources})
target_link_libraries(osm2odr ${XercesC_LIBRARIES} ${ZLIB_LIBRARIES} ${PROJ_LIBRARY}) target_link_libraries(osm2odr ${XercesC_LIBRARIES} ${ZLIB_LIBRARIES} ${PROJ_LIBRARY})
if (WIN32)
target_compile_definitions(osm2odr PUBLIC "XERCES_STATIC_LIBRARY") target_compile_definitions(osm2odr PUBLIC "XERCES_STATIC_LIBRARY")
endif ()
install(TARGETS osm2odr ARCHIVE DESTINATION lib) install(TARGETS osm2odr ARCHIVE DESTINATION lib)
install(FILES OSM2ODR.h DESTINATION include) install(FILES OSM2ODR.h DESTINATION include)