-
Notifications
You must be signed in to change notification settings - Fork 309
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
misc cmake update #397
misc cmake update #397
Conversation
Hi, friend. Don't say more thanks. we all hope this project be better. It's you give the project life! |
Hah, well, I do appreciate the contributions! Do you intend to submit more changes to the CMake file? If so, it would be nice if you could submit them together in here as a single pull request. |
ok, I will do this later.
…________________________________
From: Michael R. P. Ragazzon ***@***.***>
Sent: Saturday, December 24, 2022 8:30:45 AM
To: mikke89/RmlUi ***@***.***>
Cc: DragonBillow ***@***.***>; Author ***@***.***>
Subject: Re: [mikke89/RmlUi] misc cmake update (PR #397)
Hah, well, I do appreciate the contributions!
Do you intend to submit more changes to the CMake file? If so, it would be nice if you could submit them together in here as a single pull request.
―
Reply to this email directly, view it on GitHub<#397 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKBJ6ALGREYTKDIDQ3FLUP3WOY73LANCNFSM6AAAAAATFGWCSE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
lua not support cmake, did you can accept make it as a submodule? just like this: https://github.com/luvit/luv/tree/master/deps |
I would prefer not to include dependencies as submodules. Instead though, it would be nice to allow users to optionally fetch them using |
sorry replay too late. maybe we can provide a option, which provide lua51 as default lua, just like this: option (USE_BUND_LUA OFF)
if(${USE_BUND_LUA}
add_subdirectory(extern/lua)
endif() can you accept this? |
Hm, how would this work from the user perspective? Do you mean we should bundle the Lua source code inside our repository? |
I want add lua as a submodule, but just use it when USE_BUND_LUA is true. |
As mentioned previously, I would prefer not to include dependencies as submodules. |
ok, can you accept that use RMLUI_LUA_EXTERNAL option? for this option, just use lua::lua as target name, then user can define any lua version as this alias. I can do a commit later, but it need sone time. |
Yeah, that sounds reasonable to me. Preferably, mark all the *_EXTERNAL options as advanced. |
That's should be OK now. I add .editorconfig file, because I use nvim edit file, it default use space but not tab, so it's troublesome for me to edit CMakeLists.txt. Then I add RMLUI_LUA_EXTERNAL, when this flag be true, rmlui will try link RmlUi::Lua. addition: if target_link_libraries RmlUi::Lua, then RmlUi::Lua's include directories will be included automaticly. |
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.
Hey, I have some comments here. Generally I'm a bit confused about some of the external library names.
Here is an alternative idea: Instead of adding the new options, see if e.g. ${LUA_INCLUDE_DIR}
and ${LUA_LIBRARIES}
are already set, and if so, use them directly and skip the find_package
. Similarly for rlottie and freetype. What do you think about this approach?
@hobyst Perhaps you have some thoughts on this PR or my comments here?
The proper way to define paths to dependencies is, although not often noticed, to use the CMake variable CMake prefers For rlottie, it might be more complex to go for this approach as it doesn't get distributed as a pre-compiled package but not impossible to make a proper integration since it supports CMake as a build system and a CMake package config file could be generated when building it so that it can be consumed as a pre-compiled dependency by other CMake projects. Adding it as a submodule could ease the integration as the build script could default to do a source build from the included rlottie via In the event that rlottie can't be integrated using its CMake build option, then either a find module would have to be written for it or investigate the use of Meson's CMake module in their mesonfile so that it generates the CMake config module for us. |
|
yes, this pr is for this case. In this case, rmlui needs to leave some interfaces for external use |
@hobyst Alright, thanks for chiming in. As I understand it, here we're considering cases where users have already included the external libraries through
@cathaysia Yeah, let's drop that suggestion, but I hope we can find some better names. Could you perhaps write some basic examples of how you would include RmlUi from a parent scope together with the external libraries? That would be great, so we could possibly include this in the documentation. |
sorry replay too late. :( then I add a repo for a sample: https://github.com/cathaysia/rmlui_externallib_example please let me know if you have any question about this. :) and here is a video about this: Peek.2023-02-12.20-58.mp4 |
You may find I use ${LUA_LIBRARIES} after find_package https://github.com/cathaysia/rmlui_externallib_example/blob/33e3acf2d8aa0f8d6e5506400d49d407b1dac95b/extern/CMakeLists.txt#L12 Generally speaking, find_package will look for libraries from two places: Find_xxx.cmake or xxxConfig.cmake In the second form, the general library uses the domain name to define the header file path and library path. The XXX_LIBRARIES variable is not set in this case. In the first form, it is up to the writer whether to set the XXX_LIBRARIES variable or not. Some people set this variable, others don't Use find_package(XXX CONFIG) to force cmake to use the second form to find libraries. |
That example repo is great, except that it doesn't actually work for me. See the full log output below. It would be nice if we could make this work by just following the commands with minimal prerequisites. Ideally, this should include building the samples too. In any case, this is a good outline for something I can add to the documentation and link to.
This seems good to me now. We are getting closer, there are still a couple of comments from the previous review, and a conflict that needs to be solved. Command line output
|
I made some changes, it should work for now. But I haven't test it on windows. this question and others will be done later. |
Did you notice? In the latest repo, I commit a FindLua.cmake file. This can be used with find_package(lua). Maybe I should remove RMLUI_LUA_EXTERNAL. I'll explore this later :) |
I tested this a bit more (on Windows), and have some feedback:
I did make it work by disabling external libraries in FreeType. I also tested it with the RmlUi samples. Here are the commands I used:
This built successfully. But the samples won't launch because they can't find the |
Ok, thanks. I am very sorry that this PR has been delayed for so long. Next, I will try my best to spare time to advance this pr.
Yes, it can be done surely. But I need to consider how to integrate with existing systems as much as possible. while not affecting previous code. |
OK, I had made some changes in https://github.com/cathaysia/rmlui_externallib_example and https://github.com/cathaysia/RmlUi/tree/cmake .
In these case. find_package(Lua REQUIRED) while call my FindLua.cmake file, then set some envs for rmlui. |
What do you think of this approach? This code is also less intrusive. |
I like that it is less intrusive, and I'd be okay with adding rlottie like that. I don't think we should override the built-in Lua find module inside RmlUi. Of course, I don't mind if users do it in a parent directory. |
yes, I don't override build-in Lua inside RmlUi. The best practice about lua is don't handle it. If possible, user can override it by themeself. |
all in all. What I have done just two things:
|
…en rmlui is a submodule Signed-off-by: Longtao Zhang <DragonBillow@outlook.com>
I remove previous useless commits, and merge it to one. Merge it if you decide it's ok |
Yup, this looks good to me! |
… disable export when rmlui is a submodule (mikke89#397) Signed-off-by: Longtao Zhang <DragonBillow@outlook.com>
this pr makes some changes:
RMLUI_FREETYPE_EXTERNAL makes rmlui use existed freetype target. such as:
the reason use freetype_interface instead of freetype is freetype has not set -fpie, so it make a link error.