Mac OSX 构建中缺少 Allegro 5.2 TTF 插件

Allegro 5.2 TTF Addon Missing in Mac OSX build

我正在尝试在我的 Mac OSX Sierra 上编译基于 Allegro 的游戏,但出现以下错误:

Undefined symbols for architecture x86_64:
"_al_init_ttf_addon", referenced from:
__al_mangled_main in main.cpp.o

我从源代码编译了 Allegro 5.2.3,这些是我在游戏的 CMakeLists.txt 文件中包含的库。

SET(LIBRARIES
    liballegro.dylib
    liballegro_acodec.dylib
    liballegro_audio.dylib
    liballegro_color.dylib
    liballegro_dialog.dylib
    liballegro_font.dylib
    liballegro_image.dylib
    liballegro_memfile.dylib
    liballegro_main.dylib
    liballegro_primitives.dylib)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
add_executable(My_Game ${SOURCE_FILES})
target_link_libraries(My_Game ${LIBRARIES})

在 Allegro 5.2.3 CMakeLists.txt 我设置了以下宏:

option(WANT_TTF "Enable TTF addon" on)
option(WANT_COLOR "Enable color addon" on)
option(WANT_MEMFILE "Enable memfile addon" on)
option(WANT_PHYSFS "Enable PhysicsFS addon" on)
option(WANT_PRIMITIVES "Enable primitives addon" on)
option(WANT_NATIVE_DIALOG "Enable native dialog addon" on)
option(WANT_VIDEO "Enable video player addon" on)
option(WANT_MONOLITH "Include all addons in the main library" off)

构建和安装后,我没有在 /usr/local/include 中看到 allegro_ttf.h,其中安装了所有其他 allegro headers。我也没有在 /usr/local/lib 下看到 allegro_ttf.dylib。在 allegro 构建的 CMakeFiles/Makefile2 中,我在 Makefiles2 中看到以下内容:

# Convenience name for "all" pass in the directory.
addons/all: addons/primitives/all
addons/all: addons/image/all
addons/all: addons/font/all
addons/all: addons/audio/all
addons/all: addons/acodec/all
addons/all: addons/color/all
addons/all: addons/memfile/all
addons/all: addons/native_dialog/all
addons/all: addons/video/all
addons/all: addons/main/all

.PHONY:addons/all

但是我没有看到 addons/ttf/all。任何帮助将不胜感激。

问题是我没有安装 freetype

brew install freetype

现在可以使用了!