-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix CMake support on Win32 #789
Conversation
The CI failed because of missing decleration of |
Thanks! That sounds great to me! I'm not a CMake expert but I'm sure @a3f could take a look. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, looks good to me.
f7486a4
to
4e4f31d
Compare
I've rebased your commits on top of master and It looks like your PR breaks mingw 32 & 64 bit builds:
Can you take a look? |
4e4f31d
to
5134a3b
Compare
@a3f This is strange, since |
CI failure on MinGW is caused by these lines: target_compile_definitions(raylib
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
) Log file: log-fail.txt A workaround is: if (MSVC)
target_compile_definitions(raylib
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
)
endif () Log file: log-ok.txt |
Now I think the CI should pass. But I still do not know why it failed before. |
@myd7349 did you dig it? could we merge this PR? |
Sorry for the delay, I'm in bed now. I will give it a test tomorrow. |
ok, no worries and no hurries! :) |
Finally, I figure out what happens.
If I build this small project with:
then MinGW will see a definition of #define RL_API and all the symbols found in If I build this small project with:
then MinGW will see a definition of #define RL_API __declspec(dllexport) and this time, the target file doesn't contain In fact, this workaround: if (MSVC)
target_compile_definitions(raylib
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
)
endif () just bypass the definition of However, these is still build errors with To solve this build error thoroughly, we have to think about this questions before: |
@myd7349 thank you very much for tracking this issue! I always use raylib as static library so I didn't though about it when adding When using raylib as shared library, probably rlgl functions should be included in the library, would it be enought just adding |
|
@raysan5 Thanks! I will give it a test later. |
Hi! I am trying to add
raylib
tovcpkg
: microsoft/vcpkg#5946.And there are some problems with the CMake support on Win32:
find_package(PkgConfig)
causesfind_package(raylib CONFIG REQUIRED)
failed on Win32raylib_static.lib
andfind_library(raylib_LIBRARY NAMES raylib HINTS ${${XPREFIX}_LIBRARY_DIRS})
will not find itBUILD_LIBTYPE_SHARED
is necessary. Otherwise, no export libraryraylib.lib
will be created since no symbols are exportedbin
dir: https://cmake.org/cmake/help/v3.0/command/install.html?highlight=install