1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Doesn't find the Boost library header

Discussão em 'Mobile' iniciado por Stack, Outubro 17, 2024 às 10:22.

  1. Stack

    Stack Membro Participativo

    I'm writing a flutter application for android, my project uses the FFI library in C/C++, which pulls the Boost library, I managed to find the Boost library in the system in Cmake, but during the build process, I get errors that boost headers are not found.

    Boost is exactly installed in the system, and the system sees other files with headers, but Boost does not.

    In file included from /home/hatemsla/flutterapplication/plugins/rtk_path_planning/src/lib2/src/coverage_tsp_wrapper.cpp:3:
    /home/hatemsla/flutterapplication/plugins/rtk_path_planning/src/lib2/include/libpathplanning/single_agent/coverage_tsp.hpp:4:10: fatal error: 'boost/geometry.hpp' file not found
    #include <boost/geometry.hpp>
    ^~~~~~~~~~~~~~~~~~~~
    1 error generated.


    Here are my CMakeLists for the plugin

    # The Flutter tooling requires that developers have CMake 3.10 or later
    # installed. You should not increase this version, as doing so will cause
    # the plugin to fail to compile for some customers of the plugin.
    cmake_minimum_required(VERSION 3.14)

    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)

    project(rtk_path_planning_library VERSION 0.0.1 LANGUAGES C CXX)

    add_library(rtk_path_planning SHARED
    "rtk_path_planning.c"
    "lib2/src/single_agent/coverage_tsp.cpp"
    "lib2/src/single_agent/rrt_star_2d.cpp"
    "lib2/src/single_agent/rrt_star_3d.cpp"
    "lib2/src/transformations/geodetic.cpp"
    "lib2/src/coverage_tsp_wrapper.cpp"
    "lib2/src/geodetic_wrapper.cpp"
    "lib2/src/rrt_star_2d_wrapper.cpp"
    "lib2/src/rrt_star_3d_wrapper.cpp"
    )

    add_compile_options(-Wno-error=format-security)

    set_target_properties(rtk_path_planning PROPERTIES
    PUBLIC_HEADER rtk_path_planning.h
    OUTPUT_NAME "rtk_path_planning"
    )

    set(Boost_INCLUDE_DIR "/usr/include")
    find_package(Boost REQUIRED)

    set(MathGeoLib_DIR "/home/hatemsla/Downloads/MathGeoLib")
    list(APPEND MathGeoLib_INCLUDE_DIRS ${MathGeoLib_DIR}/src)

    find_package(MathGeoLib QUIET)
    if (NOT MathGeoLib_FOUND)
    message(STATUS "MathGeoLib not found, fetching from GitHub...")
    include(FetchContent)
    FetchContent_Declare(
    MathGeoLib
    GIT_REPOSITORY https://github.com/juj/MathGeoLib.git
    GIT_TAG v1.5 # You can specify a tag or commit if needed
    )
    FetchContent_MakeAvailable(MathGeoLib)
    endif()

    list(APPEND MathGeoLib_INCLUDE_DIRS ${mathgeolib_SOURCE_DIR}/src)

    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    add_compile_options(-Wno-error=format-security)
    endif()

    include_directories(${Boost_INCLUDE_DIRS})
    include_directories(${MathGeoLib_INCLUDE_DIRS})
    include_directories(lib2/include)

    file(GLOB_RECURSE libpathplanning_SOURCES "src/*.cpp")

    target_link_libraries(rtk_path_planning MathGeoLib)

    add_executable(rrt_star_2d_example lib2/examples/rrt_star_2d_example.c)
    target_link_libraries(rrt_star_2d_example rtk_path_planning)

    add_executable(rrt_star_3d_example lib2/examples/rrt_star_3d_example.c)
    target_link_libraries(rrt_star_3d_example rtk_path_planning)

    add_executable(coverage_tsp_example lib2/examples/coverage_tsp_example.c)
    target_link_libraries(coverage_tsp_example rtk_path_planning)

    add_executable(geodetic_example lib2/examples/geodetic_example.c)
    target_link_libraries(geodetic_example rtk_path_planning)

    target_compile_definitions(rtk_path_planning PRIVATE PLUGIN_IMPL)
    target_compile_definitions(rtk_path_planning PUBLIC DART_SHARED_LIB)

    Continue reading...

Compartilhe esta Página