Skip to content

Build C++ unit tests against a static library - #4062

Open
paulromano wants to merge 2 commits into
openmc-dev:developfrom
paulromano:static-cpp-test-library
Open

Build C++ unit tests against a static library#4062
paulromano wants to merge 2 commits into
openmc-dev:developfrom
paulromano:static-cpp-test-library

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

Another PR here working toward Windows support. Notably, in #2919 there are a bunch of OPENMC_API macros that are added on globals that I'm hoping to avoid. One category is global variables that get used in C++ tests; we can avoid those by compiling the OpenMC C++ sources once in an object library and reuse those objects for both the shared library and a static library dedicated to C++ unit tests. This keeps internal globals used by the tests from defining the shared library interface without compiling the source tree twice.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@shimwell shimwell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I had to do the same changes when prototyping an openmc windows wheel so I'm confident these changes are needed of windows support

One optional name change for your consideration.

Comment thread CMakeLists.txt
Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com>
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.

2 participants