fix omp_thread_num

This commit is contained in:
k.koide 2024-03-28 20:40:08 +09:00
parent 61cc0e6051
commit 98f6226fb7
3 changed files with 21 additions and 16 deletions

View File

@ -15,6 +15,7 @@ find_package(OpenMP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
option(BUILD_HELPER "Build helper library" ON)
option(BUILD_TESTS "Build test" OFF)
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
option(BUILD_WITH_TBB "Build with TBB" ON)
@ -29,11 +30,18 @@ if(BUILD_WITH_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "-march=native ${CMAKE_CXX_FLAGS}")
endif()
#############
## Install ##
#############
install(DIRECTORY include/ DESTINATION include)
###########
## Build ##
###########
# Helper library
if(BUILD_HELPER)
add_library(small_gicp SHARED
src/small_gicp/registration/registration.cpp
src/small_gicp/registration/registration_helper.cpp
@ -42,8 +50,8 @@ target_include_directories(small_gicp PUBLIC
include
${EIGEN3_INCLUDE_DIR}
)
install(DIRECTORY include/ DESTINATION include)
install(TARGETS small_gicp DESTINATION lib)
endif()
###############
## Benchmark ##
@ -121,6 +129,7 @@ endif()
## Test ##
##########
if(BUILD_TESTS)
find_package(fmt REQUIRED)
find_package(PCL REQUIRED)
find_package(TBB REQUIRED)
@ -140,7 +149,6 @@ if(BUILD_TESTS)
${PCL_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${Iridescence_INCLUDE_DIRS}
)
target_link_libraries(${TEST_NAME}
small_gicp
@ -148,7 +156,6 @@ if(BUILD_TESTS)
GTest::gtest_main
${PCL_LIBRARIES}
${TBB_LIBRARIES}
${Iridescence_LIBRARIES}
)
gtest_discover_tests(${TEST_NAME} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

View File

@ -4,7 +4,7 @@
namespace small_gicp {
#ifdef _OPENMP
#ifndef _OPENMP
inline int omp_get_thread_num() {
return 0;
}

View File

@ -17,8 +17,6 @@
#include <small_gicp/benchmark/read_points.hpp>
#include <small_gicp/registration/registration_helper.hpp>
#include <guik/viewer/light_viewer.hpp>
using namespace small_gicp;
class RegistrationTest : public testing::Test, public testing::WithParamInterface<std::tuple<const char*, const char*>> {
@ -185,7 +183,7 @@ INSTANTIATE_TEST_SUITE_P(
return sst.str();
});
TEST_P(RegistrationTest, EmptyTest) {
TEST_P(RegistrationTest, RegistrationTest) {
const std::string factor = std::get<0>(GetParam());
const std::string reduction = std::get<1>(GetParam());