-
Notifications
You must be signed in to change notification settings - Fork 56
Initial CMake build support #23
base: master
Are you sure you want to change the base?
Conversation
The library, demos and documentation builds on Linux. Build options also seem to work properly.
|
Hi! I greatly appreciate this work as adding a cmake build. Below is some feedback for the current version:
Some form of MS-Windows support is required, for now I am happy with just msys2, but I would love to have Visual Studio working too. A big benefit of a cmake build system is that it would then give Visual Studio support for almost free. Thank you for the work, I look forward to reviewing the pull request again after the above is taken into account. |
|
Thanks for the in-depth review! I'll try to clean it up this week, and update the pull request with separate commits to make it easier to review. |
|
Did you still want to pursue cmake building for FastUIDraw? |
|
Yes! I'm sorry about the huge delay. I've done most of the requested changes in my local branch, but it needs some cleanup before I can rebase and update the pull request. There's a long weekend here in Hungary, so I'm looking forward to send the changes in the next few days. |
|
Excellent! I look forward to the pull request and if all requests I made are in the new version, we should see it pulled into master. |
|
One more .. thing. There is a new pair of libraries in FastUIDraw: libNEGL_debug.so and libNEGL_release.so. There serve the same function as libGL_debug/release.so but for EGL. For MS-Windows, they are not used or built, but for Linux they are. |
|
So I did the GL/GLES backend separation, but before continuing with refactoring the demos, I have a question: can we let go the simultaneous backend build (both GL and GLES at the same time)? |
|
Isn't it worse because of the _release and _debug issue which actually makes it four versions? Currently, if one builds an application with FastUIDraw, one's debug builds links against a different .so than a release build. Did you already have the debug and release pain sorted out for the library building? For what it is worth, it wiggs me out some that there is a different .so for debug and release, but their is a reason: the debug version has a number of FASTUIDRAWassert's in the header for reference counted pointer and the release build def's those out. If I remember correctly, the linker rules for inlined functions in a header stipulate that all stuff getting linked together has to have the exact same implementation for such inlined functions. |
|
Release and debug isn't a big issue, because they're built separately, depending on the value of CMAKE_BUILD_TYPE. For them it's just an if() somewhere for the name of the library. But the backends can be built simultaneously currently, which means they must be added somehow as separate targets, which complicates things. However, since you've mentioned it, I think the _debug/_release suffix could be dropped too - I mean, judging by the open source libraries I know, it's not common to note the type of the build in the library name. Some go with appending a "d" to the debug builds, but it's the minority. With CMake, if someone wants to use fastuidraw as a dependency (and assuming they're also using CMake), they just add it with add_subdirectory(), and it will get all the configuration parameters of the parent project, including the build type (debug or release). So there's no way to mess it up, and probably that's why the library name is not really interesting anymore: with CMake, you don't have to set these things manually, everything is figured out by the build system. |
|
The _release and _debug suffixes can NOT be dropped; the issue is that under release, FASTUIDRAWassert degenerates into nothing and under debug it is assert-like; the crux is that some headers have FASTUIDRAWassert in them and linking pain rules generally say don't have headers that define templates compile different ways; so the _release and _debug should remain on the libraries, I think the simple way out is to view GL vs GLES as like debug vs release. It is not ideal, but in all honesty, most users just want GL or GLES but rarely both (indeed some non-Mesa drivers on Linix desktop that support GLES acts a littly wonky too). |
|
Short status report: I've figured out GL/GLES and debug/release naming issues, also added separate targets for NEGL, NGL and NGLES, which were missing from the initial version. |
|
I'd like to ask if this gets merged, do you intend to remove the current Makefile-based build support? In other words, should I extend the README with the CMake build instructions, or replace the existing build instructions completely? |
|
For now extend the README; I don't want to commit to deleting the current GNU-make system until the cmake one has all the features of the GNU-make and is battle tested by users thoroughly. |
0c90d22 to
8d572a2
Compare
fd4c5ce to
d7b8781
Compare
|
I just came across this PR after I sent my fixes for MSVC compilation. It's very interesting because CMake happends to be what I used to compile with MSVC, but mine is not as complete, and tailored for building with MSVC only. But I would like to see this merged, so I can drop mine. |
|
I would like to merge it too, but I am awaiting an update on the issues I have for it; the latest version of this is from about 6 months ago and files have been added since then along with changes, so it won't work out-of-the-box yet either. I'd rather you did NOT drop yours; the most horribly ugly thing to handle is how to generate ngl_gl.hpp/ngl_gl.cpp given that the generation requires flex. |
22a1381 to
788a9f3
Compare
db39b60 to
945f84b
Compare
c8a52da to
6b6b406
Compare
259032d to
31bcb4f
Compare
db1e4e8 to
0495bbc
Compare
a6f9b06 to
ece2a89
Compare
3bfbefa to
ca7b5e7
Compare
70871a8 to
275a156
Compare
b826de2 to
214ed0d
Compare
6ebedcf to
f7df0bd
Compare
I've been hacking on CMake build support in the last few weeks. It has got to the point where the library, documentation and all demos build and run properly on my Linux desktop. With the GLES3 backend enabled there are some problems with the demos, but I haven't had the time yet to check if it's a driver issue or something with the build.
There are some subtle issues though. First, this initial version requires CMake 3.10 which isn't released yet. The reason is that only 3.10 will have a proper FindOpenGL.cmake built-in which can be used to check for EGL. This requirement can be lowered using a local FindEGL.cmake, if needed. Until then a locally built CMake can be used for testing.
Second, I couldn't chain the NGL filter to extractor through stdin/stdout as CMake doesn't seem to support that. The current workaround is to redirect one's output into a file and feed that into the other instead. This is incorrect as the redirection probably doesn't work on Windows. So either I'm wrong and the stdin/out chaining can be done with CMake or a separate shell/Python script will be needed later.
Third, given as I don't know the codebase in depth, it's possible that I missed some defines/build options or set them incorrectly, so they should be thoroughly checked.
Please review/test the changes. Only new files were added so the change is non-intrusive, the old and messy Makefile system can be thrown out later in a separate step.