Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411491 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 25, 2024, 03:48:46 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 62 63 [64] 65 66 ... 69
Print
Author Topic: General thread for quick questions  (Read 135360 times)
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1260 on: September 05, 2018, 03:25:48 PM »

Ok, so while my end goal is to publish two header-only libraries to GitHub and make sure that vcpkg can install them correctly, I'd also like to understand how CMake works so that I can better use it for other projects. I don't just want a dumb step-by-step tutorial, I want to get it, you feel me?

Sorry if I didn't make that clear the first time.
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1261 on: September 07, 2018, 07:50:20 AM »

https://cliutils.gitlab.io/modern-cmake/ is ok. It doesn't actually explain how CMake works very well, it's more recipe focused, but it does cover it. Crucially, it cuts down the set of commands and variables to a small set which you can actually grok.

For a header only library, there's not much to do. I presume you have some complicated dependencies or something, otherwise just distribute the headers alone. With cmake: One folder, include/ with your headers. Another folder cmake/ which contains a target for your library, configured as neccessary. Optionally follow the export or packaging instructions.

I cannot comment on vcpkg, never used it. But it likely has more specific setup, you'll need a tutorial for that.
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #1262 on: September 07, 2018, 04:43:15 PM »

In my opinion the only reason CMake is sort of useful is it is just one way to write down a set of "build rules", that works on different operating systems. The build rules typically build the source code, run unit tests, and install stuff. The install part is the one you seem to be focusing on since you keep bringing up vcpkg -- installing is just placing headers/libs/.a/.so/dll into a common folder on the system path. That way applications can easily find the installed things.

So you write down a CMake script inside of a CMakeLists.txt file, and it contains all the rules for build, test, install, and possible other stuff, and some steps are skipped entirely different projects.

That's about it really.

Write code, write a cmake script, upload it to github, and you're done. This forces anyone who wants to use your cmake build script to have previously installed cmake on their machine. So now cmake stands between you and your customers. This may be a good thing, but can also be viewed as a bad thing. It's a preference mostly.

As for vcpkg it honestly sounds like you have some kind of silly idea that vcpkg is somehow important. If you want to learn about it for fun or for educational reasons, by all means do so. Otherwise just know it's probably not a very important thing to specifically learn about.

Also I want to point out there is no reason that something like cmake or vcpkg or anything similar needs to be used. They are not necessities. Personally I wish people would just upload MSVC .sln files, or hand-written make files, onto github directly. The idea is to reduce dependencies of your code. It is well known that customers decidedly dislike dependencies and will actively avoid them, given the option. Uploading code to github with some cmake scripts is making cmake a dependency. Uploading code with premake scripts is the same thing. Distributing your code with some package manager makes that package manager a dependency. Dependencies have cost, and there is no general all-purpose and ubiquitous tech that can be assumed available everywhere -- it doesn't exist.

I suggest you learn about CMake and vcpkg just to understand what they are about, but don't go into it with assumptions of their ubiquity or merit.

At the end of the day a header-only library can be copy + pasted into the customers project and included directly into their source without changing any build scripts. No dependencies needed.

Source: I own a fairly popular repo containing a bunch of header only libs, and don't use cmake, vcpkg, or anything like that: https://github.com/RandyGaul/cute_headers
« Last Edit: September 07, 2018, 04:51:33 PM by qMopey » Logged
JWki
Level 4
****


View Profile
« Reply #1263 on: September 07, 2018, 11:39:29 PM »

This is why I started just putting a premake executable in my projects root folder. No need to install or dload anything to run the buildscript, just run the local executable and done.
Logged
Pumpkinteractive
Level 0
**



View Profile
« Reply #1264 on: September 08, 2018, 01:36:03 AM »

Does anyone else experienced issues when trying to restart a scene in unity? Half of my stuff isn't working anymore, I use Scenemanager.Loadscene. Do I have to manually reset everything?
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1265 on: September 08, 2018, 07:34:40 AM »

@BorisTheBrave

Ah, thanks anyway. I guess they really want you to buy the book they promote on their website. It's a shame that more detailed info isn't freely available. And yeah, I'm assuming the procedure for a header-only lib wouldn't end up being very complex, but I still want to understand what I'm doing so I can rest easy knowing it'll work everywhere and why.

@qMopey

I asked for help about a technical problem, not an opinion paper on why I shouldn't use CMake or vcpkg in the first place. I have my reasons to use the tools I do, if you can't answer my question then please don't reply.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #1266 on: September 08, 2018, 08:09:47 AM »

I asked for help about a technical problem, not an opinion paper on why I shouldn't use CMake or vcpkg in the first place. I have my reasons to use the tools I do, if you can't answer my question then please don't reply.

Most technical problems are about opinions. You also asked to “get it”, which implies you need a high level description. No need to be snarky just because you don’t like the answer. Maybe you can revise your question to be more specific if you want a different answer.
Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1267 on: September 08, 2018, 08:43:36 AM »

Most technical problems are about opinions.
No. Technical problems are usually very specific and have a single optimal solution.

You also asked to “get it”, which implies you need a high level description.

