Repository navigation
Conversation
libs/openFrameworksCompiled/project/CMake builds the openFrameworks core and apps on macOS, iOS, tvOS, Emscripten, Linux (linux64, linuxaarch64, linuxarmv7l, linuxarmv6l), Visual Studio and MSYS2, mirroring the makefiles and IDE projects: the same sources, defines, flags and third-party libraries per platform, apps built into bin/, and the core in libs/openFrameworksCompiled/lib/<platform> with the names the existing builds use. Android keeps its own CMake for now. - openFrameworks.cmake: entry point for apps and the core project - CMakeLists.txt: the core library project - OFCore.cmake: core sources, third-party libs, the openFrameworks and openFrameworks::deps targets; apps link the prebuilt core, or build it first if it isn't there (OF_BUILD_CORE=ON forces that) - OFAddons.cmake: addons from their folders and addon_config.mk like the makefiles, or from explicit lists (of_target_addon_files, for the Project Generator) - OFApp.cmake: of_add_app() - platform/*.cmake: per platform excludes, defines, flags, libraries and app output (.app bundles with Info.plist and icon, bin/em/<app> for Emscripten, xcframeworks and bin/data in the bundle on iOS / tvOS) scripts/templates/cmake/CMakeLists.txt is the app template; generated CMakeLists.txt in examples are ignored like the Makefiles.
PROJECT_EMSCRIPTEN_WASM (32 / 64), PROJECT_EMSCRIPTEN_TOTAL_MEMORY, PROJECT_EMSCRIPTEN_EMBIND_AOT and PROJECT_EMSCRIPTEN_TEMPLATE, as in a project's config.make, so the Project Generator writes the same setting for both. wasm64 builds the core into lib/emscripten/WASM64 like the makefiles; EMSCRIPTEN_MEMORY64 still selects 64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A CMake build for the openFrameworks core and apps on every desktop, web and Apple platform, built the same way as Android's: a core project, and an app template that links it. Next, the Project Generator can write
CMakeLists.txtprojects.Draft: Windows (Visual Studio, MSYS2) is written but not yet built; a Windows test run is next.
Usage
Copy
scripts/templates/cmake/CMakeLists.txtinto a project:cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build buildsrc/, addons fromaddons.make, orof_add_app(myApp ADDONS ofxGui ofxOsc).bin/, named<app>(Release) or<app>_debug(Debug).libs/openFrameworksCompiled/lib/<platform>. If it isn't there for the configuration being built, it's built first and written there for the next app.-DOF_BUILD_CORE=ONalways rebuilds it.Per-platform commands, options and the PG integration are in
libs/openFrameworksCompiled/project/CMake/README.md.What it mirrors
platform/<family>.cmakeholds each platform's settings, taken from its makefile config or IDE project:pkg-configlibrarieslibs/*/lib/<platform>bin/<app>.app: Info.plist from the project or template, iconlib/macos/openFrameworks.a(Xcode's)bin/<app>.app: xcframeworks,bin/dataandmediaAssetsin the bundlelib/ios/<sdk>/openFrameworksiOS.a,lib/tvos/<sdk>/openFrameworkstvOS.abin/em/<app>/index.htmlwithbin/datapreloaded, plusapp.jsandstyle.csslib/emscripten/libopenFrameworks.abin/<app>lib/<platform>/libopenFrameworks.a(make's)bin/<app>.exelib/vs/<arch>/openframeworksLib.lib(the VS project's)bin/<app>.exelib/msys2/libopenFrameworks.a(make's)Addons are read the same way as the makefiles:
addon_config.mksections,=/+=,%wildcards,ADDON_DEPENDENCIESandADDON_*_EXCLUDEof_target_addon_files()takes explicit lists instead, so the Project Generator can write out the addons it has already resolved.Tested
Known:
opencvExampleon macOS fails to link, with undefinedkleidicv::symbols. The make build fails identically: apothecary's macOS OpenCV xcframework is missing KleidiCV.Differences from the makefiles
libs/*/includeroots are added, as in the Xcode and VS projects. The makefiles also add every subfolder, and on iOS that letsglm/include/glm/simdshadow the SDK's<simd/…>headers. Addons keep the makefiles' recursive includes.OF_USE_DAWN/OF_USE_ANGLEare set.lib/macos/openFrameworks.arather than make'slib/osx/libopenFrameworks.a.Android keeps its own CMake; moving it onto this system is a follow-up.