premake / premake-core

Premake

Home Page:https://premake.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the best way to incorporate CMake libraries as dependencies?

xjia1 opened this issue · comments

We have all of our projects using premake5, and all of them are checked into the same repository for version control.

We're also using a lot of libraries that are using CMake. Currently we build them out of the tree and copy include/**.h and lib/*.lib (yes, we're on Windows...) files over to our repository.

However, we are trying to check in 3rd-party library code as much as possible so it's easier to maintain and debug. So we'd like to find a way to easily incorporate CMake dependencies into premake5. We tried to manually translate CMake scripts, but that doesn't scale well enough, and is impossible to maintain when we upgrade those dependencies.

Is there a known way to solve this?

You can generate the CMake projects, and then generate your Premake projects and use externalproject. I'm going to assume that CMake still can't do multiple build configurations in a single project, so you'll probably also need to use configmap so you can map the Win32 Debug CMake project to the Win32 Debug Premake configuration, and so on.

Alternatively, if you're looking to continue to go down the path of just consuming the libs, you can just have Premake execute a script that generates and then builds the CMake projects?

commented

Write a premake5.lua for them ;)

Write a premake5.lua for them ;)

I'm not sure if you were trying to be funny here, but they specifically requested an alternative to this due to the issues with scale and maintainability.

@stfairy did my earlier comment help you resolve the issue?

@samsinsane Thanks for your comment! I didn't have time to try it out in the past month. Will try it soon :-)

Closing this due to inactivity, if you require further help please feel free to reopen this issue.

commented

@samsinsane this won't work if you use cmake project as submodule because usually (nearly always) developers ignore build directory and you need to build cmake separately from usual solution generation. Can remake handle it by itself?

@xahon You're going to need to provide a lot more detail about how this won't work. What does "developers ignore build directory" mean? What do you mean "you need to build cmake separately from usual solution generation", isn't that what I described above? Provide examples, describe a scenario that anyone without knowledge of CMake or Premake can follow.

Doesn't externalproject only work for visual studio only? What's the alternative for other IDEs?

@minh0722 There is nothing particularly special about externalproject(), it really just suppresses the creation of the project. If you're having trouble using it please open a different issue with more information.