How do Cocos2d-x 3.x project define its EngineRoot macros variables?

Hi all,

I am trying to create a new C+ project alongside the existing C+ project created Cocos2d-x. But, as I compiled it using Visual C+ 2012, I find that it unable to find “cocos2d.h” file. Having look at the previously created C+ project, I know that it refer to a EngineRoot macro. Unfortunately, I am unable to find where does this macro get its value.

Any idea about this? Or, actually, how do they manage the C+ project using Visual C+ 2012?

Thanks in advance!

Why not use tools/project-creator/create_project.py to create new project? It will handle all the things.

@zhangxm I’d like to know the answer to this question as well. I’ve looked at the build files generated and found that EngineRoot is referenced as an environment variable:

  <ItemGroup>
    <BuildMacro Include="EngineRoot">
      <Value>$(EngineRoot)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>

But I’m not able to find where it’s defined either. Could you please help with a direct answer to @softwarecheng’s question?

I’m trying to use cocos2dx in a larger context where I already have existing parts of my game project (server, browser, common libs, test code, etc) being built using a Scons and would like to use the same to build the game client for which I’ve decided to use Cocos2dx.

Thanks.

I found the answer to the question. EngineRoot is defined in the cocos2d_headers.prop file near the top like this:

<PropertyGroup Label="UserMacros">
  <EngineRoot>$(MSBuildThisFileDirectory)..\..\</EngineRoot>
</PropertyGroup>