diff --git a/cmake/example_project/CMakeLists.txt b/cmake/example_project/CMakeLists.txt deleted file mode 100644 index 620ad4811..000000000 --- a/cmake/example_project/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# This file should be used as a template for creating new projects using the CMake tools -# This project has the following features -# - GTSAM linking -# - Unit tests via CppUnitLite -# - Scripts -# - Automatic MATLAB wrapper generation - -################################################################################### -# To create your own project, replace "example" with the actual name of your project -cmake_minimum_required(VERSION 3.0) -project(example CXX C) - -# Include GTSAM CMake tools -find_package(GTSAMCMakeTools) -include(GtsamBuildTypes) # Load build type flags and default to Debug mode -include(GtsamTesting) # Easy functions for creating unit tests and scripts -include(GtsamMatlabWrap) # Automatic MATLAB wrapper generation - -# Ensure that local folder is searched before library folders -include_directories(BEFORE "${PROJECT_SOURCE_DIR}") - -################################################################################### -# Find GTSAM components -find_package(GTSAM REQUIRED) # Uses installed package -# Note: Since Jan-2019, GTSAMConfig.cmake defines exported CMake targets -# that automatically do include the include_directories() without the need -# to call include_directories(), just target_link_libraries(NAME gtsam) -#include_directories(${GTSAM_INCLUDE_DIR}) - -################################################################################### -# Build static library from common sources -set(CONVENIENCE_LIB_NAME ${PROJECT_NAME}) -add_library(${CONVENIENCE_LIB_NAME} SHARED example/PrintExamples.h example/PrintExamples.cpp) -target_link_libraries(${CONVENIENCE_LIB_NAME} gtsam) - -# Install library -install(TARGETS ${CONVENIENCE_LIB_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) - -################################################################################### -# Build tests (CMake tracks the dependecy to link with GTSAM through our project's static library) -gtsamAddTestsGlob("example" "tests/test*.cpp" "" "${CONVENIENCE_LIB_NAME}") - -################################################################################### -# Build scripts (CMake tracks the dependecy to link with GTSAM through our project's static library) -gtsamAddExamplesGlob("*.cpp" "" "${CONVENIENCE_LIB_NAME}") - -################################################################################### -# Build MATLAB wrapper (CMake tracks the dependecy to link with GTSAM through our project's static library) -wrap_and_install_library("example.h" "${CONVENIENCE_LIB_NAME}" "" "") diff --git a/cmake/example_project/README.md b/cmake/example_project/README.md deleted file mode 100644 index a1269cf19..000000000 --- a/cmake/example_project/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# MATLAB Wrapper Example Project - -This project serves as a lightweight example for demonstrating how to wrap C++ code in MATLAB using GTSAM. - -## Compiling - -We follow the regular build procedure inside the `example_project` directory: - -```sh -mkdir build && cd build -cmake .. -make -j8 -sudo make install - -sudo ldconfig # ensures the shared object file generated is correctly loaded -``` - -## Usage - -Now you can open MATLAB and add the `gtsam_toolbox` to the MATLAB path - -```matlab -addpath('/usr/local/gtsam_toolbox') -``` - -At this point you are ready to run the example project. Starting from the `example_project` directory inside MATLAB, simply run code like regular MATLAB, e.g. - -```matlab -pe = example.PrintExamples(); -pe.sayHello(); -pe.sayGoodbye(); -``` \ No newline at end of file diff --git a/cmake/example_project/SayGoodbye.cpp b/cmake/example_project/SayGoodbye.cpp deleted file mode 100644 index be1165ef6..000000000 --- a/cmake/example_project/SayGoodbye.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file SayGoodbye.cpp - * @brief Example script for example project - * @author Richard Roberts - */ - -#include - -int main(int argc, char *argv[]) { - example::PrintExamples().sayGoodbye(); - return 0; -} diff --git a/cmake/example_project/SayHello.cpp b/cmake/example_project/SayHello.cpp deleted file mode 100644 index 2da06ab32..000000000 --- a/cmake/example_project/SayHello.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file SayHello.cpp - * @brief Example script for example project - * @author Richard Roberts - */ - -#include - -int main(int argc, char *argv[]) { - example::PrintExamples().sayHello(); - return 0; -} diff --git a/cmake/example_project/example.h b/cmake/example_project/example.h deleted file mode 100644 index b0d732e14..000000000 --- a/cmake/example_project/example.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file example.h - * @brief Example wrapper interface file - * @author Richard Roberts - */ - -// This is an interface file for automatic MATLAB wrapper generation. See -// gtsam.h for full documentation and more examples. - -#include - -namespace example { - -class PrintExamples { - PrintExamples(); - void sayHello() const; - void sayGoodbye() const; -}; - -} diff --git a/cmake/example_project/example/PrintExamples.cpp b/cmake/example_project/example/PrintExamples.cpp deleted file mode 100644 index 1e9f10713..000000000 --- a/cmake/example_project/example/PrintExamples.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file print_examples.cpp - * @brief Example library file - * @author Richard Roberts - */ - -#include - -#include - -namespace example { - -void PrintExamples::sayHello() const { - std::cout << internal::getHelloString() << std::endl; -} - -void PrintExamples::sayGoodbye() const { - std::cout << internal::getGoodbyeString() << std::endl; -} - -namespace internal { - -std::string getHelloString() { - return "Hello!"; -} - -std::string getGoodbyeString() { - return "See you soon!"; -} - -} // namespace internal - -} // namespace example diff --git a/cmake/example_project/example/PrintExamples.h b/cmake/example_project/example/PrintExamples.h deleted file mode 100644 index 25d4dd8cb..000000000 --- a/cmake/example_project/example/PrintExamples.h +++ /dev/null @@ -1,42 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file print_examples.h - * @brief Example library file - * @author Richard Roberts - */ - -#pragma once - -#include -#include - -namespace example { - -class PrintExamples { -public: - /// Print a greeting - void sayHello() const; - - /// Print a farewell - void sayGoodbye() const; -}; - -namespace internal { - -std::string getHelloString(); - -std::string getGoodbyeString(); - -} // namespace internal - -} // namespace example diff --git a/cmake/example_project/tests/testExample.cpp b/cmake/example_project/tests/testExample.cpp deleted file mode 100644 index c2a5a173b..000000000 --- a/cmake/example_project/tests/testExample.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file testExample.cpp - * @brief Unit tests for example - * @author Richard Roberts - */ - -#include - -#include - -#include - -using namespace gtsam; - -TEST(Example, HelloString) { - const std::string expectedString = "Hello!"; - EXPECT(assert_equal(expectedString, example::internal::getHelloString())); -} - -TEST(Example, GoodbyeString) { - const std::string expectedString = "See you soon!"; - EXPECT(assert_equal(expectedString, example::internal::getGoodbyeString())); -} - -/* ************************************************************************* */ -int main() { - TestResult tr; - return TestRegistry::runAllTests(tr); -} -/* ************************************************************************* */ - -