I want to understand what CMake commands do under the hood and how they work together, not a general description of what the tool takes as input and gives as output like you gave me, which I already understand.

No need to be snarky just because you don’t like the answer.

You were snarky as well, so I feel like that's deserved. "it honestly sounds like you have some kind of silly idea that vcpkg is somehow important" was especially demeaning.

Maybe you can revise your question to be more specific if you want a different answer.

I want to know what CMake does behind the scenes so I can use it as something more than a black box that magically creates project files. I also want to publish my libraries using that tool and have the ability to download them myself using the package manager of my choice. Finally, I want to be able to apply that knowledge for future, more complicated projects because CMake is widely used, which renders your point about reducing dependencies moot.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #1268 on: September 08, 2018, 10:41:58 AM »

That’s all fine and dandy, but I put my time and energy into my post to help. Now I feel like coming back to this forum less, and certainly will be less likely to answer your questions for fear the effort will be wasted.
Logged
Crimsontide
Level 5
*****


View Profile
« Reply #1269 on: September 08, 2018, 12:13:57 PM »

While I understand how frustrating it can be spending more time arguing WHY you want to know how to do X or Y rather than learning the WHAT or HOW.  At the same time attacking the few attempting to help you probably won't help your cause either.
Logged
JWki
Level 4
****


View Profile
« Reply #1270 on: September 10, 2018, 12:08:13 AM »

Also consider that if all you want is in depth technical information, there's documentation about cmake, as well as various books that have been written about it. If you seek out information on a platform like this, you'll have to live with also getting "opinions" on your approach, since that is the nature of such a platform.

What you seem to be ignoring is that two people who have successfully published various header only libraries have raised concerns to your approach to that task. While you're perfectly entitled to preferring a certain toolchain and nobody here is telling you what to do, it's sometimes beneficial to not dismiss an opinion simply because you've made up your mind and decided to do something in a specific fashion, when the people disclosing their opinions to you here are both like-minded in that they have achieved similar task to what you're planning, as well as some possibly being potential users of the libraries you're planning to publish.

So take it or leave it, but since you said you were going to publish header-only libraries, if you're really familiar with the concept you shouldn't be surprised about having evoked some confusion as to why you're involving a complex build tool like cmake in that, when the concept of a single header library was conceived specifically to avoid having to deal with any of that - when I as a programmer see something advertised as a header only library, what I expect is, how did you put it, *very specific*: I expect to see a single file that I can copy the code out of, or that I can just download, include into a source file and it will work. I do *not* expect having to perform any additional configuration and I certainly do not expect having to fiddle with cmake in any way.
The snarky opinion piece you think you've received here is simply a response to the perception that you're approaching a task -  that some here have experience in successfully executing - in a less than optimal way, and as you said it yourself, technical problems often have a single optimal solution. The technical problem of distributing a single header library certainly does, and that solution is "make it compile and work without any configuration outside of the actual code when being included into a source file, then upload it to whatever service you want to publish it on". Idk about vcpkg but if it's just a package manager that can provide simple files then I don't see any problem with using it to distribute your libraries, however, and that's just my opinion man, but I can promise you that it will be shared by the majority of your potential user base, involving cmake into it is *not* a good idea. Learning a tool is not only about learning how it works and why it works that way, but also learning when and when not to use it, and your use case, unfortunately, is a prime example for when not to use it.

Now I'm sorry that I gave you another long snarky opinion piece, but I hope you gave it the benefit of the doubt and read all of it. I genuinely sympathize with being annoyed at someone for trying to tutor you about why you shouldn't be using what you're asking about because it's bad or whatever when all you want is an answer to a technical problem, however, as I hope I made clear in the monolith I typed out above, on a platform such as this you have a wide range of experience amongst the userbase, and some of them with a little bit more experience will sometimes come forward when they sense that someone might do good with a nudge in a different direction. Quite frankly, your question implies a certain inexperience, and that is completely fine, just try and consider that people might be trying to help you avoid mistakes they have made before, even when they might come across as opinionated and snarky.
« Last Edit: September 10, 2018, 12:17:27 AM by JWki » Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1271 on: September 10, 2018, 12:00:47 PM »

I know that there's technical documentation about CMake available on their website and that they sell several books. Technical documentation is not the same as a good tutorial though, and books have to be purchased and ordered, which is a major inconvenience. Even then, I said earlier in this thread that it seemed like buying their book was the only viable option, so I'll probably end up doing that anyway.

Plus, CMake really isn't the actual issue here. It's attitude.

I wasn't rude to BorisTheBrave earlier. He provided a link to a tutorial, expressed some justified doubt over my approach, and then suggested that I take a look at his own library for an alternate solution to my problem, which I did. However, I politely declined to use his method and reiterated that I wanted to learn CMake as a learning exercise, and not just for the purpose of publishing the libraries I'm working on. I even thanked him for his attempt at helping me, which wouldn't make much sense if I was just running out of patience from people being unable to help me.

