zoukankan      html  css  js  c++  java
  • libmkl 学习笔记

    libmkl 学习笔记

    1.libkml下载地址为:

    https://github.com/libkml/libkml/releases

    这里下载1.3.0版本

    2.编译与安装

    mkdir build

    cd build

    cmake ..

    make

    make install

    如果想生成动态库,需要将CMakeLists.txt中第20行

    option(BUILD_SHARED_LIBS  "Build shared libs." ON)

    改成

    option(BUILD_SHARED_LIBS  "Build shared libs." OFF)

    3.测试程序

    新建一个test.cpp,代码如下:

    // parsekml.cc
    // This program parses a KML Placemark from a memory buffer and prints
    // the value of the <name> element on standard output.

    #include <iostream>
    #include <string>
    #include "kml/dom.h"  // The KML DOM header.

    int main() {
      // Parse KML from a memory buffer.
      std::string errors;
      kmldom::ElementPtr element = kmldom::Parse(
        "<kml>"
          "<Placemark>"
            "<name>hi</name>"
            "<Point>"
              "<coordinates>1,2,3</coordinates>"
            "</Point>"
          "</Placemark>"
        "</kml>",
        &errors);

      // Convert the type of the root element of the parse.
      const kmldom::KmlPtr kml = kmldom::AsKml(element);
      const kmldom::PlacemarkPtr placemark =
        kmldom::AsPlacemark(kml->get_feature());

      // Access the value of the <name> element.
      std::cout << "The Placemark name is: " << placemark->get_name()
        << std::endl;
    }

    与test.cpp同目录,新建一个CMakeLists.txt,内容如下:

    cmake_minimum_required (VERSION 3.0)


    set(PROJECT_NAME  libkmltest)
    project (${PROJECT_NAME})



    set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
    set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "")

    # same as gcc -I
    include_directories(
      "/usr/local/include/"
    )

    link_directories("/usr/local/lib/")


    # used for output
    set (PUBLIC_H
      #  ${PROJECT_ROOT_PATH}/3rd_party/ros/xmlrpcpp/include/XmlRpcValue.h
    )

    # sources for create target
    set (SRCS
      test1.cpp

    )

    # compile
    add_compile_options ($<$<BOOL:${HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS}>:-Wno-unnamed-type-template-args>)
    add_executable (${PROJECT_NAME}
      ${SRCS}
    )

    target_link_libraries(${PROJECT_NAME} kmlbase kmlconvenience kmldom kmlengine kmlregionator kmlxsd)

    然后执行如下代码:

    mkdir build

    cd build

    cmake ..

    make

    再执行程序就可以看到测试结果

    参考链接:

    https://github.com/libkml/libkml/blob/wiki/QuickStart.md

  • 相关阅读:
    搜狗五笔快捷键
    [原抄] Potplayer 1.7.2710 快捷键
    权限设置并未向在应用程序容器 不可用
    fork( )函数(转载)
    软件开发中的迭代(转载)
    进程间通信的方式(转载)
    P NP NPC(1)(转载)
    P NP NPC(2)(转载)
    大小端字节序
    求n对括号的排列组合(卡特兰数)
  • 原文地址:https://www.cnblogs.com/wangkevin5626/p/11171154.html
Copyright © 2011-2022 走看看