[libe57] Add new port (#18445)

* [libe57] Add new port

* remove deprecated entries

* update version files according to maintainer guide

* add dependency for linux

* update cmake patch

* update versioning

* delete obsolete lines

* fix linux/osx

* fix osx include and linker problem

* [libe57] remove deprecated functions
This commit is contained in:
maz-1 2021-07-16 15:52:38 +08:00 committed by GitHub
parent d90f71a4dd
commit 04658e4cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 403 additions and 0 deletions

View File

@ -0,0 +1,88 @@
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2012-04-04 13:09:12.000000000 +0800
+++ b/CMakeLists.txt 2021-06-16 01:14:35.669163100 +0800
@@ -31,6 +31,8 @@
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
# Set a private module find path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
@@ -81,17 +83,17 @@
endif(NOT Boost_FOUND)
set(Xerces_USE_STATIC_LIBS On)
-find_package(Xerces QUIET)
-if (NOT Xerces_FOUND)
+find_package(XercesC QUIET)
+if (NOT XercesC_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)
+endif (NOT XercesC_FOUND)
-set(XML_LIBRARIES ${Xerces_LIBRARY})
-set(XML_INCLUDE_DIRS ${Xerces_INCLUDE_DIR})
+set(XML_LIBRARIES ${XercesC_LIBRARY})
+set(XML_INCLUDE_DIRS ${XercesC_INCLUDE_DIR})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions(-DLINUX)
@@ -187,12 +189,18 @@
add_executable( las2e57
src/tools/las2e57.cpp
)
+
+if (MSVC)
+ set(LAS2E57_EXTRA_LINK bcrypt)
+endif(MSVC)
+
target_link_libraries( las2e57
E57RefImpl
LASReader
time_conversion
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${LAS2E57_EXTRA_LINK}
)
add_executable( e57fields
src/tools/e57fields.cpp
@@ -270,15 +270,32 @@
install(
FILES
include/E57Foundation.h
+ include/E57Simple.h
+ include/LASReader.h
DESTINATION include/e57
)
+install(
+ FILES
+ include/time_conversion/time_conversion.h
+ include/time_conversion/basictypes.h
+ include/time_conversion/constants.h
+ include/time_conversion/gnss_error.h
+ DESTINATION include/e57/time_conversion
+)
install(
FILES
CHANGES.TXT
README.TXT
src/refimpl/E57RefImplConfig.cmake
- DESTINATION .
+ DESTINATION share/e57refimpl
+)
+
+install(
+ FILES
+ README.TXT
+ RENAME copyright
+ DESTINATION share/libe57
)
#include (InstallRequiredSystemLibraries)

View File

@ -0,0 +1,96 @@
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2021-06-16 22:53:02.033465000 +0800
+++ b/CMakeLists.txt 2021-06-16 23:01:31.542323600 +0800
@@ -25,7 +25,9 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-cmake_minimum_required(VERSION 2.8.2)
+cmake_minimum_required(VERSION 3.1)
+
+set(CMAKE_CXX_STANDARD 11)
# Override flags to enable prepare for linking to static runtime
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
diff -Naur a/src/tools/e57fields.cpp b/src/tools/e57fields.cpp
--- a/src/tools/e57fields.cpp 2012-04-04 17:19:01.000000000 +0800
+++ b/src/tools/e57fields.cpp 2021-06-16 22:55:02.789463000 +0800
@@ -30,11 +30,7 @@
#include <iomanip>
#include <float.h>
#include <map>
-#if defined(_MSC_VER)
-# include <memory>
-#else
-# include <tr1/memory>
-#endif
+#include <memory>
#include "E57Foundation.h"
#include "E57FoundationImpl.h" //??? for exceptions, should be in separate file
@@ -43,7 +39,6 @@
using namespace e57;
using namespace std;
-using namespace std::tr1;
//!!! prologue, file name, date, version#, total # elements
//!!! doc
@@ -446,9 +441,9 @@
/// Only one is used, depending on the type of the E57 element.
/// One of these three should be resized to BUFFER_ELEMENT_COUNT.
/// These are smart pointers to avoid the copying (and the moving) when put on the cvElements list.
- shared_ptr<vector<int64_t> > iBuffer;
- shared_ptr<vector<double> > dBuffer;
- shared_ptr<vector<string> > sBuffer;
+ std::shared_ptr<vector<int64_t> > iBuffer;
+ std::shared_ptr<vector<double> > dBuffer;
+ std::shared_ptr<vector<string> > sBuffer;
/// The precalculated parts of the element path name.
/// The only part that is missing is the record number which goes in between.
diff -Naur a/src/tools/e57unpack.cpp b/src/tools/e57unpack.cpp
--- a/src/tools/e57unpack.cpp 2011-10-06 16:01:00.000000000 +0800
+++ b/src/tools/e57unpack.cpp 2021-06-16 22:56:57.150323800 +0800
@@ -41,12 +41,8 @@
#include <stdexcept>
using std::runtime_error;
-#if defined(_MSC_VER)
-# include <memory>
-#else
-# include <tr1/memory>
-#endif
-using std::tr1::shared_ptr;
+#include <memory>
+using std::shared_ptr;
#include <string>
using std::string;
diff -Naur a/src/tools/e57validate.cpp b/src/tools/e57validate.cpp
--- a/src/tools/e57validate.cpp 2011-10-06 16:01:00.000000000 +0800
+++ b/src/tools/e57validate.cpp 2021-06-16 22:58:19.365323700 +0800
@@ -66,11 +66,8 @@
================================================================*/
-#if defined(_MSC_VER)
-# include <unordered_map>
-#else
-# include <tr1/unordered_map>
-using std::tr1::unordered_map;
+
+#include <unordered_map>
+using std::unordered_map;
-#endif
#include <cstring>
using std::strlen;
@@ -694,7 +692,7 @@
void dump(int indent = 0, std::ostream& os = std::cout);
//================
private:
- typedef std::tr1::unordered_map<int64_t, LineGroup> GroupsMap;
+ typedef std::unordered_map<int64_t, LineGroup> GroupsMap;
bool isDefined_;
bool isByRow_;

View File

@ -0,0 +1,145 @@
diff -x '.*' -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2021-06-24 16:56:37.000000000 +0800
+++ b/CMakeLists.txt 2021-06-24 17:30:28.000000000 +0800
@@ -163,6 +163,13 @@
include/time_conversion/gnss_error.h
)
+# fix dependency introduced by xerces
+if(APPLE)
+ find_library(CORE_FOUNDATION CoreFoundation REQUIRED)
+ find_library(CORE_SERVICES CoreServices REQUIRED)
+ set(EXTRA_LINK_FLAGS_OSX ${CORE_FOUNDATION} ${CORE_SERVICES})
+endif()
+
#
# Example programs
#
@@ -174,6 +181,7 @@
E57RefImpl
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
add_executable( DemoRead01
src/examples/DemoRead01.cpp
@@ -182,6 +190,7 @@
E57RefImpl
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
#
@@ -203,6 +212,7 @@
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LAS2E57_EXTRA_LINK}
+ ${EXTRA_LINK_FLAGS_OSX}
)
add_executable( e57fields
src/tools/e57fields.cpp
@@ -211,6 +221,7 @@
E57RefImpl
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
add_executable( e57xmldump
src/tools/e57xmldump.cpp
@@ -219,6 +230,7 @@
E57RefImpl
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
add_executable( e57validate
src/tools/e57validate.cpp
@@ -227,6 +239,7 @@
E57RefImpl
${XML_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
add_executable( e57unpack
src/tools/e57unpack.cpp
@@ -236,6 +249,7 @@
${XML_LIBRARIES}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ ${EXTRA_LINK_FLAGS_OSX}
)
#
diff -x '.*' -Naur a/src/refimpl/E57FoundationImpl.cpp b/src/refimpl/E57FoundationImpl.cpp
--- a/src/refimpl/E57FoundationImpl.cpp 2012-04-12 21:44:42.000000000 +0800
+++ b/src/refimpl/E57FoundationImpl.cpp 2021-06-24 17:04:57.000000000 +0800
@@ -57,6 +57,12 @@
# include <fcntl.h>
# define O_BINARY (0)
# define _unlink unlink
+#elif defined( __APPLE__ )
+# include <sys/types.h>
+# include <unistd.h>
+# include <fcntl.h>
+# define O_BINARY (0)
+# define _unlink unlink
#else
# error "no supported OS platform defined"
#endif
@@ -4764,6 +4770,8 @@
# endif
#elif defined(LINUX)
int64_t result = ::lseek64(fd_, offset, whence);
+#elif defined( __APPLE__ )
+ int64_t result = ::lseek(fd_, offset, whence);
#else
# error "no supported OS platform defined"
#endif
diff -x '.*' -Naur a/src/refimpl/E57Simple.cpp b/src/refimpl/E57Simple.cpp
--- a/src/refimpl/E57Simple.cpp 2011-05-14 05:40:11.000000000 +0800
+++ b/src/refimpl/E57Simple.cpp 2021-06-24 16:58:24.000000000 +0800
@@ -799,6 +799,9 @@
# define __LARGE64_FILES
# include <sys/types.h>
# include <unistd.h>
+#elif defined( __APPLE__ )
+# include <sys/types.h>
+# include <unistd.h>
#else
# error "no supported OS platform defined"
#endif
diff -x '.*' -Naur a/src/refimpl/E57SimpleImpl.cpp b/src/refimpl/E57SimpleImpl.cpp
--- a/src/refimpl/E57SimpleImpl.cpp 2012-04-12 23:15:46.000000000 +0800
+++ b/src/refimpl/E57SimpleImpl.cpp 2021-06-24 16:58:24.000000000 +0800
@@ -74,6 +74,12 @@
# include <boost/uuid/uuid.hpp>
# include <boost/uuid/uuid_generators.hpp>
# include <boost/uuid/uuid_io.hpp>
+#elif defined(__APPLE__)
+# include <sys/types.h>
+# include <unistd.h>
+# include <boost/uuid/uuid.hpp>
+# include <boost/uuid/uuid_generators.hpp>
+# include <boost/uuid/uuid_io.hpp>
#else
# error "no supported OS platform defined"
#endif
diff -x '.*' -Naur a/src/tools/las2e57.cpp b/src/tools/las2e57.cpp
--- a/src/tools/las2e57.cpp 2012-04-04 19:09:11.000000000 +0800
+++ b/src/tools/las2e57.cpp 2021-06-24 17:11:11.000000000 +0800
@@ -404,12 +404,12 @@
int64_t startIndex;
BoundingBox bbox;
- GroupRecord(int64_t id);
+ GroupRecord(int64_t id = 0);
void addMember(double coords[3], int64_t recordIndex);
void dump(int indent = 0, std::ostream& os = std::cout);
};
-GroupRecord::GroupRecord(int64_t id_arg = 0)
+GroupRecord::GroupRecord(int64_t id_arg)
: id(id_arg),
count(0),
startIndex(0),

View File

@ -0,0 +1,32 @@
set(VERSION 1.1.312)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/E57RefImpl_src-${VERSION})
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO e57-3d-imgfmt
FILENAME "E57RefImpl_src-${VERSION}.zip"
SHA512 c729cc3094131f115ddf9b8c24a9420c4ab9d16a4343acfefb42f997f4bf25247cd5563126271df2af95f103093b7f6b360dbade52c9e66ec39dd2f06e041eb7
PATCHES
"0001_cmake.patch"
"0002_replace_tr1_with_cpp11.patch"
"0003_fix_osx_support.patch"
)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/share/libe57)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
vcpkg_copy_pdbs()
vcpkg_copy_tools(
TOOL_NAMES e57fields e57unpack e57validate e57xmldump las2e57
AUTO_CLEAN
)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

29
ports/libe57/vcpkg.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "libe57",
"version-semver": "1.1.312",
"description": "An open source implementation of the ASTM E2807 Standard Specification for 3D Imaging Data Exchange in the C++ language.",
"homepage": "http://www.libe57.org/",
"dependencies": [
"boost-crc",
"boost-filesystem",
"boost-format",
"boost-program-options",
"boost-system",
"boost-thread",
"boost-uuid",
"boost-variant",
{
"name": "icu",
"platform": "linux"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"xerces-c"
]
}

View File

@ -3124,6 +3124,10 @@
"baseline": "1.2.6",
"port-version": 0
},
"libe57": {
"baseline": "1.1.312",
"port-version": 0
},
"libepoxy": {
"baseline": "1.5.5",
"port-version": 0

9
versions/l-/libe57.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "50300e4d95248be2c168fee27a31c5506c7b840d",
"version-semver": "1.1.312",
"port-version": 0
}
]
}