Setup cocos2d-x on Mac

How to setup cmake to build cocos2d-x test application from command line, not from XCode?

cocos new cocos-test -p test -l cpp -d ~/Projects
cd ~/Projects/cocos-test
cmake .
make

Returns errors with Apple Foundation classes:

In file included from /Users/Home/Projects/cocos-test/cocos2d/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm:26:
/Users/Home/Projects/cocos-test/cocos2d/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h:90:5: error: 
      unknown type name 'NSPoint'; did you mean 'Point'?
    NSPoint    convertDesignCoordToScreenCoord(const Vec2& designCoord, ...
    ^~~~~~~
    Point


In file included from /Users/Home/Projects/cocos-test/cocos2d/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm:26:
/Users/Home/Projects/cocos-test/cocos2d/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h:92:5: error: 
      unknown type name 'NSFont'
    NSFont*    constructFont(const char* fontName, int fontSize);
    ^

This problem exists in the last version 3.9, but not reproduced on 3.7.
Can this be fixed? Because it is very frustrating for newbies like me)

why do u use cmkae?

use

cocos compile -p ios

Because I want use CLion as IDE

And?))) if u using different ide and still need console command, use cocos compile

Best ide on mac is xcode so I would recommend to stick with it. Or what is main reason for using different one?)

CLion compile with cmake and it receive same errors. I use CLion because work not only on a Mac.
As it relates to the issue?

ok :slight_smile: as I don’t knot much about cmake :smile: usability.

I can advice you workaround ) create cmake config file which executes shell cocos compile command :smiley:

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=make%20execute%20shell%20command

I can look at this as well. I am not familiar a lot with CLion, however.

@slackmoehrle thank you!

hi. did u manage to solve this issue with cmake? Im looking for solution either

@apocarteres No, I’m using an older version 3.7