But then I took offense to qMopey's post. And I didn't do that because his attempt at helping me wasn't fruitful. If that was the only thing that upset me, I would also have reacted badly to Boris's response. What actually upsets me about qMopey's post is not that his advice is unhelpful to me, it's that he's wording it in a condescending way. He doesn't just suggest that another way of distributing my libraries might be better for everyone, which would be a fair criticism, he also belittles me and my approach, which I find unacceptable. If you're giving advice to someone and you approach is to insult them and the way they do things, then you're doing things wrong, and you deserve some pushback.

This isn't about CMake or vcpkg or using #defines for configuring a library or header-only libraries, it's about being civil. I wasn't being disrespectful to anyone until someone took it upon themself to be disrespectful to me. I'm open to advice that is constructive and well constructed, even if it ends up being unhelpful. What I'm not open is language like this:

As for vcpkg it honestly sounds like you have some kind of silly idea that vcpkg is somehow important.

Which is insulting by the way it implies that I can't decide for myself what is important or not to me.

TL;DR - I'm upset at qMopey for being condescending, not for being unhelpful.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #1272 on: September 10, 2018, 12:22:15 PM »

I think you’re a fine forum member and I think the effort you put in around here is admirable. If you think my post was condescending then that’s my fault, since I could have worded it differently, and I apologize.
Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1273 on: September 10, 2018, 12:28:26 PM »

Hey, thanks for that, I appreciate you apology. And for what it's worth, I also apologize since I could have kept my cool a little better there. Confronting you in the actual thread was probably not the best course of action in retrospect.

Anyway, I'll just order the freaking book off of the CMake website and call this whole situation over, how does that sound?
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #1274 on: September 10, 2018, 12:29:12 PM »

I'm cool with that  Gentleman
Logged
Crimsontide
Level 5
*****


View Profile
« Reply #1275 on: September 10, 2018, 04:20:20 PM »

Awww... this is why I like this forum Smiley
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #1276 on: September 10, 2018, 04:26:56 PM »

Best admin award goes to
Logged

Ordnas
Level 10
*****



View Profile WWW
« Reply #1277 on: September 11, 2018, 12:12:03 AM »

Does anyone else experienced issues when trying to restart a scene in unity? Half of my stuff isn't working anymore, I use Scenemanager.Loadscene. Do I have to manually reset everything?

If the objects need to be persistent on different scenes then yes, you need to reset them, but usually it means you specified that objects to not be destroyed between scenes.
Logged

Games:

GenusNymphicus
Level 0
*



View Profile
« Reply #1278 on: September 12, 2018, 03:25:00 AM »

@ProgramGamer
I definitely feel your pain. There isn't a real standard and most examples use a mix between the old and modern style.
I spend a lot of time going through resources and reading the docs and just as much time trying to fix errors on my own.

Here are some resources that I found useful:
- basic modern skeleton github repo: https://github.com/reyreaud-l/simple-cpp-setup
- good talk on cmake and best practices with examples. Even covers header-only libraries at around the 29:25 mark:


- another modern cmake examples, showing how to create your config. https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
- do's and don'ts in modern cmake: https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1


I'm rewriting my CMake stuff right now, cause it got really messy after adding emscripten and android support. I'm by no means an expert, but maybe using my commented example setup might be helpful.

Lib:
ProjectRoot/CMakeLists.txt : https://pastebin.com/BaHRS6fE
ProjectRoot/src/cacGraphics/CMakeLists.txt: https://pastebin.com/ZRRe1y6k
ProojectRoot/cmake/CacatuidaeConfig.cmake: https://pastebin.com/XvcXwR1z


--------------
User:
UserProjectRoot/CmakeLists.txt: https://pastebin.com/LcmWFbWx
« Last Edit: September 12, 2018, 03:37:35 AM by GenusNymphicus » Logged
oahda
Level 10
*****



View Profile
« Reply #1279 on: September 21, 2018, 12:35:18 AM »

When doing memory pooling and the need arises to expand a pool, but another pool is taking up the space next to it, is it better to expand the first pool after the second one so as not to move anything, creating a gap between elements in the first pool, or to memmove the other pool "to the right" and expand the first one completely sequentially?

The memmove might be slow but only happen once; is it worth the tradeoff of breaking the sequence of the first pool? I'm still not completely savvy on cache hits…

The use case of the pools is to iterate through every element of one pool every frame.

A: [A|B|.....] > [A|B|A|...]

or

B: [A|B|.....] > [A A|B|...]

(the dots represent unused but already reserved memory)

I guess the ideal case is to just reserve enough memory to begin with so that this need never arises, but it would be nice to have at least during development so I don't have to adjust the number and recompile everything if I run out of space when building a level in my editor or something. Since I'm targeting many systems, including mobile, I want to be a bit conservative about space and not just reserve one or more gigs "just to be safe"? /:

How is it usually done?

I guess a third option is just putting A and B in completely separate places in their own pools… Any thoughts on that?
« Last Edit: September 21, 2018, 12:41:53 AM by Prinsessa » Logged

Pages: 1 ... 62 63 [64] 65 66 ... 69
Print
Jump to:  

Theme orange-lt created by panic