freeglut: fix static linking on MSVC#2669
Open
bitrunner wants to merge 1 commit intomesonbuild:masterfrom
Open
freeglut: fix static linking on MSVC#2669bitrunner wants to merge 1 commit intomesonbuild:masterfrom
bitrunner wants to merge 1 commit intomesonbuild:masterfrom
Conversation
The -DFREEGLUT_LIB_PRAGMAS=0 compiler argument needs to be used when building freeglut as a static library on windows to avoid freeglut_std.h injecting a dependency on the non-existent freeglut_staticd.lib into the resultant libfreeglut.a via comment pragma. FREEGLUT_LIB_PRAGMAS only has relevance on Windows when building with MSVC, so it's only defined in that context now. This fixes the following link error when using freeglut as a static library subproject with MSVC: LINK : fatal error LNK1104: cannot open file 'freeglut_staticd.lib'
69810ee to
82780a1
Compare
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.
The -DFREEGLUT_LIB_PRAGMAS=0 compiler argument needs to be used when building freeglut as a static library on windows MSVC to avoid freeglut_std.h injecting a dependency on the non-existent freeglut_staticd.lib or freeglut_static.lib into the resultant libfreeglut.a via comment pragma. FREEGLUT_LIB_PRAGMAS only has relevance on Windows when building with MSVC, so this change makes it only defined in that context.
This fixes the following link error when using freeglut as a static library subproject with MSVC:
LINK : fatal error LNK1104: cannot open file 'freeglut_staticd.lib'
I tested this successfully building freeglut as a static and shared library subproject and linking it with an executable on windows and Linux.