mosra / magnum-bootstrap

Bootstrap projects for the Magnum C++11 graphics engine
https://magnum.graphics/
The Unlicense
92 stars 37 forks source link

Build Output Directories #12

Closed kklouzal closed 6 years ago

kklouzal commented 6 years ago

Currently the build output is scattered deep into the project tree which makes it difficult for new users and/or to setup a new project.

BootStrap\magnum\src\Magnum\Release
BootStrap\corrade\src\Corrade\Utility\Release
BootStrap\corrade\src\Corrade\PluginManager\Release

As you know, those directories contain the .lib and .dll files required for the bootstrap "MyApplication". As a new user finding these files proved a bit difficult. As projects grow in size, requiring more features, the complexity of setting up your project increases.

Could you consider making bootstrap generate project files to dump the build output into a unified folder?

BootStrap\build\bin
BootStrap\build\lib

This allows users to set their projects up to use these directories then when more features are required just build them and copy over the .dll; No need to add more paths to the project and dig through folders for the output.

Thank you for your time and dedication to this project!

mosra commented 6 years ago

Hey, thanks for the appreciation! :)

This is all meant to be handled by the install target generated by CMake. From my experience I know this is quite a common thing for Linux developers while sounding unusual and strange to developers on Windows (and on the other hand, coming from Linux, I'm often bewildered that Visual Studio projects usually don't have such "install" targets).

All that this target does (it's also shown as INSTALL in the Visual Studio project tree) is extracting all the relevant files (which is not just the *.lib/*.dll binaries, but also all headers, CMake modules and other random files) to some directory that you can choose with the CMAKE_INSTALL_PREFIX variable. CMake defaults it to C:/Program Files/<something>, which is quite an unfortunate choice, so I advise changing it to something other.

Another possibility is to override the library/runtime/... output directories using CMAKE_*_OUTPUT_DIRECTORY when configuring the project to achieve precisely what you asked above. However, I'd like to keep the choice and flexibility in the hands of the users, so I won't hardcode that in the project -- they might need a different structure and this would break it for them.

I updated the Getting Started Guide at http://doc.magnum.graphics/magnum/getting-started.html#getting-started-windows and improved the Windows-specific build instructions (though at the moment I have no possibility to verify that they actually work, ahem). Would that be okay this way?

kklouzal commented 6 years ago

Oh yes that sounds perfectly reasonable, running the 'install' project which copies out the headers/libraries/dlls to a specified folder setup within cmake. Sounds good to me 👍

Thank you again for all your hard work!

mosra commented 6 years ago

Great :)