Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
atakagi-fixstars committed Feb 6, 2024
1 parent c1990cb commit 60af749
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
cmake_minimum_required(VERSION 3.7)
cmake_minimum_required(VERSION 3.18)

project(CudaBundleAdjustment)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)

option(ENABLE_SAMPLES "Build samples" ON)
option(WITH_G2O "Build sample with g2o (g2o needs to be installed)" OFF)
option(USE_FLOAT32 "Use 32bit float in internal floating-point operations (default is 64bit float)" OFF)
option(ENABLE_SAMPLES "Build samples" ON)
option(WITH_G2O "Build sample with g2o (g2o needs to be installed)" OFF)
option(USE_FLOAT32 "Use 32bit float in internal floating-point operations (default is 64bit float)" OFF)
option(BUILD_SHARED_LIB "Build shared library" OFF)
set(CUDA_ARCHS "61;72;75;86" CACHE STRING "List of architectures to generate device code for")

add_subdirectory(src)
Expand Down
2 changes: 1 addition & 1 deletion samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang>:-Wall -O3>
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4819>
)

if (WITH_G2O)
if(WITH_G2O)
find_package(g2o REQUIRED)
set(G2O_LIBS ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY} ${G2O_SOLVER_EIGEN} ${G2O_TYPES_SBA} ${G2O_TYPES_SLAM3D})

Expand Down
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ project(${PROJECT_NAME} LANGUAGES CXX CUDA)
find_package(Eigen3 REQUIRED)
find_package(CUDAToolkit REQUIRED)

# library type
set(LIBRARY_TYPE STATIC)
if(BUILD_SHARED_LIB)
set(LIBRARY_TYPE SHARED)
endif()

# target configuration
file(GLOB SRCS ./*.cpp ./*.cu ./*.h* ${INTERNAL_INCLUDE_DIR}/*.h*)
add_library(${PROJECT_NAME})
add_library(${PROJECT_NAME} ${LIBRARY_TYPE})
target_sources(${PROJECT_NAME} PRIVATE ${SRCS})
target_include_directories(${PROJECT_NAME} PRIVATE ${INTERNAL_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ${CUDAToolkit_INCLUDE_DIRS})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
Expand Down

0 comments on commit 60af749

Please sign in to comment.