سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top