mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-26 00:46:59 +00:00
Download and build PugiXML if not found
This commit is contained in:
parent
e7c1a71a5a
commit
573092d033
@ -352,7 +352,7 @@ set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1")
|
||||
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
|
||||
set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6")
|
||||
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.13")
|
||||
|
||||
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9")
|
||||
|
||||
|
||||
################################################################################
|
||||
@ -1222,6 +1222,50 @@ endif(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_V
|
||||
find_package(PugiXML QUIET)
|
||||
if(PugiXML_FOUND)
|
||||
message(STATUS "PugiXML has been found. Reading of GSA Galileo almanac XML files enabled.")
|
||||
else(PugiXML_FOUND)
|
||||
message(STATUS " PugiXML v${GNSSSDR_PUGIXML_LOCAL_VERSION} will be downloaded and built automatically")
|
||||
message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'. ")
|
||||
set(PUGIXML_COMPILER -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
|
||||
set(TOOLCHAIN_ARG "")
|
||||
if(EXISTS $ENV{OECORE_TARGET_SYSROOT})
|
||||
set(PUGIXML_COMPILER "")
|
||||
set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake")
|
||||
endif(EXISTS $ENV{OECORE_TARGET_SYSROOT})
|
||||
if(CMAKE_VERSION VERSION_LESS 3.2)
|
||||
ExternalProject_Add(
|
||||
pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml
|
||||
GIT_REPOSITORY https://github.com/zeux/pugixml
|
||||
GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
CMAKE_ARGS ${PUGIXML_COMPILER} ${TOOLCHAIN_ARG}
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
else(CMAKE_VERSION VERSION_LESS 3.2)
|
||||
ExternalProject_Add(
|
||||
pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/pugixml
|
||||
GIT_REPOSITORY https://github.com/zeux/pugixml
|
||||
GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}
|
||||
CMAKE_ARGS ${PUGIXML_COMPILER} ${TOOLCHAIN_ARG}
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif(CMAKE_VERSION VERSION_LESS 3.2)
|
||||
set(PUGIXML_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} )
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src/pugixml.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/pugixml.hpp COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src/pugiconfig.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/pugiconfig.hpp COPYONLY)
|
||||
set(PUGIXML_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} )
|
||||
set(PUGIXML_LOCAL true)
|
||||
endif(PugiXML_FOUND)
|
||||
|
||||
|
||||
|
@ -35,13 +35,6 @@ set(CORE_LIBS_HEADERS
|
||||
string_converter.h
|
||||
gnss_sdr_supl_client.h
|
||||
)
|
||||
|
||||
if(PugiXML_FOUND)
|
||||
add_definitions( -DPUGIXML_FOUND=1 )
|
||||
else(PugiXML_FOUND)
|
||||
set(PUGIXML_INCLUDE_DIR "")
|
||||
set(PUGIXML_LIBRARIES "")
|
||||
endif(PugiXML_FOUND)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
@ -60,4 +53,8 @@ list(SORT CORE_LIBS_SOURCES)
|
||||
|
||||
add_library(rx_core_lib ${CORE_LIBS_SOURCES} ${CORE_LIBS_HEADERS})
|
||||
source_group(Headers FILES ${CORE_LIBS_HEADERS})
|
||||
target_link_libraries(rx_core_lib supl_library ${PUGIXML_LIBRARIES})
|
||||
target_link_libraries(rx_core_lib supl_library ${PUGIXML_LIBRARY})
|
||||
|
||||
if(PUGIXML_LOCAL)
|
||||
add_dependencies(rx_core_lib pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION})
|
||||
endif(PUGIXML_LOCAL)
|
||||
|
@ -32,9 +32,7 @@
|
||||
*/
|
||||
|
||||
#include "gnss_sdr_supl_client.h"
|
||||
#ifdef PUGIXML_FOUND
|
||||
#include <pugixml.hpp>
|
||||
#endif
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
@ -858,7 +856,6 @@ bool gnss_sdr_supl_client::load_gal_almanac_xml(const std::string file_name)
|
||||
|
||||
bool gnss_sdr_supl_client::read_gal_almanac_from_gsa(const std::string file_name)
|
||||
{
|
||||
#ifdef PUGIXML_FOUND
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file(file_name.c_str());
|
||||
if (!result)
|
||||
@ -904,13 +901,6 @@ bool gnss_sdr_supl_client::read_gal_almanac_from_gsa(const std::string file_name
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
if (file_name.empty())
|
||||
{
|
||||
// avoid warning
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,6 +157,7 @@ include_directories(
|
||||
${GFlags_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||
${PUGIXML_INCLUDE_DIR}
|
||||
${OPT_RECEIVER_INCLUDE_DIRS}
|
||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||
)
|
||||
|
@ -61,6 +61,7 @@ include_directories(
|
||||
${ARMADILLO_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||
${PUGIXML_INCLUDE_DIR}
|
||||
${GNSS_SDR_OPTIONAL_HEADERS}
|
||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||
${OPT_GNSSSDR_INCLUDE_DIRS}
|
||||
|
@ -376,6 +376,7 @@ set(LIST_INCLUDE_DIRS
|
||||
${VOLK_INCLUDE_DIRS}
|
||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||
${MATIO_INCLUDE_DIRS}
|
||||
${PUGIXML_INCLUDE_DIR}
|
||||
${GNSS_SDR_TEST_OPTIONAL_HEADERS}
|
||||
)
|
||||
|
||||
|
@ -43,6 +43,7 @@ include_directories(
|
||||
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
||||
${ARMADILLO_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PUGIXML_INCLUDE_DIR}
|
||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user