Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add USE_STATIC_CRT option #4444

Merged
merged 2 commits into from Mar 15, 2022
Merged

Add USE_STATIC_CRT option #4444

merged 2 commits into from Mar 15, 2022

Conversation

EYHN
Copy link
Contributor

@EYHN EYHN commented Mar 15, 2022

Allow user to choose C runtime library version, on Windows

This PR adds an option to cmake, USE_STATIC_CRT.

The default is OFF, which has no changes to the current build.

Copy link
Member

@kimkulling kimkulling left a comment

Choose a reason for hiding this comment

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

Looks good, I will merge it!

@kimkulling kimkulling merged commit 784d961 into assimp:master Mar 15, 2022
@kimkulling
Copy link
Member

Merged, thanks a lot for your contribution.

@SirLynix
Copy link
Contributor

SirLynix commented Mar 22, 2022

This PR prevents building Assimp in release with /MDd or /MTd, breaking the xmake-repo package.

note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> assimp v5.2.3 [vs_runtime:"MDd"]
please input: y (y/n/m)
y
  => download https://github.com/assimp/assimp/archive/v5.2.3.zip .. ok
  => install assimp v5.2.3 .. failed

assimp-vc143-mt.lib(Importer.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(Importer.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(Version.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(Version.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(BaseProcess.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(BaseProcess.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(MaterialSystem.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(MaterialSystem.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(scene.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(scene.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(DefaultLogger.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(DefaultLogger.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(ScenePreprocessor.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(ScenePreprocessor.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(DefaultIOStream.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(DefaultIOStream.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MDd_DynamicDebug' in _628228A2FFB8424088623A9B310E0440.o
assimp-vc143-mt.lib(Exceptional.obj) : error LNK2038: discordance détectée pour '_ITERATOR_DEBUG_LEVEL' : la valeur '0' ne correspond pas à la valeur '2' in _628228A2FFB8424088623A9B310E0440.o
error: install failed!

(sorry for the french logs).

I have to use MDd runtime because my own project uses debug (and MD libraries aren't compatibles with MDd), but don't want to compile Assimp in debug because I don't need to (and will lose a lot of performances due to optimizations being disabled).

I don't think this is the way thoses flags should be used. CMake already provides MSVC_RUNTIME_LIBRARY.

If we want to keep this, we should at least provide a way to disable it to rely on standard cmake option.

The default is OFF, which has no changes to the current build.

Actually it does, since it forces MD in release (and MDd in debug) if left off

@SpaceIm
Copy link

SpaceIm commented Mar 26, 2022

There is no reason to add this kind of option, https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html is your friend.

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.

None yet

4 participants