Commit 5aac87e3 authored by xuebingbing's avatar xuebingbing

1 增加cmake安装相关控制

parent 4ed9d944
add_subdirectory(convertor)
add_subdirectory(convert)
\ No newline at end of file
add_subdirectory(jfhdconvertor)
add_subdirectory(jfhdconvert)
\ No newline at end of file
string(TIMESTAMP TIME %Y%m%d%H)
project(jfhdconvert VERSION 0.0.1.${TIME})
add_definitions(-DCONVERT_EXPORT)
find_package(PDAL REQUIRED)
find_package(PCL REQUIRED COMPONENTS common io)
file(GLOB_RECURSE INC_FILES *.h *.hpp)
file(GLOB_RECURSE SRC_FILES *.cpp)
add_library(${PROJECT_NAME} SHARED ${INC_FILES} ${SRC_FILES})
target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${PCL_INCLUDE_DIRS}>
PRIVATE $<INSTALL_INTERFACE:${PCL_INCLUDE_DIRS}>
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${PCL_LIBRARIES}
PRIVATE pdalcpp pdal_util pdal_arbiter pdal_kazhdan
)
#安装相关的命令
string(TIMESTAMP TIME %Y%m%d%H)
project(jfhdconvert VERSION 0.0.1.${TIME})
string (TOLOWER "${PROJECT_NAME}" PROJECT_LOWNAME)
add_definitions(-DCONVERT_EXPORT)
find_package(PDAL REQUIRED)
find_package(PCL REQUIRED COMPONENTS common io)
file(GLOB_RECURSE INC_FILES *.h *.hpp)
file(GLOB_RECURSE SRC_FILES *.cpp)
set(EXPORT_INC_FILES convertor.h export.h)
add_library(${PROJECT_NAME} SHARED ${INC_FILES} ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES
PUBLIC_HEADER "${EXPORT_INC_FILES}"
)
set_property(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX d)
target_include_directories(${PROJECT_NAME}
PRIVATE ${PCL_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${PCL_LIBRARIES}
PRIVATE pdalcpp pdal_util pdal_arbiter pdal_kazhdan
)
########安装相关的命令
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(PROJECT_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWNAME}-config.cmake)
set(VERSION_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWNAME}-config-version.cmake)
set(TARGETS_EXPORT_NAME ${PROJECT_LOWNAME}-targets)
# 生成 version,config target 文件到 build tree
write_basic_package_version_file(${VERSION_CONFIG}
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
configure_package_config_file(xxx-config.cmake.in
${PROJECT_CONFIG}
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_LOWNAME})
# install version, config and target files
install(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOWNAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOWNAME}
)
install(FILES ${PROJECT_CONFIG} ${VERSION_CONFIG}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_LOWNAME})
install(EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_LOWNAME})
#include "convertor.h"
#ifdef WIN32
#include <corecrt_io.h>
#endif // WIN32
// pcl
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
......
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake)
check_required_components(jfhdconvert)
......@@ -2,6 +2,8 @@
string(TIMESTAMP TIME %Y%m%d%H)
project(jfhdconvertor VERSION 0.0.1.${TIME})
string (TOLOWER "${PROJECT_NAME}" LOW_PROJECT_NAME)
find_package(cxxopts REQUIRED)
......@@ -11,7 +13,10 @@ find_package(PCL REQUIRED COMPONENTS common io)
file(GLOB_RECURSE INC_FILES *.h *.hpp)
file(GLOB_RECURSE SRC_FILES *.cpp)
add_executable(${PROJECT_NAME} ${INC_FILES} ${SRC_FILES})
set(EXPORT_INC_FILES export.h convertor.h)
add_executable(${PROJECT_NAME} ${INC_FILES} ${SRC_FILES})
set_property(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX d)
target_link_libraries(${PROJECT_NAME}
PRIVATE jfhdconvert
......@@ -20,4 +25,8 @@ target_link_libraries(${PROJECT_NAME}
)
# install cmd
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/${PROJECT_NAME}
)
......@@ -2,14 +2,14 @@
#include <fstream>
#include <algorithm>
#include <pdal/PointTable.hpp>
#include <pdal/PointView.hpp>
#include <pdal/Options.hpp>
#include <pdal/io/BufferReader.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/Dimension.hpp>
#include "../convert/convertor.h"
//#include <pdal/PointTable.hpp>
//#include <pdal/PointView.hpp>
//#include <pdal/Options.hpp>
//#include <pdal/io/BufferReader.hpp>
//#include <pdal/StageFactory.hpp>
//#include <pdal/Dimension.hpp>
//
#include "../jfhdconvert/convertor.h"
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment