kzampog / cilantro

A lean C++ library for working with point cloud data
MIT License
1.01k stars 206 forks source link

Compilation issues in Win + VS #62

Open MotivaCG opened 2 years ago

MotivaCG commented 2 years ago

Lots of issues with OpenMP like

Error C3031 'Atb': variable in 'reduction' clause must have scalar arithmetic type fusion D:\cilantro_src\include\cilantro\registration\transform_estimation.hpp 266

or

Severity Code Description Project File Line Suppression State Error C3001 'declare': expected an OpenMP directive name flat_convex_hull D:\cilantro_src\include\cilantro\core\covariance.hpp 52

or

Severity Code Description Project File Line Suppression State Error C3016 'i': index variable in OpenMP 'for' statement must have signed integral type fusion D:\cilantro_src\include\cilantro\core\space_transformations.hpp 186

or

Severity Code Description Project File Line Suppression State Error C3036 'max': invalid operator token in OpenMP 'reduction' clause non_rigid_icp D:\cilantro_src\include\cilantro\registration\icp_warp_field_combined_metric_sparse.hpp 171

yoavmil commented 2 years ago

Yep, same errors for me. I think it has to do with MSVC not supporting latest OpenMP.

josefgraus commented 1 year ago

Any workaround for this? I just ran into this using Visual Studio 17 2022 version 193.

josefgraus commented 1 year ago

Actually, I pretty quickly figured out a way to at least compile it.

Turn off ENABLE_NON_DETERMINISTIC_PARALLELISM. CMakeLists.txt snippet:

set(ENABLE_NON_DETERMINISTIC_PARALLELISM OFF)
add_subdirectory(cilantro)

Add an MSVC flag to use openmp:llvm. More CMakeLists.txt lines:

if(MSVC)
  set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/openmp:llvm")
endif()

Good luck!