第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

帶有Swig和go-integration包裝器錯誤的Cmake

帶有Swig和go-integration包裝器錯誤的Cmake

Go
慕尼黑8549860 2022-08-15 15:41:26
我目前正在嘗試將C++lib與SWIG集成,SWIG是各種語言(UseSWIG)的包裝器生成器。我想集成到golang中,為此,我正在使用cmake輕松構(gòu)建它。我的 cmake 在我構(gòu)建時正在工作,它會生成包裝器文件和 go 文件,用于我的 go 模塊。但在 MSVC 中,我從生成的文件中收到一些錯誤。我還嘗試直接調(diào)用我的go模塊(通過go run...),但它缺少libs,這就是為什么我選擇首先使用Cmake構(gòu)建它(鏈接ext libs等),例如鏈接哪個是通過cmake中的vcpkg獲得的。<fmt/format.h>CMakeLists:......# SWIG integrationfind_package(SWIG 4.0.2)if(SWIG_FOUND)    message("Swig integration")    include (UseSWIG)    set(IPATH "go-integration/basic_host")    set (SWIG_FILE "basic_host.i")    set_source_files_properties(${IPATH}/${SWIG_FILE} PROPERTIES CPLUSPLUS ON)        #library for Go    find_program(GO_EXECUTABLE go)    if (GO_EXECUTABLE)        message("Bindings for Go will be generated using ${GO_EXECUTABLE}")        set(SWIG_MODULE_NAME "bhost-go")        set(CMAKE_SWIG_FLAGS -c++ -go -cgo -intgosize 64)        message("CMAKE_SWIG_FLAGS: ${CMAKE_SWIG_FLAGS}")        swig_add_library(${SWIG_MODULE_NAME}             TYPE SHARED             LANGUAGE go             OUTPUT_DIR basic_host            SOURCES ${IPATH}/${SWIG_FILE}        )        target_include_directories(${SWIG_MODULE_NAME} PRIVATE ${HIDAPI_INCLUDE_DIR})        swig_link_libraries(${SWIG_MODULE_NAME} PUBLIC stduuid)        swig_link_libraries(${SWIG_MODULE_NAME} PUBLIC fmt::fmt-header-only)        swig_link_libraries(${SWIG_MODULE_NAME} PUBLIC nlohmann_json nlohmann_json::nlohmann_json)        set_target_properties(${SWIG_MODULE_NAME} PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE)    else()        message("Go executable not found, golang integration not done")    endif()else()    message("Swig not found, integration not done")endif()basic_host.i%module basic_host%{    #include <atomic>    #include <map>    #include <memory>    #include <iostream>    #include <fmt/format.h>    #include "../../examples/basic_host/command_line.h"    #include "../../examples/basic_host/command_line.cpp"%}%include <std_string.i>%include "../../examples/basic_host/command_line.h"basic_host.go
查看完整描述

1 回答

?
達令說

TA貢獻1821條經(jīng)驗 獲得超6個贊

找到了一種避免這些錯誤的方法,DLL正在為MSVC中的SWIG構(gòu)建良好:


在 .i 文件的開頭添加這些行:


%begin %{

#define __attribute__(x)

%}


%include <windows.i>


查看完整回答
反對 回復(fù) 2022-08-15
  • 1 回答
  • 0 關(guān)注
  • 216 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號