Skip to content

Commit 9c01e52

Browse files
committed
include libE57Format in ExternalInclude
1 parent 5790e7e commit 9c01e52

File tree

98 files changed

+29504
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+29504
-34
lines changed

.github/workflows/build_mmvii.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,21 @@ jobs:
269269
- name: Install cibuildwheel
270270
run: python -m pip install cibuildwheel==3.1.3
271271

272+
- name: Compile E57Format for Linux
273+
if: runner.os == 'Linux'
274+
run: |
275+
cmake -S MMVII -B MMVII/build -DCMAKE_BUILD_TYPE=Release
276+
cmake --build MMVII/build -j 4 --target E57Format -- -k
277+
env:
278+
CXX: clang++-18
279+
CC: clang-18
280+
281+
- name: Compile E57Format for Windows
282+
if: runner.os == 'Windows'
283+
run: |
284+
cmake -S MMVII -B MMVII/build -DCMAKE_PREFIX_PATH=C:/Miniconda/envs/test/Library
285+
cmake --build MMVII/build --config Release -j 4 --target E57Format
286+
272287
- name: Build and install for Linux
273288
if: runner.os == 'Linux'
274289
working-directory: ./MMVII/apib11/

MMVII/CMakeLists.txt

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ if((NOT OpenMP_CXX_FOUND) AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
7676
endif()
7777

7878
# libE57Format
79-
option(USE_LIBE57FORMAT "If ON, e57 point cloud file format will be available" OFF)
80-
if(USE_LIBE57FORMAT)
81-
set(LIBE57_INCLUDE_DIR "" CACHE PATH "Path to libe57format includes")
82-
set(LIBE57_LIBRARY "" CACHE FILEPATH "Path to libe57format .a library")
83-
find_package( XercesC 3.2 REQUIRED )
84-
endif()
79+
find_package( XercesC 3.2 REQUIRED )
80+
set(E57_RELEASE_LTO OFF CACHE BOOL "Compile release library with link-time optimization") # OFF for static
81+
add_subdirectory(ExternalInclude/libE57Format)
82+
include_directories(${CMAKE_BINARY_DIR}/E57-install/include)
83+
link_directories(${CMAKE_BINARY_DIR}/E57-install/lib)
8584

8685
#######################################################
8786
## Compilation toolchain
@@ -151,18 +150,8 @@ add_library(P2007 "${mmv2_libsrcs}" "${mmv2_headers}")
151150
target_include_directories(P2007 PRIVATE "${mmv2_include_dir};${mmv1_include_dir};${EIGEN3_INCLUDE_PATH};${PROJ_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}")
152151
target_link_libraries(P2007 PRIVATE MMVII_compiler_flags Threads::Threads ${PROJ_LIBRARIES} ${GDAL_LIBRARIES})
153152

154-
155-
if(USE_LIBE57FORMAT)
156-
target_compile_definitions(P2007 PUBLIC USE_LIBE57FORMAT=true)
157-
if(NOT EXISTS "${LIBE57_INCLUDE_DIR}")
158-
message(FATAL_ERROR "Path to libe57format includes is not correct: ${LIBE57_INCLUDE_DIR}")
159-
endif()
160-
if(NOT EXISTS "${LIBE57_LIBRARY}")
161-
message(FATAL_ERROR "Path to libe57format .a library is not correct: ${LIBE57_LIBRARY}")
162-
endif()
163-
target_include_directories(P2007 PRIVATE "${LIBE57_INCLUDE_DIR}")
164-
target_link_libraries(P2007 PRIVATE "${LIBE57_LIBRARY}" XercesC::XercesC)
165-
endif()
153+
target_link_libraries(P2007 PRIVATE E57Format)
154+
add_dependencies(P2007 E57Format)
166155

167156
# Force parallel compilation with MSVC
168157
if(MSVC)

MMVII/ExternalInclude/libE57Format/CHANGELOG.md

Lines changed: 306 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# This is a rewrite over time of the CMake file from the libe57 reference implementation
2+
# https://en.wikipedia.org/wiki/Ship_of_Theseus
3+
#
4+
# Use git blame to see all the changes and who has contributed.
5+
#
6+
# Copyright 2018-2023 Andy Maloney <[email protected]>
7+
# Original work Copyright 2010-2012 Roland Schwarz, Riegl LMS GmbH
8+
#
9+
# Permission is hereby granted, free of charge, to any person or organization
10+
# obtaining a copy of the software and accompanying documentation covered by
11+
# this license (the "Software") to use, reproduce, display, distribute,
12+
# execute, and transmit the Software, and to prepare derivative works of the
13+
# Software, and to permit third-parties to whom the Software is furnished to
14+
# do so, all subject to the following:
15+
#
16+
# The copyright notices in the Software and this entire statement, including
17+
# the above license grant, this restriction and the following disclaimer,
18+
# must be included in all copies of the Software, in whole or in part, and
19+
# all derivative works of the Software, unless such copies or derivative
20+
# works are solely in the form of machine-executable object code generated by
21+
# a source language processor.
22+
#
23+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25+
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
26+
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
27+
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
28+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29+
# DEALINGS IN THE SOFTWARE.
30+
31+
cmake_minimum_required( VERSION 3.15 )
32+
33+
# Set a private module find path
34+
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
35+
36+
message( STATUS "Using CMake ${CMAKE_VERSION}" )
37+
38+
project( E57Format
39+
DESCRIPTION
40+
"E57Format is a library to read and write E57 files"
41+
LANGUAGES
42+
CXX
43+
VERSION
44+
3.2.0
45+
)
46+
47+
string( TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE )
48+
49+
# Creates a build tag which is used in the REVISION_ID
50+
# e.g. "x86_64-darwin-AppleClang140"
51+
include( Tags )
52+
include( GitInfo )
53+
54+
# Collect all our current git info using:
55+
# https://github.com/cppmf/GitInfo.cmake
56+
GitInfo( ${CMAKE_CURRENT_SOURCE_DIR} )
57+
# GitInfoReport()
58+
59+
# Check if we are building ourself or being included and use this to set some defaults
60+
if ( ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME} )
61+
set( E57_BUILDING_SELF ON )
62+
endif()
63+
64+
# propose a default installation directory
65+
if ( E57_BUILDING_SELF )
66+
if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
67+
string( REGEX REPLACE "/${PROJECT_NAME}" "" CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
68+
set( T_ ${PROJECT_NAME} )
69+
set( T_ ${T_}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} )
70+
set( T_ ${T_}-${${PROJECT_NAME}_BUILD_TAG} )
71+
set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${T_}
72+
CACHE PATH
73+
"Install path prefix, prepended onto install directories."
74+
FORCE
75+
)
76+
endif()
77+
endif()
78+
79+
find_package( Threads REQUIRED )
80+
find_package( XercesC 3.2 REQUIRED )
81+
82+
option( E57_BUILD_SHARED
83+
"Compile E57Format as a shared library"
84+
OFF
85+
)
86+
87+
if( BUILD_SHARED_LIBS )
88+
set( E57_BUILD_SHARED ON )
89+
endif()
90+
91+
#########################################################################################
92+
# Cross checking and runtime verification in the code.
93+
# The extra code does not change the file contents.
94+
# E57_VALIDATION_LEVEL=0 off
95+
# E57_VALIDATION_LEVEL=1 basic
96+
# E57_VALIDATION_LEVEL=2 deep (implies basic) - checks at the packet level, so it will be slower
97+
set( E57_VALIDATION_LEVEL "1" CACHE STRING "Runtime validation level (0 = OFF, 1 = basic, 2 = deep)" )
98+
99+
# Output detailed logging while processing.
100+
option( E57_VERBOSE "Compile library with verbose logging" OFF )
101+
102+
# Enable/disable code which dumps detailed node info to std::ostream. (See NodeImpl::dump())
103+
# Instead of always including this code, it is an option for backwards compatibility.
104+
# The only real reason to turn this off would be for slightly smaller binaries.
105+
option( E57_ENABLE_DIAGNOSTIC_OUTPUT "Include code for diagnostic output using dump() on nodes" ON )
106+
107+
# Enable writing packets that are correct but will stress the reader.
108+
option( E57_WRITE_CRAZY_PACKET_MODE "Compile library to enable reader-stressing packets" OFF )
109+
110+
# Other compile options
111+
112+
# Link-time optiomization
113+
# CMake forces "thin" LTO (see https://gitlab.kitware.com/cmake/cmake/-/issues/23136)
114+
# which is a problem if compiling statically for distribution (e.g. in a package manager).
115+
# Generally you will only want to turn this off for distributing static release builds.
116+
option( E57_RELEASE_LTO "Compile release library with link-time optimization" ON )
117+
118+
#########################################################################################
119+
120+
set( REVISION_ID "${PROJECT_NAME}-${PROJECT_VERSION}-${${PROJECT_NAME}_BUILD_TAG}" )
121+
if ( GIT_LATEST_TAG )
122+
set( REVISION_ID "${REVISION_ID} (git ${GIT_LATEST_TAG})" )
123+
endif()
124+
message( STATUS "[${PROJECT_NAME}] Revision ID: ${REVISION_ID}" )
125+
126+
# Target
127+
if ( E57_BUILD_SHARED )
128+
message( STATUS "[${PROJECT_NAME}] Building shared library" )
129+
add_library( E57Format SHARED )
130+
else()
131+
message( STATUS "[${PROJECT_NAME}] Building static library" )
132+
add_library( E57Format STATIC )
133+
endif()
134+
135+
include( E57ExportHeader )
136+
include( GitUpdate )
137+
138+
# Main sources and includes
139+
add_subdirectory( extern/CRCpp )
140+
add_subdirectory( include )
141+
add_subdirectory( src )
142+
143+
# Target properties
144+
set_target_properties( E57Format
145+
PROPERTIES
146+
CXX_EXTENSIONS NO
147+
EXPORT_COMPILE_COMMANDS ON
148+
POSITION_INDEPENDENT_CODE ON
149+
INTERPROCEDURAL_OPTIMIZATION ${E57_RELEASE_LTO}
150+
INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF
151+
)
152+
153+
if ( NOT DEFINED CMAKE_DEBUG_POSTFIX )
154+
set_target_properties( E57Format
155+
PROPERTIES
156+
DEBUG_POSTFIX "-d"
157+
)
158+
endif()
159+
160+
if ( E57_BUILD_SHARED )
161+
set_target_properties( E57Format
162+
PROPERTIES
163+
VERSION ${PROJECT_VERSION}
164+
SOVERSION ${PROJECT_VERSION_MAJOR}
165+
)
166+
endif()
167+
168+
target_compile_features( ${PROJECT_NAME}
169+
PRIVATE
170+
cxx_std_14
171+
)
172+
173+
# Warnings
174+
include( CompilerWarnings )
175+
176+
# Check our validation level
177+
string( STRIP "${E57_VALIDATION_LEVEL}" E57_VALIDATION_LEVEL )
178+
if ( NOT E57_VALIDATION_LEVEL MATCHES "^[0-2]$" )
179+
message( FATAL_ERROR "[${PROJECT_NAME}] E57_VALIDATION_LEVEL should be 0-2: '${E57_VALIDATION_LEVEL}'" )
180+
else()
181+
message( STATUS "[${PROJECT_NAME}] Setting validation level to ${E57_VALIDATION_LEVEL}" )
182+
endif ()
183+
184+
# Target definitions
185+
target_compile_definitions( E57Format
186+
PRIVATE
187+
REVISION_ID="${REVISION_ID}"
188+
E57_VALIDATION_LEVEL=${E57_VALIDATION_LEVEL}
189+
$<$<BOOL:${E57_ENABLE_DIAGNOSTIC_OUTPUT}>:E57_ENABLE_DIAGNOSTIC_OUTPUT>
190+
$<$<BOOL:${E57_VERBOSE}>:E57_VERBOSE>
191+
$<$<BOOL:${E57_WRITE_CRAZY_PACKET_MODE}>:E57_WRITE_CRAZY_PACKET_MODE>
192+
)
193+
194+
# sanitizers
195+
include( Sanitizers )
196+
197+
# Target Libraries
198+
target_link_libraries( E57Format PRIVATE XercesC::XercesC )
199+
200+
# Install
201+
install(
202+
TARGETS
203+
E57Format
204+
EXPORT
205+
E57Format-export
206+
)
207+
208+
# ccache
209+
# Turns on ccache if found
210+
include( ccache )
211+
212+
# Formatting
213+
include( ClangFormat )
214+
215+
# Testing
216+
option( E57_BUILD_TEST
217+
"Build tests"
218+
${E57_BUILDING_SELF}
219+
)
220+
221+
if ( E57_BUILD_TEST )
222+
message( STATUS "[${PROJECT_NAME}] Testing enabled" )
223+
224+
enable_testing()
225+
226+
add_subdirectory( test )
227+
endif()
228+
229+
# CMake package files
230+
include( GNUInstallDirs )
231+
set( E57_INSTALL_CMAKEDIR
232+
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
233+
CACHE STRING
234+
"Install path for ${PROJECT_NAME} CMake files"
235+
)
236+
237+
message( STATUS "[${PROJECT_NAME}] CMake files install to ${CMAKE_INSTALL_PREFIX}/${E57_INSTALL_CMAKEDIR}" )
238+
239+
install(
240+
EXPORT
241+
E57Format-export
242+
DESTINATION
243+
"${E57_INSTALL_CMAKEDIR}"
244+
)
245+
246+
include(CMakePackageConfigHelpers)
247+
write_basic_package_version_file (
248+
e57format-config-version.cmake
249+
VERSION ${PROJECT_VERSION}
250+
COMPATIBILITY SameMajorVersion
251+
)
252+
253+
install(
254+
FILES
255+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/e57format-config.cmake
256+
${CMAKE_CURRENT_BINARY_DIR}/e57format-config-version.cmake
257+
DESTINATION
258+
"${E57_INSTALL_CMAKEDIR}"
259+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# How To Contribute
2+
3+
These are some of the things you can do to contribute to the project:
4+
5+
## 💰 Financial
6+
7+
Given that I'm an independent developer without funding, financial support is appreciated. If you would like to support the project financially (especially if you sell a product which uses this library), you can use the [sponsors page](https://github.com/sponsors/asmaloney) for one-off or recurring support, or we can arrange <a href="mailto:[email protected]?subject=libE57Format B2B Sponsorship">B2B invoicing</a> of some kind. Thank you!
8+
9+
## ✍ Write About The Project
10+
11+
If you find the project useful, spread the word! Articles, mastodon posts, tweets, blog posts, instagram photos - whatever you're into. Please include a referral back to the repository page: https://github.com/asmaloney/libE57Format
12+
13+
## ⭐️ Add a Star
14+
15+
If you found this project useful, please consider starring it! It helps me gauge how useful this project is.
16+
17+
## ☝ Raise Issues
18+
19+
If you run into something which doesn't work as expected, raising [an issue](https://github.com/asmaloney/libE57Format/issues) with all the relevant information to reproduce it would be helpful.
20+
21+
## 🐞 Bug Fixes & 🧪 New Things
22+
23+
I am happy to review any [pull requests](https://github.com/asmaloney/libE57Format/pulls). Please keep them as short as possible. Each pull request should be atomic and only address one issue. This helps with the review process.
24+
25+
Note that I will not accept everything, but I welcome discussion. If you are proposing a big change, please raise it as [an issue](https://github.com/asmaloney/libE57Format/issues) first for discussion.
26+
27+
### Formatting
28+
29+
This project uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format the code. There is a cmake target (_e57-clang-format_) - which runs _clang-format_ on the source files. After changes have been made, and before you submit your pull request, please run the following:
30+
31+
```sh
32+
cmake --build . --target e57-clang-format
33+
```
34+
35+
## 📖 Documentation
36+
37+
The [documentation](https://github.com/asmaloney/libE57Format) is a bit old and could use some lovin'. You can submit changes over in the [libE57Format-docs](https://github.com/asmaloney/libE57Format-docs) repository.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)