mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
90799e29e1
- 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
28 lines
771 B
Plaintext
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;
|
|
}
|