Change installation rules to match defaults of vcpkg #215
+6
-13
@@ -1,14 +1,7 @@
|
||||
.cache/
|
||||
.vs/
|
||||
.vscode/
|
||||
/[Bb]uild
|
||||
|
||||
# ignore dir
|
||||
#build/
|
||||
build/*.txt
|
||||
build/Makefile
|
||||
build/*.cmake
|
||||
build/CMakeFiles
|
||||
build/sdk_core
|
||||
build/sample
|
||||
|
||||
#whitelist
|
||||
!build/notes.txt
|
||||
|
||||
|
||||
compile_commands.json
|
||||
CMakeUserPresets.json
|
||||
|
||||
+18
-10
@@ -2,10 +2,12 @@ cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(livox_sdk)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
message(STATUS "main project dir: " ${PROJECT_SOURCE_DIR})
|
||||
|
||||
include(cmake/variables-and-options.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
set(THREADS_PTHREAD_ARG
|
||||
"PLEASE_FILL_OUT-FAILED_TO_RUN"
|
||||
@@ -16,12 +18,18 @@ if (UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||
endif(UNIX)
|
||||
|
||||
if(WIN32)
|
||||
add_compile_definitions("WIN32")
|
||||
endif(WIN32)
|
||||
|
||||
add_subdirectory(sdk_core sdk_core)
|
||||
add_subdirectory(sample/hub)
|
||||
add_subdirectory(sample/lidar)
|
||||
add_subdirectory(sample/hub_lvx_file)
|
||||
add_subdirectory(sample/lidar_lvx_file)
|
||||
add_subdirectory(sample_cc/hub)
|
||||
add_subdirectory(sample_cc/lidar)
|
||||
add_subdirectory(sample_cc/trouble_shooting)
|
||||
add_subdirectory(sample_cc/lidar_utc_sync)
|
||||
if(BUILD_SAMPLES)
|
||||
add_subdirectory(sample/hub)
|
||||
add_subdirectory(sample/lidar)
|
||||
add_subdirectory(sample/hub_lvx_file)
|
||||
add_subdirectory(sample/lidar_lvx_file)
|
||||
add_subdirectory(sample_cc/hub)
|
||||
add_subdirectory(sample_cc/lidar)
|
||||
add_subdirectory(sample_cc/trouble_shooting)
|
||||
add_subdirectory(sample_cc/lidar_utc_sync)
|
||||
endif()
|
||||
@@ -1,6 +0,0 @@
|
||||
// 2019/01/07
|
||||
The purpose of adding this file is to commit the build folder to git.
|
||||
|
||||
// Must build the project in this folder,for example:
|
||||
cmake .. // generate makefile,in the project root directory.
|
||||
make // build the project.
|
||||
@@ -0,0 +1 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/livox-sdkTargets.cmake")
|
||||
@@ -0,0 +1,35 @@
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# Name of the package to use when calling find_package(<package>) in consumer code. We use
|
||||
# kebap-case because vcpkg uses that for its port names.
|
||||
set(package livox-sdk)
|
||||
|
||||
set(livox_sdk_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${package}")
|
||||
set(livox_sdk_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${package}")
|
||||
# Set the install directory for the *config.cmake files to the path where vcpkg looks by default
|
||||
set(livox_sdk_INSTALL_CMAKEDIR "share/${package}")
|
||||
|
||||
# Install target types to the given destinations and create an export.
|
||||
install(TARGETS ${SDK_LIBRARY} EXPORT livox-sdkTargets
|
||||
ARCHIVE DESTINATION "${livox_sdk_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${livox_sdk_INSTALL_LIBDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${livox_sdk_INSTALL_INCLUDEDIR}")
|
||||
|
||||
# Copy the package config file to the install location and give it the correct name
|
||||
install(FILES ../cmake/install-config.cmake
|
||||
DESTINATION ${livox_sdk_INSTALL_CMAKEDIR}
|
||||
RENAME "${package}Config.cmake")
|
||||
|
||||
write_basic_package_version_file("../${package}ConfigVersion.cmake"
|
||||
VERSION ${LIVOX_SDK_VERSION_STRING}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
# Copy the package version file the the install location
|
||||
install(FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
|
||||
DESTINATION ${livox_sdk_INSTALL_CMAKEDIR})
|
||||
|
||||
# Generate and install a CMake file with code for installing targets from the given export
|
||||
install(EXPORT livox-sdkTargets
|
||||
NAMESPACE livox_sdk::
|
||||
DESTINATION ${livox_sdk_INSTALL_CMAKEDIR})
|
||||
@@ -0,0 +1,8 @@
|
||||
# This variable is set by project() in CMake 3.21+
|
||||
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}" PROJECT_IS_TOP_LEVEL)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
option(shared_DEVELOPER_MODE "Enable developer mode" OFF)
|
||||
endif()
|
||||
|
||||
option(BUILD_SAMPLES "Build the samples" OFF)
|
||||
@@ -7,3 +7,7 @@ target_link_libraries(${DEMO_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}_static
|
||||
)
|
||||
target_include_directories(${DEMO_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/sdk_core/include/third_party/cmdline"
|
||||
)
|
||||
|
||||
@@ -7,3 +7,7 @@ target_link_libraries(${DEMO_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}_static
|
||||
)
|
||||
target_include_directories(${DEMO_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/sdk_core/include/third_party/cmdline"
|
||||
)
|
||||
|
||||
@@ -7,3 +7,7 @@ target_link_libraries(${DEMO_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}_static
|
||||
)
|
||||
target_include_directories(${DEMO_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/sdk_core/include/third_party/cmdline"
|
||||
)
|
||||
|
||||
@@ -7,3 +7,7 @@ target_link_libraries(${DEMO_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}_static
|
||||
)
|
||||
target_include_directories(${DEMO_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/sdk_core/include/third_party/cmdline"
|
||||
)
|
||||
|
||||
@@ -11,3 +11,7 @@ target_link_libraries(${DEMO_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}_static
|
||||
)
|
||||
target_include_directories(${DEMO_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/sdk_core/include/third_party/cmdline"
|
||||
)
|
||||
+13
-10
@@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(SDK_LIBRARY ${PROJECT_NAME}_static)
|
||||
add_library(${SDK_LIBRARY} STATIC "")
|
||||
add_library(livox_sdk::livox_sdk ALIAS ${SDK_LIBRARY})
|
||||
|
||||
set_target_properties(${SDK_LIBRARY} PROPERTIES
|
||||
EXPORT_NAME livox_sdk
|
||||
OUTPUT_NAME livox_sdk)
|
||||
|
||||
set(LIVOX_SDK_MAJOR_VERSION "2")
|
||||
set(LIVOX_SDK_MINOR_VERSION "3")
|
||||
@@ -11,11 +16,10 @@ set(LIVOX_SDK_VERSION_STRING "${LIVOX_SDK_MAJOR_VERSION}.${LIVOX_SDK_MINOR_VERSI
|
||||
|
||||
target_include_directories(${SDK_LIBRARY}
|
||||
PUBLIC
|
||||
include
|
||||
include/third_party/FastCRC
|
||||
include/third_party/spdlog
|
||||
include/third_party/cmdline
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/third_party/FastCRC>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/third_party/spdlog>"
|
||||
src)
|
||||
|
||||
set_target_properties(${SDK_LIBRARY} PROPERTIES PUBLIC_HEADER "include/livox_def.h;include/livox_sdk.h")
|
||||
@@ -26,10 +30,13 @@ else(WIN32)
|
||||
set(PLATFORM unix)
|
||||
endif (WIN32)
|
||||
|
||||
target_compile_options(${SDK_LIBRARY}
|
||||
# Warnings are only for developers
|
||||
if(shared_DEVELOPER_MODE)
|
||||
target_compile_options(${SDK_LIBRARY}
|
||||
PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wall -Werror -Wno-c++11-long-long>
|
||||
PRIVATE $<$<CXX_COMPILER_ID:AppleClang>:-Wno-unknown-pragmas -Wall -Werror -Wno-c++11-long-long>
|
||||
PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Wno-unknown-pragmas -Wall -Werror -Wno-c++11-long-long>)
|
||||
endif()
|
||||
|
||||
target_sources(${SDK_LIBRARY}
|
||||
PRIVATE
|
||||
@@ -84,8 +91,4 @@ target_sources(${SDK_LIBRARY}
|
||||
src/base/wake_up/wake_up_pipe.h
|
||||
src/base/wake_up/${PLATFORM}/wake_up_pipe.cpp)
|
||||
|
||||
|
||||
install(TARGETS ${SDK_LIBRARY}
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib)
|
||||
include(../cmake/install-rules.cmake)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef LIVOX_THREAD_BASE_H_
|
||||
#define LIVOX_THREAD_BASE_H_
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include "noncopyable.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user