I've learnt a few things today and several misconceptions have apparently evaporated.
After fulfilling the third-party dependency requirements (expat and zlib; this is just a matter of extracting files from source tarballs into a designated location), this was pretty easy once I realised that XCode can be leveraged here from the commandline, and that XMP's own "build system" has sufficient tools to do everything I need.
In short, from the build
directory:
./cmake.command 64 Dynamic WarningAsError ToolchainLLVM.cmake
cd xcode/dynamic/intel_64
xcodebuild -scheme ALL_BUILD build
Then, the framework files are found under public/libraries/macintosh/intel_64/Debug
, and the includes were already available under public/include
.
After some liberal symlinking, in my own project's CMakeLists.txt
it's just a matter of:
target_compile_definitions(myProject
PUBLIC
MAC_ENV
)
target_include_directories(
myProject
PRIVATE
include/libxmp
)
# Add build dir to path for finding frameworks (libmxp)
set_target_properties(
myProject
PROPERTIES
LINK_FLAGS "-Wl,-F${CMAKE_BINARY_DIR}/Frameworks"
)
target_link_libraries(
myProject
PRIVATE
catch
"-framework XMPCore"
"-framework XMPFiles"
)
It surely could be finessed, but this does otherwise "just work".
If you are using the XMP Toolkit 2016.07 (and, at time of writing, there is no newer version) and have Xcode 10+ & Mojave, you will need to put together a few patches before you build:
- Xcode version detect fix
- stdlib config fix
- Map/pair type alias fixes
Furthermore, if you use expat 2.2.2 or newer:
- Define
HAVE_ARC4RANDOM_BUF
or XML_POOR_ENTROPY
at the top of expat's xmlparse.c
(because the libxmp build system won't do this for you)