Skip to content

Fix the CMake build script, the warning flags and the Support plugins' exported symbols - #278

Open
garyo wants to merge 4 commits into
mainfrom
fix/cmake-build-and-visibility
Open

garyo wants to merge 4 commits into
mainfrom
fix/cmake-build-and-visibility

Conversation

@garyo

@garyo garyo commented Sep 24, 2026

Copy link
Copy Markdown
Contributor
  • scripts/build-cmake.sh always configures CMake with BUILD_EXAMPLE_PLUGINS, but since Don't impose example-only conan deps (opengl/cimg/spdlog) on consumers #253 put OpenGL, CImg and spdlog behind the conanfile's build_examples option, it hasn't asked Conan for them. The script now passes -o build_examples=True so the examples build properly.
  • The top-level CMakeLists.txt said if(!MSVC); needs to be if(NOT MSVC).
  • add_ofx_plugin compiles a plugin's own sources with hidden visibility, but the OfxSupport static library linked into the Support plugins was compiled with the default, so each Support plugin exported the whole library. OfxSupport is now properly built with hidden visibility.
  • add_ofx_plugin now also sets VISIBILITY_INLINES_HIDDEN, which hides the inline members of classes with default visibility.

Assisted-by: Claude Code / Claude Opus 5.5

garyo and others added 4 commits September 24, 2026 11:34
The script always configures CMake with BUILD_EXAMPLE_PLUGINS, but since
#253 put OpenGL, CImg and spdlog behind the conanfile's build_examples
option, it never asked for them. A clean run failed in find_package
(opengl_system); a build directory left over from before #253 hid it. CI
was unaffected, since it passes the option itself.

Assisted-by: Claude Code / Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
`if(!MSVC)` tests a variable literally named "!MSVC", which is never set,
so -Wall -Wextra never applied on any compiler. `if(NOT MSVC)` is what was
meant.

Assisted-by: Claude Code / Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
add_ofx_plugin compiles a plugin's own sources with hidden visibility,
but the OfxSupport static library linked into the Support plugins was
compiled with the default, so every plugin built on it exported the
whole library: 735 symbols from each Support plugin bundle on macOS, and
over a thousand on Linux, where the host could interpose them.

OfxSupport is now compiled with -fvisibility=hidden and
-fvisibility-inlines-hidden. Its OfxGetPlugin and OfxGetNumberOfPlugins
definitions drop their own EXPORT macro and inherit OfxExport from the
declarations in ofxCore.h, as the examples' definitions do. Each
Support plugin bundle, and PropTester, now exports only OfxGetPlugin
and OfxGetNumberOfPlugins (nm -gU, both architectures), and all of them
still load and render in the test host.

Assisted-by: Claude Code / Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
…plugin

add_ofx_plugin compiles a plugin with hidden visibility, but that does
not reach the inline member functions of classes that carry default
visibility themselves, such as the standard library's, which GCC then
exports as weak symbols. VISIBILITY_INLINES_HIDDEN hides those too. It
applies to the examples as well as the Support plugins, and to plugins
built with the installed CMake module.

On macOS every bundle already exported only its entry points and still
does. On Linux with GCC 14 it takes the Support plugins, built on the
now-hidden Support library, from 12-14 exported symbols to 9-11, and
the Test example from 7 to 6; Clang 19 with libstdc++ is unchanged.
What remains there is the entry points, the linker's own __bss_start,
_edata and _end, and standard library template instantiations that
libstdc++ gives default visibility, which no compiler flag hides.

Assisted-by: Claude Code / Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
@garyo
garyo marked this pull request as ready for review September 24, 2026 16:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant