如何更改我的项目 API 类扩展
我创建了一个名称为“OpenOnDesktopPlugin”的 firebreath 项目。我需要将“OpenOnDesktopPluginAPI”扩展名从.cpp 更改为.mm,因为我需要添加一些目标c 代码。 我将“Mac/[^.]*.mm”行添加到我的“.cmake”文件中。 问题是,当我将“OpenOnDesktopPluginAPI.cpp”的扩展名更改为“.mm”并运行“prepmac”命令时,该文件不会显示在我的 firebreath 项目树中,但如果我转到查找器,文件就在那里。
I created a firebreath project with "OpenOnDesktopPlugin" name. I need to change the "OpenOnDesktopPluginAPI" extension from .cpp to .mm, because I need to add some objective c code.
I added the "Mac/[^.]*.mm" line to my ".cmake" files.
The problem is, when I change the extension to ".mm" to my "OpenOnDesktopPluginAPI.cpp" and I run the "prepmac" command, the file is not displayed in my firebreath project tree, but if I go to my finder, the file is there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要编辑 CMakeLists.txt 文件以告诉它也包含该目录中的 *.mm 文件。
“Mac/*.mm”将不起作用,因为您的 OpenOnDesktopPluginAPI.mm 文件不在 Mac/ 目录中。
这应该是一个跨平台项目吗?如果没有,那你就没事了;如果是这样,那么您可能需要为 mac 子类化 JSAPI 文件,并将其放入 Mac/ 目录中的 .mm 文件中; Mac/projectDef.cmake 是特定于 mac 的 cmake 命令。 CMakeLists.txt 是跨平台的 cmake 命令(除非你除了 mac 之外不关心任何东西,在这种情况下你可以把它放在两个地方。
然后当然(如果你创建一个特定于 mac 的子类)你会需要子类化你的plugincore类或使用“#if FB_MACOSX”预处理器宏来决定是否返回mac特定版本当然,有很多选项可以实现所有这些,但这是。 方式。
我会这样做的
You need to edit your CMakeLists.txt file to tell it to include *.mm files from that directory as well.
"Mac/*.mm" won't work because your OpenOnDesktopPluginAPI.mm file isn't in the Mac/ directory.
Is this supposed to be a cross-platform project? if not, then you're okay; if so, then you will probably want to subclass your JSAPI file for mac and put that in a .mm file in your Mac/ directory; Mac/projectDef.cmake is the cmake commands specific to mac. CMakeLists.txt is the cmake commands that are cross platform (unless you don't care about anything but mac, in which case you can put it in both places.
Then of course (if you create a mac-specific subclass) you'll need to either subclass your plugincore class or use "#if FB_MACOSX" preprocessor macros to decide whether to return the mac specific version or not. There are lots of options for how you can do all of this, of course, but this is the way I'd do it.
Hope that helps.