Skip to content

Enable choosing to build shared or static library - #3

Merged
peterNordin merged 1 commit into
robbr48:mainfrom
peterNordin:enable_static_lib
May 4, 2022
Merged

peterNordin merged 1 commit into
robbr48:mainfrom
peterNordin:enable_static_lib

Conversation

@peterNordin

Copy link
Copy Markdown
Collaborator

Enable building as static library, default is still shared
When building static library on Windows, and consuming this library FMI4C_STATIC must be defined to avoid assumption of dllimport
Possibly this could be switched around, so that static is the default and that the consumer would have to define some other macro for dllimport.

@peterNordin
peterNordin requested a review from robbr48 May 1, 2022 15:49
Comment thread include/fmi4c.h
#else
// TODO Maybe use dllimport
#define FMI4C_DLLAPI
#define FMI4C_DLLAPI __declspec(dllimport)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure if dllimport is actually needed. It might be possible to leave this macro blank for both the static and dllimport case. Then the consumer would not need to define FMI4C_STATIC when a static library is used.

@peterNordin
peterNordin force-pushed the enable_static_lib branch from 69ffd96 to 73cb2f8 Compare May 4, 2022 18:28
@peterNordin
peterNordin force-pushed the enable_static_lib branch from 73cb2f8 to 9571d54 Compare May 4, 2022 19:40
@peterNordin
peterNordin merged commit 9571d54 into robbr48:main May 4, 2022
slitvinov added a commit to slitvinov/fmi4c that referenced this pull request May 2, 2026
Without this, test FMUs are written to binaries/linux64 (FMI 1/2) or
binaries/x86_64-linux (FMI 3) on macOS, while the patched fmi4c
reader correctly looks under binaries/darwin64 / aarch64-darwin.

With this commit and the reader fix applied, all 6 ctest cases pass
on macOS 26.4.1 arm64 (Apple M5):

  Test #1: fmi1cs ........... Passed    1.05 sec
  Test robbr48#2: fmi1me ........... Passed    0.36 sec
  Test robbr48#3: fmi2cs ........... Passed    0.44 sec
  Test robbr48#4: fmi2me ........... Passed    0.46 sec
  Test robbr48#5: fmi3cs ........... Passed    0.42 sec
  Test robbr48#6: fmi3me ........... Passed    0.33 sec

  100% tests passed, 0 tests failed out of 6
robbr48 pushed a commit that referenced this pull request May 20, 2026
Without this, test FMUs are written to binaries/linux64 (FMI 1/2) or
binaries/x86_64-linux (FMI 3) on macOS, while the patched fmi4c
reader correctly looks under binaries/darwin64 / aarch64-darwin.

With this commit and the reader fix applied, all 6 ctest cases pass
on macOS 26.4.1 arm64 (Apple M5):

  Test #1: fmi1cs ........... Passed    1.05 sec
  Test #2: fmi1me ........... Passed    0.36 sec
  Test #3: fmi2cs ........... Passed    0.44 sec
  Test #4: fmi2me ........... Passed    0.46 sec
  Test #5: fmi3cs ........... Passed    0.42 sec
  Test #6: fmi3me ........... Passed    0.33 sec

  100% tests passed, 0 tests failed out of 6
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