-
Notifications
You must be signed in to change notification settings - Fork 17
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
Cleanup CMake #196
Comments
Yeah, the thing I must to do long time ago, but didn't yet...
Reason why version checks are added to allow support of older CMake builds, but, as required CMake version is higher than in condition, yeah, nuke it.
Yeah, that needs some more depther research, I did the only small test from off VirtualBox environment...
Most of parts must be enforced with C++98 to be sure code will be built on older compilers (as example, older Android NDKs, OpenWatcom where I have done some experiments, ancient GCCs, and some other clunky compilers I didn't tested yet, but they will more work than not). There are two cases are using C++11:
As the "Put targets into subfolders" task, the C++98/C++11 mixing between different targets will be no more needed.
The reason why I made the stats of options is ability to easier see the available stuff with no necessary to dig docs. But yeah, looks like the better option would be needed. Also, libSDL's CMake build does similiar printing of it's options are set.
The reason I keeping "ready-to-use" header with no any pre-configures is giving an ability to use it as-is with no any change requirement (Optionally, everyone can import code of library into the project in the form of sources set like was done in a case of GZDoom [but, maybe I'll change this, and will make those libraries to be built via CMake and be linked which will be much easier to maintain and update.. like the case of GME and ZLib]). But, maybe I'll put some another info that will tell about version the "unknown" when header was used out of library's build. |
Then this is a bug: Line 118 in d89084d
SDL is a autotools/configure thing. CMake is not really used there although it may work. (Had a conversation with them lately) In autotools there is no cache that you can easily check so this output is required. For CMake you can simply look in the file.
Good point, but even then: The cmake-input file look very easy (Example: https://github.com/Return-To-The-Roots/s25client/blob/9e0de7282866bc8cedf3a779151ae023ebc582c3/libs/rttrConfig/build_paths.h.cmake) so if one chooses to not use the build system "configuring" the header themselves is trivial and you have a list of options which you can turn on/off without digging into the CMake or sources. So the configure header is even better for that. |
As I remember, in some cases it doesn't appears properly, therefore I defining it manually to avoud possible ussue for a case of lack of it. |
Keep it have library code only but no utils and examples are will be built independently #196
AFAIK only when misusing something. E.g. when overwriting CMAKE_CXX_FLAGS_* without appending. I just grepped the CMake code and it gets added for all release builds (release, minsizerel, relwithdebinfo) Can you remember where it didn't? Again I suspect an error in the CMake (user) code or a very old CMake version I may help if you need some |
After finishing this, I'll backport the full stuff into libOPNMIDI also... |
I reviewed some of the CMake changes made and observed this.
|
@jpcima I highly support this. AFAIK my changes did not introduce those and I didn't want to change something for which there might be a reason. But yes linking to a STL lib should not be required anywhere and probably pthread is also not even required (what was the reason? SDL should include that itself if required) |
The platforms which need special support are DOS and Android, so it might relate to either of these. I am not able to tell you a lot more about these cases. |
Manual linking of libc++ / libstdc++ is required from off the pure C application that statically links libADLMIDI, otherwise you'll meet with lot of |
I'm pretty sure CMake is able to handle this. For example for imported libraries you can set https://cmake.org/cmake/help/v3.0/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.html to explicitly tell which linker (link language) to use. For CMake targets CMake already knows this so I'm sure it sets this correctly. |
The configuration of libADLMIDI/utils/midiplay/CMakeLists.txt Lines 7 to 8 in 25c48a9
The variable On my setup,
I remember it's an annoying problem because SDL2 find-modules act different on more or less recent versions of the library. Like OPNMIDI does right now, I would use a manual search method for the library. |
After
Could you post "your setup"? Yes the SDLTargets.cmake sets targets but that's not what the
So the variable is set an all should be fine. Can you append your sdl2-config and SDLTargets.cmake files? From the above |
You can have a look at these attached SDL2 files, as found in |
Wow, nice. Didn't know SDL2 actually installs the exported targets now and that it even builds with CMake. Well simple solution then: Change libADLMIDI/utils/midiplay/CMakeLists.txt Lines 7 to 8 in 25c48a9
to:
|
Seems a nice solution @Flamefire. I will try. |
The new project structure looks great and the CMake is also mostly fine. However may I suggest the following changes (maybe missing some) to make it cleaner:
if(OPTIONAL_FEATURE) add_subdirectory(optional_feature) endif()
target_*
directives (as far as possible)add_definitions(-DNDEBUG)
-> CMake does that where requiredOPENBSD_LOCALBASE
partially ignored -> use itmessage
on end -> Not "the CMake way". You have set those manually anyway or you have ccmake to easily check those. Better: Rename option to have common prefix, then ccmake/cmake-gui groups them nicely and you don't clash names with super projectslibADLMIDI/include/adlmidi.h
Line 3 in d89084d
The text was updated successfully, but these errors were encountered: