spookyboo / HLMSEditor

High Level Material Shader editor
79 stars 25 forks source link

Fix CMakeLists files #5

Closed Ybalrid closed 7 years ago

Ybalrid commented 7 years ago

It's probably easier and cleaner to do some globbing to get the list of header and source files "from disk" instead of listing them by hand.

Here's a proposed fix of the CMakeLists file. It will generate a working makefile on linux, automatically running Qt's MOC and should work the same way on Windows.

Signed-off-by: Arthur Brainville (Ybalrid) ybalrid@ybalrid.info

Ybalrid commented 7 years ago

I'm still tweaking things, currently the generated configuration is invalid when building in Debug mode. Seems that it doesn't define _DEBUG, for example, and I have some weird crashes I'm investigating...

I'm working on this because it's better to have an IDE independent way of building the program, even if I see the appeal of working with QtCreator while developing with the Qt Framework 😉

Ybalrid commented 7 years ago

Speaking of Qt; I think the only thing the generated cmake file lacks is the packaged resources (notably the dark Qt style-sheet used here; and all the icons)

I have other code problem that needed fixing to get a program that actually works with GCC on Linux. I'm making individual PR for you to review. I suggest you to merge #4 and #6 before looking at this one.

Ybalrid commented 7 years ago

screenshot from 2017-04-15 10-20-04 For some reason it doesn't want to load the icons right now, and the program crashes when trying to open any file dialog, but it's starting to work \o/

Edit: Regarding the "program crashed when opening a file dialog* problem, it seems to come from some kind of incompatibility between Qt, Gtk, GNOME and specifically (X)Wayland. So it's a runtime/library problem

Edit2: Regarding the "no icons" problem, it's also a runtime/library issue, regarding libPNG on my system. I built OGRE using the official "Ogredeps" repository, that has a version of FreeImage that is built with the wrong version of LibPNG. Not a problem from the code source of the editor, or the linkage generated from CMake either.

Ybalrid commented 7 years ago

I can confirm that this CMakeLists.txt will work on any Qt 5 + Ogre 21 installation that isn't too much broken 😉

FreeImage contains statically the whole code of libPNG, libJPEG and things along thoses lines. Ogre distribute in the "ogredeps" package an outdated version of freeimage with an outdated version of libpng. Qt also depend on libpng. And mixing 2 different version result in breakage 😝

At this point, everything should be good to go, I may add the copy code for the required files on the WIN32 side too. This let the user build the binaries everywhere he may want.

spookyboo commented 7 years ago

Good work. I will look at your pull requests (somewhere in the coming days). Note, that I'm, currently on Ogre 2.1 commit e554a9dd9f9 (April 11). It has a small breaking interface.

Ybalrid commented 7 years ago

By chance I'm also building from e55f4a9dd9f901c062d830743fb660059f09f313 on Linux.

And all the good works goes to you, I just fixed a few things here and there, and make it easier to build, at least on Linux. 😛

I have yet to check the state of that CMake file on Windows (don't feel like rebooting and rebuilding Ogre right now), but letting CMake find the sources and headers was the main fix here.

These old texture I got from the Ogre SDK here are probably not good for PBR, but basic functionality is working:

screenshot from 2017-04-15 15-20-04

The only good materials I was able to stick inside Ogre 2.1 were exported (then tweaked by hand) from Substance Designer/Painter. But having something "similar" but Free Software is a must :wink:

spookyboo commented 7 years ago

I am using the ones from http://freepbr.com/

Ybalrid commented 7 years ago

Awesome, I'm keeping that link!

Ybalrid commented 7 years ago

I've done some adjustments to get the cmake build work on windows like a charm. It wasn't setting a valid include path for rapidjison explicitely, for example.

It should work on windows with a few environement varialbe (or CMake cache variables) set on Windows.

I may suggest to put the following informations on the README or on the Documentation :


That should be enough. Basically the same deal as building Ogre itself on Windows with CMake, it's easier to use the GUI and set the missing paths, or set all the good environment variables in the system.