Files
ceres-solver/cmake/generate_code_for_functor.cc.in
T
Darius Rueckert 90799e29e1 Fix install and unnecessary string copy
- Fix the following issue when running "make install"
  https://github.com/ceres-solver/ceres-solver/issues/527

- Fix error that CeresCodeGeneration.cmake was not found
  after instalation. Issue:
  https://github.com/ceres-solver/ceres-solver/issues/561

- Removes the unnecessary string copy during code generation

Change-Id: I01963d01da6a9c4557aad6f89831647c1a149e38
2020-02-14 13:11:15 +01:00

28 lines
771 B
Plaintext

// This file is generated by Ceres autodiff code generation."
// http://ceres-solver.org/
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "ceres/codegen/generate_code_for_functor.h"
#include "@COST_FUNCTOR_INPUT_FILE@"
int main() {
const std::vector<std::string> lines =
ceres::GenerateCodeForFunctor<@FULL_CXX_FUNCTOR_TYPE_NAME@>(
ceres::AutoDiffCodeGenOptions());
const std::string output_file = "@GENERATED_EVALUATION_IMPL_FILE@";
std::ofstream stream(output_file);
if (!stream.is_open()) {
std::cerr << "Could not open file " << output_file << std::endl;
return EXIT_FAILURE;
}
for (const auto& line : lines) {
stream << line << std::endl;
}
return EXIT_SUCCESS;
}