Addressed issues with Conan packaging (#24)
* Improving local conan recipe, debugging issues with MSVC linking * Improved GitHub Action * Fixing installation of conan * Fixing windows issues * Updated README and Changelog
This commit is contained in:
@@ -9,7 +9,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04, windows-latest, macos-latest]
|
||||
os: [ubuntu-20.04, macos-latest]
|
||||
build_type: [Debug, Release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -29,19 +30,16 @@ jobs:
|
||||
run: |
|
||||
pip install conan --upgrade
|
||||
conan profile new default --detect
|
||||
conan profile update settings.build_type=${{ matrix.build_type }} default
|
||||
|
||||
- name: Linux build
|
||||
if: matrix.os == 'ubuntu-20.04'
|
||||
run: |
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
conan create . -o openE57:with_examples=True -o openE57:with_tools=True --build=missing
|
||||
conan create . -o openE57:with_tools=True --build=missing
|
||||
|
||||
- name: Mac build
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
conan create . -o openE57:with_examples=True --build=missing
|
||||
conan create . --build=missing
|
||||
|
||||
- name: Windows build
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
conan create . -o openE57:with_examples=True -o openE57:with_tools=True --build=missing
|
||||
63
.github/workflows/build-win.yml
vendored
Normal file
63
.github/workflows/build-win.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: openE57
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest]
|
||||
build_type: [Release, Debug]
|
||||
runtime_type: [MT, MTd, MD, MDd]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
build_type: Release
|
||||
runtime_type: MTd
|
||||
- os: windows-latest
|
||||
build_type: Release
|
||||
runtime_type: MDd
|
||||
- os: windows-latest
|
||||
build_type: Debug
|
||||
runtime_type: MT
|
||||
- os: windows-latest
|
||||
build_type: Debug
|
||||
runtime_type: MD
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
env:
|
||||
CONAN_USER_HOME: "${{ github.workspace }}/release"
|
||||
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"
|
||||
INSTALL_DIR: ${{ github.workspace }}/install/
|
||||
|
||||
steps:
|
||||
- name: Perform checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Python environment
|
||||
uses: actions/setup-python@v2
|
||||
|
||||
- name: Install conan
|
||||
run: |
|
||||
pip install conan --upgrade
|
||||
conan remote clean
|
||||
conan remote add conancenter https://center.conan.io True --insert
|
||||
|
||||
- name: Configure conan profile
|
||||
run: |
|
||||
conan profile new ${{ matrix.build_type }}-${{ matrix.runtime_type }} --detect
|
||||
conan profile update settings.build_type=${{ matrix.build_type }} ${{ matrix.build_type }}-${{ matrix.runtime_type }}
|
||||
conan profile update settings.compiler.runtime=${{ matrix.runtime_type }} ${{ matrix.build_type }}-${{ matrix.runtime_type }}
|
||||
|
||||
- name: Windows Release build
|
||||
if: matrix.build_type == 'Release'
|
||||
run: |
|
||||
conan create . -o openE57:with_tools=True --build=missing --profile ${{ matrix.build_type }}-${{ matrix.runtime_type }}
|
||||
|
||||
- name: Windows Debug build
|
||||
if: matrix.build_type == 'Debug'
|
||||
run: |
|
||||
conan create . --build=missing --profile ${{ matrix.build_type }}-${{ matrix.runtime_type }}
|
||||
@@ -1,5 +1,13 @@
|
||||
# openE57
|
||||
|
||||
## [1.6.1] - 2022-02-16
|
||||
|
||||
## Changed
|
||||
- Fixed issues on Visual Studio by setting incorrectly CMAKE_MSVC_RUNTIME_TYPE
|
||||
- Improved compatibility with conan build process
|
||||
- Added option to disable -fPIC on Linux (enabled by default)
|
||||
- Updated README.md
|
||||
|
||||
## [1.6.0] - 2022-02-05
|
||||
|
||||
## Changed
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
|
||||
|
||||
# Enables the MSVC_RUNTIME_LIBRARY property on targets
|
||||
# Enables the CMAKE_MSVC_RUNTIME_LIBRARY property on targets
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
|
||||
project(openE57 VERSION 1.6.0 LANGUAGES C CXX DESCRIPTION "openE57 is a library for handling E57 files")
|
||||
project(openE57 VERSION 1.6.1 LANGUAGES C CXX DESCRIPTION "openE57 is a library for handling E57 files")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
@@ -55,11 +55,12 @@ if("${isSystemDir}" STREQUAL "-1")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
endif("${isSystemDir}" STREQUAL "-1")
|
||||
|
||||
option(BUILD_EXAMPLES "Build e57 examples" FALSE)
|
||||
option(BUILD_TOOLS "Build e57 tools" FALSE)
|
||||
option(BUILD_TESTS "Build e57 tests" FALSE)
|
||||
option(BUILD_SHARED_LIBS "Build e57 shared libraries" FALSE)
|
||||
option(BUILD_WITH_MT "Build e57 libraries as MultiThreaded DLL" FALSE)
|
||||
option(BUILD_EXAMPLES "Build opene57 examples" FALSE)
|
||||
option(BUILD_TOOLS "Build opene57 tools" FALSE)
|
||||
option(BUILD_TESTS "Build opene57 tests" FALSE)
|
||||
option(BUILD_SHARED_LIBS "Build opene57 shared libraries" FALSE)
|
||||
option(BUILD_WITH_MT "Build the project with /MT when using Visual Studio" FALSE)
|
||||
option(BUILD_WITH_FPIC "Build the project with -fPIC on Unix" TRUE)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR "Shared Libraries are not supported due to missing exported symbols")
|
||||
@@ -67,9 +68,8 @@ else(BUILD_SHARED_LIBS)
|
||||
set(LIBRARY_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
@@ -77,9 +77,8 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
#
|
||||
# Install Artifacts
|
||||
#
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/CHANGELOG.md
|
||||
DESTINATION .)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG.md
|
||||
DESTINATION .)
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "Michele Adduci <adduci@tutanota.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_MAJOR_VERSION}")
|
||||
|
||||
56
README.md
56
README.md
@@ -13,7 +13,7 @@ The library is compiled as C++17, since some of following language intrinsics an
|
||||
* thread (replaces boost::thread)
|
||||
* memory (replaces boost::shared_ptr and std::auto_ptr)
|
||||
|
||||
At the current state, Boost is still required as in the original source code, but it will be completely removed with the release 2.0.0.
|
||||
At the current state, Boost is still required when building the tools as in the original source code, but it will be completely removed with the release 2.0.0.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -23,9 +23,22 @@ You need the following tools to build this library:
|
||||
* A recent version of CMake (3.15+)
|
||||
* A recent version of conan (1.28+)
|
||||
|
||||
## How to build it
|
||||
## Build Instructions
|
||||
|
||||
On Linux:
|
||||
There are two ways to build and use openE57: building it as a conan package or as a standard CMake project.
|
||||
The dependencies are now managed with conan and integrated in CMake, without the need of compiling the required libraries by yourself.
|
||||
|
||||
### Building as a local conan package
|
||||
|
||||
The following instructions will guide you to build openE57 as a local conan package (actually it is being submitted as official conan recipe in the Conan Center), so it can be used it further in other projects.
|
||||
|
||||
Available conan options are the following ones:
|
||||
|
||||
* with_tools - disabled by default
|
||||
* shared - disabled by default (not supported at the moment - no symbol is exported yet)
|
||||
* fPIC - enabled by default, activates the `-fPIC` flag on gcc/clang compilers on Linux/Mac
|
||||
|
||||
Platform independent:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/madduci/openE57.git
|
||||
@@ -33,20 +46,37 @@ cd open57
|
||||
conan create . --build=missing
|
||||
```
|
||||
|
||||
### Building as local project (e.g. for development)
|
||||
|
||||
The following instructions will guide you to build openE57 as a standard CMake Project, downloading the external dependencies with conan, but managing all the settings with CMake.
|
||||
|
||||
Available CMake Options are:
|
||||
|
||||
* BUILD_EXAMPLES
|
||||
* BUILD_TOOLS
|
||||
* BUILD_TESTS - actually unsupported (no tests yet available)
|
||||
* BUILD_SHARED_LIBS - actually unsupported (missing exported symbols)
|
||||
* BUILD_WITH_MT - activates/disables the `/MT[d]` flag when using Visual Studio
|
||||
* BUILD_WITH_FPIC - activates/disables the `-fPIC` flag on gcc/clang compilers on Linux/Mac
|
||||
|
||||
On Linux:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/madduci/openE57.git
|
||||
cd open57
|
||||
mkdir build && cd build
|
||||
conan install .. --build=missing
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build . --config Release --target install
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
```cmd
|
||||
git clone https://github.com/madduci/openE57.git
|
||||
cd open57
|
||||
md build && cd build
|
||||
conan create . --build=missing
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_MT=[TRUE|FALSE]
|
||||
cmake --build . --config Release --target install
|
||||
```
|
||||
|
||||
Available conan options (but disabled by default) are the following ones:
|
||||
|
||||
* with_examples
|
||||
* with_tools
|
||||
* with_tests
|
||||
* mt (MSVC Only)
|
||||
* shared (Not supported at the moment - no symbol is exported yet)
|
||||
|
||||
The dependencies are now managed with conan and integrated in CMake, without the need of compiling the required libraries by yourself.
|
||||
|
||||
133
conanfile.py
133
conanfile.py
@@ -1,90 +1,117 @@
|
||||
from conans import ConanFile, CMake, tools
|
||||
import os, shutil
|
||||
from conans import ConanFile, tools, CMake
|
||||
from conan.tools.microsoft import msvc_runtime_flag
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
import os
|
||||
|
||||
|
||||
class ConanFileDefault(ConanFile):
|
||||
name = "openE57"
|
||||
class Opene57Conan(ConanFile):
|
||||
name = "opene57"
|
||||
version = "1.6.1"
|
||||
description = "A C++ library for reading and writing E57 files, " \
|
||||
"fork of the original libE57 (http://libe57.org)"
|
||||
topics = ("conan", "openE57", "e57")
|
||||
version = "1.6.0"
|
||||
url = "https://github.com/openE57/openE57"
|
||||
homepage = "https://github.com/openE57/openE57"
|
||||
license = ("MIT", "E57 Software Licenses")
|
||||
license = ("MIT", "BSL-1.0")
|
||||
exports_sources = [ "src/*", "LICENSE*", "CHANGELOG.md", "*.txt"]
|
||||
generators = "cmake", "cmake_find_package"
|
||||
short_paths = True
|
||||
_cmake = None
|
||||
|
||||
@property
|
||||
def _source_subfolder(self):
|
||||
return "source_subfolder"
|
||||
|
||||
@property
|
||||
def _build_subfolder(self):
|
||||
return "build_subfolder"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {"with_examples": [True, False],
|
||||
"with_tools": [True, False],
|
||||
'with_tests': [True, False],
|
||||
"mt": [True, False],
|
||||
"shared": [True, False]}
|
||||
|
||||
settings = "os", "compiler", "arch", "build_type"
|
||||
options = {"with_tools": [True, False],
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False]}
|
||||
default_options = {
|
||||
'with_examples': False,
|
||||
'with_tools': False,
|
||||
'with_tests': False,
|
||||
'mt': False,
|
||||
'shared': False}
|
||||
'shared': False,
|
||||
'fPIC': True}
|
||||
|
||||
@property
|
||||
def _minimum_compilers_version(self):
|
||||
return {
|
||||
"Visual Studio": "15",
|
||||
"gcc": "7",
|
||||
"clang": "6",
|
||||
"apple-clang": "10",
|
||||
}
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
del self.options.fPIC
|
||||
|
||||
def validate(self):
|
||||
if self.options.shared == True:
|
||||
if self.options.shared:
|
||||
raise ConanInvalidConfiguration("OpenE57 cannot be built as shared library yet")
|
||||
|
||||
if self.options.mt == True and self.settings.compiler != "Visual Studio":
|
||||
raise ConanInvalidConfiguration("The MT compile option is only available for Visual Studio")
|
||||
|
||||
def build(self):
|
||||
cmake = self._configure_cmake()
|
||||
cmake.build()
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
tools.check_min_cppstd(self, 17)
|
||||
|
||||
minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False)
|
||||
if not minimum_version:
|
||||
self.output.warn("C++17 support required. Your compiler is unknown. Assuming it supports C++17.")
|
||||
elif tools.Version(self.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration("C++17 support required, which your compiler does not support.")
|
||||
|
||||
def build_requirements(self):
|
||||
if tools.cross_building(self, skip_x64_x86=True) and hasattr(self, 'settings_build'):
|
||||
self.build_requires("openE57/{}".format(self.version))
|
||||
|
||||
if self.options.with_tools == True:
|
||||
if self.options.with_tools:
|
||||
self.build_requires("boost/1.78.0")
|
||||
self.options["boost"].multithreading = True
|
||||
self.options["boost"].shared = False
|
||||
self.options["boost"].shared = self.options.shared
|
||||
|
||||
def requirements(self):
|
||||
self.requires("icu/70.1")
|
||||
self.options["icu"].shared = False
|
||||
if self.settings.os == "Linux" or tools.is_apple_os(self.settings.os):
|
||||
self.requires("icu/70.1")
|
||||
self.options["icu"].shared = self.options.shared
|
||||
|
||||
self.requires("xerces-c/3.2.3")
|
||||
self.options["xerces-c"].shared = False
|
||||
self.options["xerces-c"].shared = self.options.shared
|
||||
|
||||
def _configure_cmake(self):
|
||||
if self._cmake:
|
||||
return self._cmake
|
||||
self._cmake = CMake(self)
|
||||
self._cmake.definitions["BUILD_EXAMPLES"] = self.options.with_examples
|
||||
self._cmake.definitions["PROJECT_VERSION"] = self.version
|
||||
self._cmake.definitions["BUILD_EXAMPLES"] = False
|
||||
self._cmake.definitions["BUILD_TOOLS"] = self.options.with_tools
|
||||
self._cmake.definitions["BUILD_TESTS"] = self.options.with_tests
|
||||
self._cmake.definitions["BUILD_WITH_MT"] = self.options.mt
|
||||
self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
|
||||
self._cmake.definitions["CMAKE_INSTALL_PREFIX"] = self.package_folder
|
||||
self._cmake.configure(build_folder=self._build_subfolder)
|
||||
self._cmake.definitions["BUILD_TESTS"] = False
|
||||
if self.settings.os == "Windows":
|
||||
self._cmake.definitions["BUILD_WITH_MT"] = "MT" in str(msvc_runtime_flag(self))
|
||||
else:
|
||||
self._cmake.definitions["BUILD_WITH_FPIC"] = self.options.fPIC
|
||||
self._cmake.configure()
|
||||
return self._cmake
|
||||
|
||||
def build(self):
|
||||
cmake = self._configure_cmake()
|
||||
cmake.build()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.defines.append("E57_REFIMPL_REVISION_ID={name}-{version}".format(name=self.name, version=self.version))
|
||||
self.cpp_info.defines.append("XERCES_STATIC_LIBRARY")
|
||||
self.cpp_info.libs = ["openE57", "openE57las"]
|
||||
if self.options.with_tools:
|
||||
bin_path = os.path.join(self.package_folder, "bin")
|
||||
self.output.info("Appending PATH env: {}".format(bin_path))
|
||||
self.env_info.PATH.append(bin_path)
|
||||
|
||||
lib_suffix = "-d" if self.settings.build_type == "Debug" else ""
|
||||
self.cpp_info.libs = [f"openE57{lib_suffix}", f"openE57las{lib_suffix}"]
|
||||
|
||||
self.cpp_info.defines.append(f"E57_REFIMPL_REVISION_ID={self.name}-{self.version}")
|
||||
self.cpp_info.defines.append("NOMINMAX")
|
||||
if self.options.shared == False:
|
||||
self.cpp_info.defines.append("XERCES_STATIC_LIBRARY")
|
||||
|
||||
self.cpp_info.set_property("cmake_target_name", "opene57")
|
||||
self.cpp_info.set_property("cmake_target_name", "opene57")
|
||||
# TODO: To remove in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.names["cmake_find_package"] = "opene57"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "opene57"
|
||||
|
||||
def package(self):
|
||||
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
|
||||
self.copy(pattern="LICENSE.libE57", dst="licenses", src=self._source_subfolder)
|
||||
self.copy(pattern="LICENSE", dst="licenses", src=".")
|
||||
self.copy(pattern="LICENSE.libE57", dst="licenses", src=".")
|
||||
cmake = self._configure_cmake()
|
||||
cmake.install()
|
||||
os.remove(os.path.join(self.package_folder, "CHANGELOG.md"))
|
||||
tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll")
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
#
|
||||
# Define Settings and targets
|
||||
#
|
||||
|
||||
# Set a private module find path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(InstallRequiredSystemLibraries)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
# Check if we are building a conan recipe
|
||||
#if(NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
#include(InstallRequiredSystemLibraries)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler_options.cmake)
|
||||
#endif()
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake)
|
||||
|
||||
set(CONFIG_PACKAGE_INSTALL_DIR lib/cmake/${PROJECT_NAME})
|
||||
@@ -35,4 +41,3 @@ endif()
|
||||
# Add Clang Format
|
||||
#
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang_format.cmake)
|
||||
|
||||
|
||||
@@ -13,13 +13,18 @@ if(MSVC)
|
||||
WINDOWS
|
||||
NOMINMAX # conflicts with std::numeric_limits
|
||||
$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:RELWITHDEBINFO>,$<CONFIG:MINSIZEREL>>:NDEBUG>
|
||||
$<$<CONFIG:DEBUG>:_DEBUG>)
|
||||
$<$<CONFIG:DEBUG>:_DEBUG>
|
||||
$<$<AND:$<CONFIG:DEBUG>,$<NOT:$<BOOL:${BUILD_WITH_MT}>>>:_DLL>
|
||||
)
|
||||
|
||||
list(APPEND linker_flags
|
||||
$<$<BOOL:${BUILD_SHARED_LIBS}>:/LTCG>
|
||||
)
|
||||
|
||||
set(MSVC_RUNTIME_TYPE $<IF:$<BOOL:${BUILD_WITH_MT}>,MultiThreaded$<$<CONFIG:Debug>:Debug>,MultiThreaded$<$<CONFIG:Debug>:Debug>>DLL)
|
||||
|
||||
if(BUILD_WITH_MT)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
message(STATUS "Selected MSVC_RUNTIME_LIBRARY: ${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
endif()
|
||||
|
||||
else(MSVC)
|
||||
|
||||
@@ -34,22 +39,23 @@ else(MSVC)
|
||||
$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:MINSIZEREL>>:_FORTIFY_SOURCE=2>
|
||||
)
|
||||
|
||||
list(APPEND linker_flags
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,defs>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,now>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,relro>
|
||||
# Clang doesn't support these hardening flags
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-Wl,-pie>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-fpie>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-pipe>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-static-libstdc++>
|
||||
$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=address>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=leak>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=undefined>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fstack-clash-protection>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fbounds-check>
|
||||
-fstack-protector
|
||||
-fPIC)
|
||||
list(APPEND linker_flags
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,defs>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,now>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,relro>
|
||||
# Clang doesn't support these hardening flags
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-Wl,-pie>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-fpie>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-pipe>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-static-libstdc++>
|
||||
$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=address>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=leak>
|
||||
$<$<CONFIG:DEBUG>:-fsanitize=undefined>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fstack-clash-protection>
|
||||
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fbounds-check>
|
||||
-fstack-protector
|
||||
$<$<BOOL:${BUILD_WITH_FPIC}>-fPIC>
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
@@ -3,7 +3,9 @@ set(Xerces_USE_STATIC_LIBS ON)
|
||||
find_package(XercesC 3.2 REQUIRED)
|
||||
set(XML_LIBRARIES ${XercesC_LIBRARIES})
|
||||
set(XML_INCLUDE_DIRS ${XercesC_INCLUDE_DIRS})
|
||||
list(APPEND compiler_definitions XERCES_STATIC_LIBRARY)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
list(APPEND compiler_definitions XERCES_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
# Add ICU in Linux Systems
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Apple")
|
||||
@@ -17,9 +19,11 @@ endif()
|
||||
|
||||
# Find Boost (Required by Tools)
|
||||
if(BUILD_TOOLS)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED $<IF:$<AND:$<BOOL:${MSVC}>,$<NOT:$<BOOL:${BUILD_WITH_MT}>>>,OFF,ON>)
|
||||
find_package(Boost 1.70.0 COMPONENTS program_options system thread filesystem REQUIRED)
|
||||
list(APPEND compiler_definitions
|
||||
BOOST_ALL_NO_LIB
|
||||
|
||||
@@ -7,7 +7,7 @@ foreach(EXAMPLE ${EXAMPLES})
|
||||
add_executable(${EXAMPLE} ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE}.cpp)
|
||||
set_target_properties(${EXAMPLE} PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(${EXAMPLE} PUBLIC ${compiler_options})
|
||||
target_compile_definitions(${EXAMPLE} PUBLIC ${compiler_definitions})
|
||||
target_link_options(${EXAMPLE} PUBLIC ${linker_flags})
|
||||
|
||||
@@ -18,7 +18,7 @@ add_library(
|
||||
generate_export_header(${PROJECT_NAME})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC ${compiler_options})
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${compiler_definitions})
|
||||
target_link_options(${PROJECT_NAME} PUBLIC ${linker_flags})
|
||||
@@ -41,7 +41,7 @@ add_library(${PROJECT_NAME}las ${LIBRARY_TYPE}
|
||||
|
||||
set_target_properties(${PROJECT_NAME}las PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(${PROJECT_NAME}las PUBLIC ${compiler_options})
|
||||
target_compile_definitions(${PROJECT_NAME}las PUBLIC ${compiler_definitions})
|
||||
target_link_options(${PROJECT_NAME}las PUBLIC ${linker_flags})
|
||||
|
||||
@@ -1998,7 +1998,6 @@ bool CompressedVectorNodeImpl::isTypeEquivalent(std::shared_ptr<NodeImpl> ni)
|
||||
bool CompressedVectorNodeImpl::isDefined(const ustring& pathName)
|
||||
{
|
||||
throw E57_EXCEPTION2(E57_ERROR_NOT_IMPLEMENTED, "this->pathName=" + this->pathName() + " pathName=" + pathName);
|
||||
return (false);
|
||||
}
|
||||
|
||||
void CompressedVectorNodeImpl::setAttachedRecursive()
|
||||
|
||||
@@ -10,7 +10,7 @@ add_library(time_conversion ${LIBRARY_TYPE}
|
||||
|
||||
set_target_properties(time_conversion PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(time_conversion PUBLIC ${compiler_options})
|
||||
target_compile_definitions(time_conversion PUBLIC ${compiler_definitions})
|
||||
target_link_options(time_conversion PUBLIC ${linker_flags})
|
||||
@@ -44,7 +44,7 @@ foreach(TOOL ${TOOLS})
|
||||
|
||||
set_target_properties(${TOOL} PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(${TOOL} PUBLIC ${compiler_options})
|
||||
target_compile_definitions(${TOOL} PUBLIC ${compiler_definitions})
|
||||
target_link_options(${TOOL} PUBLIC ${linker_flags})
|
||||
@@ -72,7 +72,7 @@ add_executable(las2e57 ${CMAKE_CURRENT_SOURCE_DIR}/las2e57.cpp)
|
||||
|
||||
set_target_properties(las2e57 PROPERTIES
|
||||
DEBUG_POSTFIX "-d"
|
||||
MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_TYPE}")
|
||||
MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
target_compile_options(las2e57 PUBLIC ${compiler_options})
|
||||
target_compile_definitions(las2e57 PUBLIC ${compiler_definitions})
|
||||
target_link_options(las2e57 PUBLIC ${linker_flags})
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
|
||||
project(openE57_example CXX)
|
||||
project(opene57_example CXX)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(openE57 REQUIRED)
|
||||
find_package(opene57 REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
example.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${openE57_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${openE57_LIBRARIES})
|
||||
|
||||
set_target_properties( ${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
add_executable(${PROJECT_NAME} example.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE opene57::opene57)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${opene57_INCLUDE_DIRS})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import shutil,os
|
||||
from conan.tools.microsoft import msvc_runtime_flag
|
||||
from conans import ConanFile, CMake, tools
|
||||
|
||||
class TestOpenE57Conan(ConanFile):
|
||||
class TestOpene57Conan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "cmake", "cmake_find_package"
|
||||
|
||||
@@ -13,9 +14,5 @@ class TestOpenE57Conan(ConanFile):
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self):
|
||||
bin_path=""
|
||||
if self.settings.compiler == "Visual Studio":
|
||||
bin_path = os.path.join("bin", "{}".format(self.settings.build_type), "openE57_example")
|
||||
else:
|
||||
bin_path = os.path.join("bin", "openE57_example")
|
||||
bin_path = os.path.join("bin", "opene57_example")
|
||||
self.run(bin_path, run_environment=True)
|
||||
|
||||
Reference in New Issue
Block a user