Comments (10)
I managed to compile the lib and examples in VS 2017. I did the following:
- Just configuring Eigen with CMake appears to make it discoverable by other projects via
find_package
. - Same for Pangolin. It downloaded its dependencies (git required) and built without issues as a static lib (default config).
- The following CMakeLists.txt for cilantro seems to more or less work. I basically disabled
install
commands like @adishavit suggested and forced static CRT or it would not link.
cmake_minimum_required(VERSION 2.8)
project(cilantro)
# Build setup
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "/O2")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/O2")
list(APPEND FLAG_VARS
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
)
foreach(FLAG_VAR ${FLAG_VARS})
string(REGEX REPLACE "/MD" "/MT" NEW_FLAGS "${${FLAG_VAR}}")
set(${FLAG_VAR} "${NEW_FLAGS}" CACHE STRING "" FORCE)
endforeach()
# Packages
find_package(Eigen3 REQUIRED)
find_package(Pangolin REQUIRED)
# find_package(OpenMP)
# if (OPENMP_FOUND)
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# endif()
set(OTHER_INCLUDES ${EIGEN3_INCLUDE_DIRS} ${Pangolin_INCLUDE_DIRS})
include_directories(include)
include_directories(${OTHER_INCLUDES})
# Build library
file(GLOB_RECURSE 3rd_src ${CMAKE_SOURCE_DIR}/src/3rd_party/*.c ${CMAKE_SOURCE_DIR}/src/3rd_party/*.cpp)
file(GLOB lib_src ${CMAKE_SOURCE_DIR}/src/*.cpp)
add_library(${PROJECT_NAME} STATIC ${3rd_src} ${lib_src})
target_link_libraries(${PROJECT_NAME} ${Pangolin_LIBRARIES})
# Build examples
option(BUILD_EXAMPLES "Build small example apps" ON)
if(BUILD_EXAMPLES)
file(GLOB example_files RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/examples/*.cpp)
foreach(example_file ${example_files})
get_filename_component(example_name ${example_file} NAME_WE)
add_executable(${example_name} ${example_file})
target_link_libraries(${example_name} ${PROJECT_NAME} ${Pangolin_LIBRARIES})
endforeach(example_file ${example_files})
endif()
# Package config files
file(REMOVE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
export(TARGETS ${PROJECT_NAME} APPEND FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
set(CMAKECONFIG_INSTALL_DIR lib/cmake/${PROJECT_NAME})
file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}/include")
# Build tree config
set(EXPORT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY IMMEDIATE)
# Install tree config
set(EXPORT_INCLUDE_DIR "\${PROJECT_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake @ONLY)
# Add package to CMake package registry for use from the build tree
option(EXPORT_${PROJECT_NAME} "Export ${PROJECT_NAME} package for use by other software" ON)
if(EXPORT_${PROJECT_NAME})
export(PACKAGE ${PROJECT_NAME})
endif()
# Install target
# install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
# install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# install(FILES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" DESTINATION ${CMAKECONFIG_INSTALL_DIR})
# install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKECONFIG_INSTALL_DIR})
# # Uninstall target
# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
# add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
Using the above, everything compiled and ran. I encountered 2 issues:
- OpenMP is not enabled and the source must be updated for it to work (change indices to signed type because VS still only supports OpenMP 2.0).
- Keyboard and mouse input when spawning multiple Visualizer windows is buggy.
I will reorganize the structure and properly revise CMakeLists at some point! :)
from cilantro.
It seems that <algorithm>
is included by <Eigen/Core>
(which is implicitly included pretty much everywhere), so you might be getting errors because of Eigen not having been found. Please let us know whether that is the case, so we can investigate.
Making the visualization stuff optional makes a lot of sense and I do plan to implement it! :)
from cilantro.
I added the missing M_PI
defines for now. I'll try to get a VS setup some time soon and see what I could do from there.
Thanks for the feedback!
from cilantro.
@adishavit , it's a CMake project, so, as long as you can build Eigen & Pangolin (which are also both cross-platform), I don't see why not.
from cilantro.
from cilantro.
I don't have a Visual Studio installation handy to test, but my guess is that it should. Feel free to share your results and/or any needed updates!
from cilantro.
Yeah - it isn't as smooth as I had hoped.
Some missing includes (e.g. <algorithm>
for std::min
) and the Eigen CMake dependency finders are not working well.
Also, it needs GLEW and all the rest of the Pangolin dependencies.
It would actually great if display dependencies were optional - so one can choose to only use the algorithms without visualization.
from cilantro.
@kzampog , I think adding the missing headers should be a one-commit fix.
@adishavit , perhaps you can make a new issue with the feature request for optional visualization compilation?
from cilantro.
I kinda of gave up after spending too long on this.
I may get back to it.
But the things I did need to do were:
- Remove the CMake
install
commands. They just fail.
-install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
-install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+# install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
+# install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-install(FILES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" DESTINATION ${CMAKECONFIG_INSTALL_DIR})
-install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKECONFIG_INSTALL_DIR})
+# install(FILES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" DESTINATION ${CMAKECONFIG_INSTALL_DIR})
+# install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKECONFIG_INSTALL_DIR})
- Add
M_PI
toinclude/cilantro/connected_component_segmentation.hpp
andsrc/iterative_closest_point.cpp
+#ifndef M_PI
+#define M_PI 3.14159265358979323846 // pi
+#endif
- Added
NOMINMAX
preprocessor to Windows builds.
from cilantro.
Hi,
Is there any update re the VS version?
Many thanks,
G
from cilantro.
Related Issues (20)
- how to use this library in my project? HOT 5
- A error in non_rigid_icp.cpp for Example 2: Compute a densely supported warp field HOT 1
- Can be used to create a surface from a point cloud? HOT 1
- Radius search using kdtree always returns sorted result. HOT 4
- complie smooth in ubuntu18.04,but not in win10 with VS2017 HOT 2
- transform rgbd image to point cloud
- have c# library? HOT 2
- TypeTraits.h HOT 1
- The old versions of ffmpeg libraries are not available on for Ubuntu20
- non-rigid registration speed
- Compilation issues in Win + VS HOT 3
- Questions about using this library HOT 6
- Releases
- ExternalProject and Linking, is Cilantro header-only library? HOT 8
- Add comparison to existing C++ libraries
- Interfacing to ROS
- Question about removal of the Center Of Mass in Symmetric Point-To-Plane ICP HOT 7
- Point Cloud Streams... OpenNI or something else? HOT 5
- Issues when trying to use cilantro in a different project HOT 3
- Minimal way to include cilantro in other project? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cilantro.