简体   繁体   English

Xcode预处理器宏包含系统样式标头

[英]Xcode preprocessor macros to include system style headers

I'm trying to manually add freetype 2.9.0 as a framework build target to my toy project in Xcode. 我试图手动将freetype 2.9.0作为框架构建目标添加到我的Xcode玩具项目中。 Freetype uses preprocessor macros to include its headers with angled brackets ( <freetype/config/xx.h> ) which is confusing the Xcode build system and I get the error expected "FILENAME" or <FILENAME> , indicating that it can't find my system level includes. Freetype使用预处理器宏将其标头包含在尖括号( <freetype/config/xx.h> )中,这使Xcode构建系统感到困惑,并且出现expected "FILENAME" or <FILENAME>的错误expected "FILENAME" or <FILENAME> ,这表明它找不到我的系统级别包括。 Instead of hardcoding the subfolder headers, how would I configure the Xcode build system to find these config files? 不用对子文件夹头进行硬编码,我将如何配置Xcode构建系统以查找这些配置文件?

I tried this in another file 我在另一个文件中尝试过

#define SOME_CONFIG <glfw/glfw3.h> /*this header is included as a system header in a subfolder <project/glfw/... , and works fine*/

#ifdef SOME_CONFIG
#include SOME_CONFIG
#endif

And it works perfectly. 而且效果很好。 But when I try this with freetype it cannot find the expanded in the macros. 但是,当我尝试使用freetype时,无法在宏中找到扩展。

The freetype include structure looks like this: Freetype包含结构如下所示:

include/ftbuild.h         -- points to include/freetype/config/ftheader.h
include/config/ftheader.h -- has all the #define macros to ->
include/config/...        -- a bunch of headers with options which Xcode refuse to see

Apparently it was actually working all along I just forgot to add the environment variable FT2_BUILD_LIBRARY to both debug and release build, and I had it set to debug, so the internal header macros was not being precompiled, and therefore not found. 显然,它实际上一直都在工作,只是忘了将环境变量FT2_BUILD_LIBRARY添加到调试和发布版本中,并且将其设置为调试,因此内部标头宏未预先编译,因此找不到。 Works perfectly fine to do what I am trying to do in Xcode 9. 可以很好地完成我在Xcode 9中要做的事情。

环境变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM