CMake 访问 SWIG 并将 java 库链接到现有 C++ 时出现问题;项目
我正在修改用 C++ 编写的现有开源项目的 CMake 文件,以尝试将其链接到 SWIG Java 接口文件。我从其他论坛拼凑起来并进行修改的代码是这样的:
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/avogadro/src)
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES SWIG_FLAGS "-includeall")
SWIG_ADD_MODULE(mainwindow java mainwindow.i mainwindow_wrap.c)
SWIG_LINK_LIBRARIES(mainwindow ${JAVA_LIBRARIES})
我编写/发现的内容有什么问题吗?当我运行 cmake 命令时,它会构建。然而,当我运行 make -j3 (我需要这样做才能稍后访问新集成的库)时,它崩溃了,给出了非常模糊的错误消息“make:* [all] Error 2”
谢谢!
I am modifying a CMake file of an existing open source project written in C++ to try to link it to a SWIG Java interface file. The code I have pieced together from other forums and tinkering around is this :
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/avogadro/src)
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES SWIG_FLAGS "-includeall")
SWIG_ADD_MODULE(mainwindow java mainwindow.i mainwindow_wrap.c)
SWIG_LINK_LIBRARIES(mainwindow ${JAVA_LIBRARIES})
Is there anything wrong with what I have written/found? When I run the cmake command, it builds. Yet when I run make -j3 (I need to do this to access the newly integrated libraries later on), it crashes, giving the very ambiguous error message "make: * [all] Error 2 "
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过在设置源属性命令中添加包装器和接口文件的完整路径解决了我的特定问题。为了将其指向
jni.h
,我在开头添加了FIND_PACKAGE(JNI REQUIRED)
。I fixed my particular problem by adding the full path to the wrapper and interface files in the set source properties commands. To point it towards
jni.h
, I addedFIND_PACKAGE(JNI REQUIRED)
at the beginning.