Skip to content

Commit

Permalink
start on cmake for gtsam
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Turner <[email protected]>
  • Loading branch information
spacey-sooty committed Dec 30, 2024
1 parent 266e4c2 commit c20e3e5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ if(WITH_DOCS)
endif()

if(WITH_WPICAL)
find_package(Ceres CONFIG REQUIRED)
# find_package(Ceres CONFIG REQUIRED)
find_package (SuiteSparse 5.12 NO_MODULE)
endif()

find_package(LIBSSH CONFIG 0.7.1)
Expand Down
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ allprojects {
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
}
maven {
url = "https://maven.photonvision.org/snapshots"
}
}
if (project.hasProperty('releaseMode')) {
wpilibRepositories.addAllReleaseRepositories(it)
Expand Down
34 changes: 31 additions & 3 deletions wpical/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ include(CompileWarnings)
include(GenResources)
include(LinkMacOSGUI)
include(AddTest)
include(FetchContent)

find_package (SuiteSparse 5.12 NO_MODULE)

configure_file(src/main/generate/WPILibVersion.cpp.in WPILibVersion.cpp)
generate_resources(src/main/native/resources generated/main/cpp WPIcal wpical wpical_resources_src)
Expand All @@ -25,6 +28,26 @@ elseif(APPLE)
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()

set(GTSAM_COMPILE_OPTIONS_PRIVATE_DEBUG CACHE INTERNAL FORCE)
set(GTSAM_COMPILE_OPTIONS_PRIVATE_RELWITHDEBINFO CACHE INTERNAL FORCE)
set(GTSAM_ENABLE_BOOST_SERIALIZATION OFF)
set(GTSAM_WITH_TBB OFF)
set(GTSAM_USE_BOOST_FEATURES OFF)
set(GTSAM_BUILD_PYTHON OFF)
set(GTSAM_BUILD_EXAMPLES_ALWAYS OFF)
set(GTSAM_BUILD_TESTS OFF)
set(BUILD_SHARED_LIBS OFF)
set(GTSAM_FORCE_SHARED_LIB OFF)
set(GTSAM_FORCE_STATIC_LIB ON)

include(FetchContent)
fetchcontent_declare(
gtsam
GIT_REPOSITORY https://github.com/mcm001/gtsam
GIT_TAG c24ca7951f1db4cfe4e23f368b2eda503de72176
)
fetchcontent_makeavailable(gtsam)

add_executable(
wpical
${wpical_src}
Expand All @@ -38,7 +61,9 @@ wpilib_target_warnings(wpical)
target_include_directories(
wpical
PRIVATE
/usr/local/include/
src/main/native/include
src/main/native/thirdparty/mrcal/generated
src/main/native/thirdparty/libdogleg/include
src/main/native/thirdparty/mrcal/include
src/main/native/thirdparty/mrcal_java/include
Expand Down Expand Up @@ -82,15 +107,16 @@ endif()
target_compile_options(wpical PRIVATE ${compile_flags})

find_package(OpenCV REQUIRED)
find_package(Ceres CONFIG REQUIRED)
target_link_libraries(
wpical
gtsam
apriltag
${OpenCV_LIBS}
wpigui
wpiutil
wpimath
Ceres::ceres
SuiteSparse::CHOLMOD
# Ceres::ceres
)

if(WIN32)
Expand Down Expand Up @@ -120,11 +146,13 @@ if(WITH_TESTS)
)
target_link_libraries(
wpical_test
gtsam
googletest
apriltag
${OpenCV_LIBS}
wpigui
wpiutil
Ceres::ceres
SuiteSparse::CHOLMOD
# Ceres::ceres
)
endif()

0 comments on commit c20e3e5

Please sign in to comment.