diff --git a/CMakeLists.txt b/CMakeLists.txt index cfd9574..80ba706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ # patches are most welcome! Please send them to the development mailing list. -cmake_minimum_required(VERSION 3.6 FATAL_ERROR) +cmake_minimum_required(VERSION 3.6...4.2 FATAL_ERROR) set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD_REQUIRED 11) @@ -82,46 +82,30 @@ find_package(Threads REQUIRED) # Find the Boost and Xerces libraries -set(Boost_USE_MULTITHREADED ON) -find_package(Boost +find_package(Boost CONFIG REQUIRED COMPONENTS + smart_ptr + crc + math program_options - thread filesystem + variant + format + lexical_cast + uuid OPTIONAL_COMPONENTS system ) -if (NOT Boost_FOUND) - set(BOOST_ROOT CACHE PATH "Location of the boost root directory" ) - message(FATAL_ERROR -"Unable to find boost library. -Please set the BOOST_ROOT to point to the boost distribution files." -) -endif(NOT Boost_FOUND) - -find_package(Xerces) -if (NOT Xerces_FOUND) - set(XERCES_ROOT CACHE PATH "Location of the xerces library") - message(FATAL_ERROR -"Unable to find xerces library. -Please set the the XERCES_ROOT to point to the root of the xerces directory." -) -endif (NOT Xerces_FOUND) -set(XML_LIBRARIES ${Xerces_LIBRARY}) -set(XML_INCLUDE_DIRS ${Xerces_INCLUDE_DIR}) + +find_package(XercesC REQUIRED) if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-DLINUX) - find_package(ICU REQUIRED) - set(XML_LIBRARIES ${XML_LIBRARIES} ${ICU_LIBRARIES}) - set(XML_INCLUDE_DIRS ${XML_INCLUDE_DIRS} ${ICU_INCLUDE_DIRS}) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") add_definitions(-DWINDOWS) endif() -add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) -add_definitions(-DBOOST_ALL_NO_LIB -DXERCES_STATIC_LIBRARY) add_definitions(-DE57_REFIMPL_REVISION_ID=${PROJECT_NAME}-${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_BUILD_VERSION}-${${PROJECT_NAME}_BUILD_TAG}) configure_file ( @@ -134,12 +118,6 @@ include_directories( include include/time_conversion src/refimpl - ${XML_INCLUDE_DIRS} - ${Boost_INCLUDE_DIR} -) - -link_directories( - ${Boost_LIBRARY_DIRS} ) @@ -161,6 +139,15 @@ set_target_properties( E57RefImpl PROPERTIES DEBUG_POSTFIX "-d" ) +target_link_libraries( E57RefImpl + PUBLIC + Boost::crc + Boost::smart_ptr + Boost::uuid + Threads::Threads + XercesC::XercesC +) + # # Files for LAS format support # @@ -170,6 +157,11 @@ add_library( LASReader STATIC include/LASReader.h ) +target_link_libraries( LASReader + PUBLIC + E57RefImpl +) + # # Time conversion utilities # @@ -191,16 +183,12 @@ add_executable( DemoWrite01 ) target_link_libraries( DemoWrite01 E57RefImpl - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ) add_executable( DemoRead01 src/examples/DemoRead01.cpp ) target_link_libraries( DemoRead01 E57RefImpl - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ) # @@ -214,41 +202,36 @@ target_link_libraries( las2e57 E57RefImpl LASReader time_conversion - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ) add_executable( e57fields src/tools/e57fields.cpp ) target_link_libraries( e57fields E57RefImpl - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} + Boost::smart_ptr ) add_executable( e57xmldump src/tools/e57xmldump.cpp ) target_link_libraries( e57xmldump E57RefImpl - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ) add_executable( e57validate src/tools/e57validate.cpp ) target_link_libraries( e57validate E57RefImpl - ${XML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ) add_executable( e57unpack src/tools/e57unpack.cpp ) target_link_libraries( e57unpack E57RefImpl - ${XML_LIBRARIES} - ${Boost_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} + Boost::filesystem + Boost::format + Boost::lexical_cast + Boost::program_options + Boost::variant ) # diff --git a/cmake/Modules/FindICU.cmake b/cmake/Modules/FindICU.cmake deleted file mode 100644 index 1731f3a..0000000 --- a/cmake/Modules/FindICU.cmake +++ /dev/null @@ -1,82 +0,0 @@ -# Finds the International Components for Unicode (ICU) Library -# -# ICU_FOUND - True if ICU found. -# ICU_I18N_FOUND - True if ICU's internationalization library found. -# ICU_INCLUDE_DIRS - Directory to include to get ICU headers -# Note: always include ICU headers as, e.g., -# unicode/utypes.h -# ICU_LIBRARIES - Libraries to link against for the common ICU -# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation -# (note: in addition to ICU_LIBRARIES) - -# Look for the header file. -find_path( - ICU_INCLUDE_DIR - NAMES unicode/utypes.h - DOC "Include directory for the ICU library") -mark_as_advanced(ICU_INCLUDE_DIR) - -# Look for the library. -find_library( - ICU_LIBRARY - NAMES icuuc cygicuuc cygicuuc32 - DOC "Libraries to link against for the common parts of ICU") -mark_as_advanced(ICU_LIBRARY) - -# Copy the results to the output variables. -if(ICU_INCLUDE_DIR AND ICU_LIBRARY) - set(ICU_FOUND 1) - set(ICU_LIBRARIES ${ICU_LIBRARY}) - set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR}) - - set(ICU_VERSION 0) - set(ICU_MAJOR_VERSION 0) - set(ICU_MINOR_VERSION 0) - if (EXISTS "${ICU_INCLUDE_DIR}/unicode/uvernum.h") - FILE(READ "${ICU_INCLUDE_DIR}/unicode/uvernum.h" _ICU_VERSION_CONENTS) - else() - FILE(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" _ICU_VERSION_CONENTS) - endif() - - STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MAJOR_NUM ([0-9]+).*" "\\1" ICU_MAJOR_VERSION "${_ICU_VERSION_CONENTS}") - STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MINOR_NUM ([0-9]+).*" "\\1" ICU_MINOR_VERSION "${_ICU_VERSION_CONENTS}") - - set(ICU_VERSION "${ICU_MAJOR_VERSION}.${ICU_MINOR_VERSION}") - - # Look for the ICU internationalization libraries - find_library( - ICU_I18N_LIBRARY - NAMES icuin icui18n cygicuin cygicuin32 - DOC "Libraries to link against for ICU internationalization") - mark_as_advanced(ICU_I18N_LIBRARY) - if (ICU_I18N_LIBRARY) - set(ICU_I18N_FOUND 1) - set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY}) - else (ICU_I18N_LIBRARY) - set(ICU_I18N_FOUND 0) - set(ICU_I18N_LIBRARIES) - endif (ICU_I18N_LIBRARY) -else(ICU_INCLUDE_DIR AND ICU_LIBRARY) - set(ICU_FOUND 0) - set(ICU_I18N_FOUND 0) - set(ICU_LIBRARIES) - set(ICU_I18N_LIBRARIES) - set(ICU_INCLUDE_DIRS) - set(ICU_VERSION) - set(ICU_MAJOR_VERSION) - set(ICU_MINOR_VERSION) -endif(ICU_INCLUDE_DIR AND ICU_LIBRARY) - -IF(ICU_FOUND) - IF( NOT ICU_FIND_QUIETLY ) - MESSAGE( STATUS "Found ICU header files in ${ICU_INCLUDE_DIRS}") - MESSAGE( STATUS "Found ICU libraries: ${ICU_LIBRARIES}") - ENDIF( NOT ICU_FIND_QUIETLY ) -ELSE(ICU_FOUND) -IF(ICU_FIND_REQUIRED) -MESSAGE( FATAL_ERROR "Could not find ICU" ) -ELSE(ICU_FIND_REQUIRED) -MESSAGE( STATUS "Optional package ICU was not found" ) -ENDIF(ICU_FIND_REQUIRED) -ENDIF(ICU_FOUND) - diff --git a/cmake/Modules/FindXerces.cmake b/cmake/Modules/FindXerces.cmake deleted file mode 100644 index da225f0..0000000 --- a/cmake/Modules/FindXerces.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# $Id$ - -# Copyright 2010 Roland Schwarz, Riegl LMS GmbH -# -# Permission is hereby granted, free of charge, to any person or organization -# obtaining a copy of the software and accompanying documentation covered by -# this license (the "Software") to use, reproduce, display, distribute, -# execute, and transmit the Software, and to prepare derivative works of the -# Software, and to permit third-parties to whom the Software is furnished to -# do so, all subject to the following: -# -# The copyright notices in the Software and this entire statement, including -# the above license grant, this restriction and the following disclaimer, -# must be included in all copies of the Software, in whole or in part, and -# all derivative works of the Software, unless such copies or derivative -# works are solely in the form of machine-executable object code generated by -# a source language processor. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -if (Xerces_FIND_VERSION) - message(WARNING "Finding a specific version of Xerces is not supported.") -endif (Xerces_FIND_VERSION) - -if( NOT $ENV{XERCES_ROOT} STREQUAL "" ) - set(XERCES_ROOT $ENV{XERCES_ROOT}) -endif() - -find_path(Xerces_INCLUDE_DIR - xercesc/sax2/SAX2XMLReader.hpp - ${XERCES_ROOT}/include - /usr/include -) - -#if (WIN32) -if (Xerces_USE_STATIC_LIBS) - find_library(Xerces_LIBRARY_DEBUG - NAMES xerces-c_static_3D.lib libxerces-c.a - PATHS ${XERCES_ROOT}/lib /usr/lib - ) - - find_library(Xerces_LIBRARY_RELEASE - NAMES xerces-c_static_3.lib libxerces-c.a - PATHS ${XERCES_ROOT}/lib usr/lib - ) -else(Xerces_USE_STATIC_LIBS) - find_library(Xerces_LIBRARY_DEBUG - NAMES xerces-c_3D.lib libxerces-c.dll.a libxerces-c.so libxerces-c.dylib - PATHS ${XERCES_ROOT}/lib /usr/lib - ) - - find_library(Xerces_LIBRARY_RELEASE - NAMES xerces-c_3.lib libxerces-c.dll.a libxerces-c.so libxerces-c.dylib - PATHS ${XERCES_ROOT}/lib /usr/lib - ) -endif(Xerces_USE_STATIC_LIBS) -#endif(WIN32) - -set (Xerces_LIBRARY debug ${Xerces_LIBRARY_DEBUG} optimized ${Xerces_LIBRARY_RELEASE}) - -mark_as_advanced( - Xerces_INCLUDE_DIR - Xerces_LIBRARY_DEBUG - Xerces_LIBRARY_RELEASE - Xerces_LIBRARY -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - Xerces - "Unable to find Xerces: \nPlease set the XERCES_ROOT variable to the Xerces directory.\n" - Xerces_INCLUDE_DIR - Xerces_LIBRARY_DEBUG - Xerces_LIBRARY_RELEASE - Xerces_LIBRARY -) - -set(Xerces_FOUND ${XERCES_FOUND}) diff --git a/include/E57Simple.h b/include/E57Simple.h index 6686523..5751921 100644 --- a/include/E57Simple.h +++ b/include/E57Simple.h @@ -57,6 +57,10 @@ #include "E57Foundation.h" #endif +#ifdef WIN32 +#include +#endif + using namespace std; using namespace boost; diff --git a/src/refimpl/E57RefImplConfig.cmake b/src/refimpl/E57RefImplConfig.cmake index 8ba7356..5f25de4 100644 --- a/src/refimpl/E57RefImplConfig.cmake +++ b/src/refimpl/E57RefImplConfig.cmake @@ -116,6 +116,17 @@ IF (E57RefImpl_LIBRARY_DEBUG AND NOT E57RefImpl_LIBRARY_RELEASE) SET(E57RefImpl_LIBRARIES ${E57RefImpl_LIBRARY_DEBUG}) ENDIF() +include(CMakeFindDependencyMacro) +find_dependency(Boost COMPONENTS crc smart_ptr uuid) +find_dependency(XercesC) + +list(APPEND E57RefImpl_LIBRARIES + Boost::crc + Boost::smart_ptr + Boost::uuid + XercesC::XercesC +) + IF (E57RefImpl_LIBRARY) set(E57RefImpl_LIBRARY ${E57RefImpl_LIBRARY} CACHE FILEPATH "The E57RefImpl library") # Remove superfluous "debug" / "optimized" keywords from @@ -134,7 +145,7 @@ ELSE(E57RefImpl_LIBRARY) ENDIF(E57RefImpl_LIBRARY) IF (E57RefImpl_FOUND) - SET(E57RefImpl_INCLUDE_DIRS ${E57RefImpl_INCLUDE_DIR} "E57RefImpl include directory") + SET(E57RefImpl_INCLUDE_DIRS ${E57RefImpl_INCLUDE_DIR}) ENDIF() diff --git a/src/refimpl/E57SimpleImpl.cpp b/src/refimpl/E57SimpleImpl.cpp index db71548..981c8e5 100644 --- a/src/refimpl/E57SimpleImpl.cpp +++ b/src/refimpl/E57SimpleImpl.cpp @@ -51,10 +51,6 @@ # include # include //#include //if you need this then remove in E57Foundation.h line 48 -#pragma warning(disable:4996) -# include -# include -# include # elif defined(__GNUC__) # define _LARGEFILE64_SOURCE # define __LARGE64_FILES