Skip to content

Commit

Permalink
Merge pull request #4 from ibois-epfl/features/cmake_rework_proposition
Browse files Browse the repository at this point in the history
Changing the cmake part to integrate differently in AC
  • Loading branch information
9and3 authored Aug 23, 2023
2 parents 5857389 + 7afffcc commit 3363540
Show file tree
Hide file tree
Showing 28 changed files with 939 additions and 719 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/docker-cmake-build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
name: docker-cmake-build
name: "Configure and build"

on:
push:
branches: [ "main", "optiv0" ]
branches: ["main", "optiv0"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:

build-container:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container
run: docker build -t ghcr.io/ibois-epfl/tslam:latest ${{ github.workspace }}
- name: Push
run: docker push ghcr.io/ibois-epfl/tslam:latest

- name: Build the Docker image
run: sudo docker build -t tslam .
configure-and-build:
needs: build-container
runs-on: ubuntu-latest
container:
image: ghcr.io/ibois-epfl/tslam:latest
steps:
- uses: actions/checkout@v3
- name: Configure
run: cmake -B build -DTSLAM_USE_OWN_EIGEN3:BOOL=OFF .
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: configure-artifacts
path: build/
retention-days: 1
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on_failure
83 changes: 43 additions & 40 deletions 3rdparty/aruco/aruco/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,61 @@
SET (LIBNAME ${EXTRALIBNAME}aruco)
include_directories(.)


SET(sources
set(sources
cameraparameters.cpp debug.cpp dictionary.cpp ippe.cpp markerdetector.cpp markerlabeler.cpp posetracker.cpp
cvdrawingutils.cpp dictionary_based.cpp marker.cpp markerdetector_impl.cpp markermap.cpp
)
SET(headers
)
set(headers
aruco_cvversioning.h cameraparameters.h dictionary_based.h ippe.h markerdetector_impl.h markermap.h timers.h
aruco_export.h cvdrawingutils.h dictionary.h levmarq.h marker.h picoflann.h
aruco.h debug.h markerdetector.h markerlabeler.h posetracker.h
)

if(BUILD_FRACTALS)
set(fractal_sources
fractaldetector.cpp
fractallabelers/fractalposetracker.cpp
fractallabelers/fractalmarkerset.cpp
fractallabelers/fractalmarker.cpp
fractallabelers/fractallabeler.cpp
)
IF(BUILD_FRACTALS)
set(fractal_sources
fractaldetector.cpp
fractallabelers/fractalposetracker.cpp
fractallabelers/fractalmarkerset.cpp
fractallabelers/fractalmarker.cpp
fractallabelers/fractallabeler.cpp
set(fractal_headers
fractaldetector.h
fractallabelers/fractalposetracker.h
fractallabelers/fractalmarkerset.h
fractallabelers/fractalmarker.h
fractallabelers/fractallabeler.h
)
set(fractal_headers
endif()

fractaldetector.h
fractallabelers/fractalposetracker.h
fractallabelers/fractalmarkerset.h
fractallabelers/fractalmarker.h
fractallabelers/fractallabeler.h
)
ENDIF()
add_library(tslam_aruco ${sources} ${headers} ${fractal_sources} ${fractal_headers})

add_library(${LIBNAME} ${sources} ${headers} ${fractal_sources} ${fractal_headers})

set_target_properties(${LIBNAME} PROPERTIES # create *nix style library versions + symbolic links
set_target_properties(tslam_aruco PROPERTIES # create *nix style library versions + symbolic links
DEFINE_SYMBOL ARUCO_DSO_EXPORTS
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
OUTPUT_NAME "${LIBNAME}${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
# OUTPUT_NAME "${LIBNAME}${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
)

target_link_libraries(${LIBNAME} PUBLIC opencv_core)
IF(BUILD_SVM)
add_definitions(USE_SVM_LABELER)
target_link_libraries(${LIBNAME} PRIVATE opencv_imgproc opencv_calib3d opencv_features2d opencv_ml)
else()
target_link_libraries(${LIBNAME} PRIVATE opencv_imgproc opencv_calib3d opencv_features2d )
if(TSLAM_USE_TIMERS)
target_compile_definitions(tslam_aruco PUBLIC USE_TIMERS)
endif()

INSTALL(TARGETS ${LIBNAME}
RUNTIME DESTINATION bin COMPONENT main # Install the dll file in bin directory
LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory
target_link_libraries(tslam_aruco PUBLIC opencv_core Eigen3::Eigen)
target_include_directories(tslam_aruco
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)

# if(BUILD_SVM)
# add_definitions(USE_SVM_LABELER)
# target_link_libraries(${LIBNAME} PRIVATE opencv_imgproc opencv_calib3d opencv_features2d opencv_ml)
# else()
# target_link_libraries(${LIBNAME} PRIVATE opencv_imgproc opencv_calib3d opencv_features2d )
# endif()

# INSTALL(TARGETS ${LIBNAME}
# RUNTIME DESTINATION bin COMPONENT main # Install the dll file in bin directory
# LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT main
# ARCHIVE DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory

IF(ARUCO_DEVINSTALL)
install(FILES ${headers} ${fractal_headers} DESTINATION include/aruco)
ENDIF()

# IF(ARUCO_DEVINSTALL)
# install(FILES ${headers} ${fractal_headers} DESTINATION include/aruco)
# ENDIF()
109 changes: 38 additions & 71 deletions 3rdparty/fbow/fbow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,75 +1,42 @@
ADD_DEFINITIONS(-DNOMINMAX)
set(srcs fbow.cpp vocabulary_creator.cpp )
set(hdrs fbow.h fbow_exports.h vocabulary_creator.h cpu.h)

SET( srcs fbow.cpp vocabulary_creator.cpp )
SET( hdrs fbow.h fbow_exports.h vocabulary_creator.h cpu.h)
add_library(tslam_fbow ${srcs} ${hdrs})

SET (THIS_LIBNAME ${EXTRALIBNAME}fbow)


ADD_LIBRARY(${THIS_LIBNAME} ${srcs} ${hdrs})

SET_TARGET_PROPERTIES(${THIS_LIBNAME} PROPERTIES # create *nix style library versions + symbolic links
DEFINE_SYMBOL FBOW_DSO_EXPORTS
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
OUTPUT_NAME "${THIS_LIBNAME}${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
set_target_properties(tslam_fbow PROPERTIES # create *nix style library versions + symbolic links
DEFINE_SYMBOL FBOW_DSO_EXPORTS
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
# OUTPUT_NAME "tslam_bfow{PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
)
TARGET_LINK_LIBRARIES(${THIS_LIBNAME} ${OpenCV_LIBS} ${OpenMP_CXX_LIBRARIES})

INSTALL(TARGETS ${THIS_LIBNAME}
RUNTIME DESTINATION bin COMPONENT main # Install the dll file in bin directory
LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory


IF(FBOW_DEVINSTALL)

INSTALL(FILES ${hdrs}
DESTINATION include/fbow
COMPONENT main)
ENDIF()


#set(sources
# fbow.cpp
# vocabulary_creator.cpp
#)

#set(headers
# fbow.h
# fbow_exports.h
# vocabulary_creator.h
#)

#add_library(fbow ${sources} ${headers})

#set_target_properties(fbow PROPERTIES # create *nix style library versions + symbolic links
# DEFINE_SYMBOL FBOW_DSO_EXPORTS
# VERSION ${PROJECT_VERSION}
# SOVERSION ${PROJECT_SOVERSION}
# CXX_VISIBILITY_PRESET hidden # Make all the symbols hidden, so we have to explicitly define an API
# CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
# OUTPUT_NAME "fbow${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
#)

#include(GenerateExportHeader)
#generate_export_header(fbow)

#target_link_libraries(fbow PUBLIC opencv_core)
#target_link_libraries(fbow PRIVATE opencv_features2d)

#target_include_directories(fbow PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
# $<INSTALL_INTERFACE:include>
#)

#install(TARGETS fbow EXPORT fbowConfig
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
# ARCHIVE DESTINATION lib
#)


#install(EXPORT arucoConfig DESTINATION "share/aruco/cmake")
if(TARGET OpenMP::OpenMP_CXX)
target_link_libraries(tslam_fbow PRIVATE OpenMP::OpenMP_CXX)
target_compile_definitions(tslam_fbow PRIVATE USE_OPENMP)
endif()

target_link_libraries(tslam_fbow PRIVATE ${OpenCV_LIBS})
target_include_directories(tslam_fbow
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(tslam_fbow PUBLIC -Wno-ignored-attributes)
endif()

list(APPEND TSLAM_EXPORT_LIST tslam_fbow)
# install(TARGETS tslam_bfow
# RUNTIME
# DESTINATION bin COMPONENT main # Install the dll file in bin directory
# LIBRARY
# DESTINATION lib
# PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
# COMPONENT main
# ARCHIVE
# DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory

# if(FBOW_DEVINSTALL)
# install(FILES ${hdrs}
# DESTINATION include/fbow
# COMPONENT main)
# endif()
13 changes: 4 additions & 9 deletions 3rdparty/g2o/g2o/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(GENERAL_BUILD_TYPE ${CMAKE_BUILD_TYPE})
IF(WIN32)
add_library(tslam_g2o_config INTERFACE)
target_include_directories(tslam_g2o_config INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)


add_definitions(-DWINDOWS)
ENDIF()


ADD_SUBDIRECTORY(stuff)
ADD_SUBDIRECTORY(core)
add_subdirectory(stuff)
add_subdirectory(core)
106 changes: 52 additions & 54 deletions 3rdparty/g2o/g2o/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,57 @@
SET(THIS_LIBNAME ${EXTRALIBNAME}g2o_core)
ADD_LIBRARY(${THIS_LIBNAME} ${G2O_LIB_TYPE}
dynamic_aligned_buffer.hpp
ownership.h
base_edge.h
base_binary_edge.h hyper_graph_action.cpp
base_binary_edge.hpp hyper_graph_action.h
base_multi_edge.h hyper_graph.cpp
base_multi_edge.hpp hyper_graph.h
base_unary_edge.h linear_solver.h
base_unary_edge.hpp marginal_covariance_cholesky.cpp
base_vertex.h marginal_covariance_cholesky.h
base_vertex.hpp matrix_structure.cpp
batch_stats.cpp matrix_structure.h
batch_stats.h openmp_mutex.h
block_solver.h block_solver.hpp
parameter.cpp parameter.h
cache.cpp cache.h
optimizable_graph.cpp optimizable_graph.h
solver.cpp solver.h
creators.h optimization_algorithm_factory.cpp
estimate_propagator.cpp optimization_algorithm_factory.h
estimate_propagator.h
factory.cpp optimization_algorithm_property.h
factory.h sparse_block_matrix.h
sparse_optimizer.cpp sparse_block_matrix.hpp
sparse_optimizer.h
hyper_dijkstra.cpp hyper_dijkstra.h
parameter_container.cpp parameter_container.h
optimization_algorithm.cpp optimization_algorithm.h
optimization_algorithm_with_hessian.cpp optimization_algorithm_with_hessian.h
optimization_algorithm_gauss_newton.cpp optimization_algorithm_gauss_newton.h
optimization_algorithm_levenberg.cpp optimization_algorithm_levenberg.h
optimization_algorithm_dogleg.cpp optimization_algorithm_dogleg.h
sparse_optimizer_terminate_action.cpp sparse_optimizer_terminate_action.h
jacobian_workspace.cpp jacobian_workspace.h
robust_kernel.cpp robust_kernel.h
robust_kernel_impl.cpp robust_kernel_impl.h
robust_kernel_factory.cpp robust_kernel_factory.h
g2o_core_api.h
add_library(tslam_g2o
dynamic_aligned_buffer.hpp
ownership.h
base_edge.h
base_binary_edge.h hyper_graph_action.cpp
base_binary_edge.hpp hyper_graph_action.h
base_multi_edge.h hyper_graph.cpp
base_multi_edge.hpp hyper_graph.h
base_unary_edge.h linear_solver.h
base_unary_edge.hpp marginal_covariance_cholesky.cpp
base_vertex.h marginal_covariance_cholesky.h
base_vertex.hpp matrix_structure.cpp
batch_stats.cpp matrix_structure.h
batch_stats.h openmp_mutex.h
block_solver.h block_solver.hpp
parameter.cpp parameter.h
cache.cpp cache.h
optimizable_graph.cpp optimizable_graph.h
solver.cpp solver.h
creators.h optimization_algorithm_factory.cpp
estimate_propagator.cpp optimization_algorithm_factory.h
estimate_propagator.h
factory.cpp optimization_algorithm_property.h
factory.h sparse_block_matrix.h
sparse_optimizer.cpp sparse_block_matrix.hpp
sparse_optimizer.h
hyper_dijkstra.cpp hyper_dijkstra.h
parameter_container.cpp parameter_container.h
optimization_algorithm.cpp optimization_algorithm.h
optimization_algorithm_with_hessian.cpp optimization_algorithm_with_hessian.h
optimization_algorithm_gauss_newton.cpp optimization_algorithm_gauss_newton.h
optimization_algorithm_levenberg.cpp optimization_algorithm_levenberg.h
optimization_algorithm_dogleg.cpp optimization_algorithm_dogleg.h
sparse_optimizer_terminate_action.cpp sparse_optimizer_terminate_action.h
jacobian_workspace.cpp jacobian_workspace.h
robust_kernel.cpp robust_kernel.h
robust_kernel_impl.cpp robust_kernel_impl.h
robust_kernel_factory.cpp robust_kernel_factory.h
g2o_core_api.h
)

add_definitions(-Dcore_EXPORTS)
target_compile_definitions(tslam_g2o PUBLIC core_EXPORTS)
target_include_directories(tslam_g2o PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

SET_TARGET_PROPERTIES(${THIS_LIBNAME} PROPERTIES # create *nix style library versions + symbolic links
DEFINE_SYMBOL core_EXPORTS
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
OUTPUT_NAME "${THIS_LIBNAME}${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
set_target_properties(tslam_g2o PROPERTIES # create *nix style library versions + symbolic links
DEFINE_SYMBOL core_EXPORTS
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
CLEAN_DIRECT_OUTPUT 1 # allow creating static and shared libs without conflicts
# OUTPUT_NAME "${THIS_LIBNAME}${PROJECT_DLLVERSION}" # avoid conflicts between library and binary target names
)
TARGET_LINK_LIBRARIES(${THIS_LIBNAME} ${EXTRALIBNAME}g2o_stuff)


INSTALL(TARGETS ${EXTRALIBNAME}g2o_core
RUNTIME DESTINATION bin COMPONENT main # Install the dll file in bin directory
LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory
target_link_libraries(tslam_g2o PRIVATE tslam_g2o_stuff INTERFACE tslam_g2o_config)

# INSTALL(TARGETS ${EXTRALIBNAME}g2o_core
# RUNTIME DESTINATION bin COMPONENT main # Install the dll file in bin directory
# LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT main
# ARCHIVE DESTINATION lib COMPONENT main) # Install the dll.a file in lib directory
Loading

0 comments on commit 3363540

Please sign in to comment.