CMakeLists.txt μμ νκΈ°
How to construct CMakeLists.txt to use ceres sovler
CMakeLists.txt νμΌ κ΅¬μ±νκΈ°
Ceres solverλ₯Ό μ€μΉνκ³ μλμ κ°μ΄ λΉλ μ½λ© ν λΉλν΄λ³΄μ
1. Code Skeleton
#include <ceres/ceres.h>
#include <glog/logging.h>
using ceres::Problem;
int main(int argc, char** argv)
{
// The variable to solve for with its initial value. It will be
// mutated in place by the solver.
double x = 0.5;
const double initial_x = x;
// Build the problem.
Problem problem;
return 0;
}
λ¬Έμ κ° μμ΄ λΉλ λμλ€λ©΄ μ΄ κ²μλ¬Όμ 건λλ°μ!
λλ λΉλμ‘°μ°¨ λμ§ μμμ κ½€λ κ³ μμ νλ€
2. CMakeLists.txt
# cmake μ΅μ λ²μ μ μ μ΄μ€λ€
cmake_minimum_required(VERSION 2.8.3)
# project μ΄λ¦μ μ μ΄μ€λ€ [λμ΄μ°κΈ° κΈμ§]
project(my_proj)
# C++ 11λ‘ μ»΄νμΌνκ² λ€λ λ»μ΄λ€!
# ceresλ₯Ό λΉλνλ κ³Όμ μμ μλ¬κ° λμ ν΄κ²°νλ λ°©λ²μ΄λ€
set(CMAKE_CXX_STANDARD 11)
# μλ λͺ
λ Ήμ μμλλ‘ μ
λ ₯ν΄μ€λ€
find_package(Ceres REQUIRED)
include_directories(${CERES_INCLUDE_DIRS})
add_executable(main src/main.cpp)
target_link_libraries(main ${CERES_LIBRARIES})
μμ κ°μ΄ μ μΈνλ©΄ λ¬Έμ μμ΄ λΉλλ κ²μ΄λ€ !
Leave a comment