dfranx / SHADERed

Lightweight, cross-platform & full-featured shader IDE
https://shadered.org/
MIT License
4.32k stars 272 forks source link

Use CMake #1

Closed feliwir closed 5 years ago

feliwir commented 5 years ago

Remove the Visual Studio projects and add a CMake build. This allows cross platform compilation. I'd be willing to contribute that if accepted

dfranx commented 5 years ago

Is cmake a viable option right now? Because SHADERed currently only works on Windows and uses Direct3D 11 (I plan to port it to Linux this year though).

JesseTG commented 5 years ago

CMake has been a viable option for years. You'll be fine.

dfranx commented 5 years ago

Okay! There will be a cmake file when I release OpenGL port (in couple of weeks).

dfranx commented 5 years ago

Hey @feliwir . I just pushed a big commit which includes CMakeLists.txt . As I am fairly new to cmake I would be very happy if you could check if everything is how it is supposed to be/working properly.

I also want to mention that cmake currently also includes some modules that shouldn't be included (like glslangValidator or SPIR-V remap). Not sure if that can be prevented from within my CMakeLists.txt file or if I have to fork the KhronosGroup/glslang and modified their cmake file.

Also, with the new update SHADERed works on Linux too (I need to fix some bugs though + implement some features).

feliwir commented 5 years ago

Hey @dfranx i added some comments to your commit. To fix your glsllang problem you can probably set ENABLE_GLSLANG_BINARIES to FALSE before inlcuding the subdirectory.

dfranx commented 5 years ago

Just pushed a commit that applies all of the things you mentioned in the comments + ENABLE_GLSLANG_BINARIES option.

feliwir commented 5 years ago

I am missing glm headers when building on Linux. Your CMake setup doesn't seem to look for it.

dfranx commented 5 years ago

Thanks for reporting! Fix for this will be included in the next commit.

dfranx commented 5 years ago

Could you try compiling the program again? I have added GLM to the cmake file.

feliwir commented 5 years ago

@dfranx it still doesn't work. You can't use find_package(glm REQUIRED), since there is no findscript and glm doesn't provide a config script either. I recommend adding glm as a submodule and just do target_include_directories on the submodule dir. Alternatively you could put a FindGLM.cmake script into your module directory (e.g. FindGLM.cmake). This would require you to set CMAKE_MODULE_PATH See here for an example: https://github.com/feliwir/arda/blob/master/src/CMakeLists.txt#L67

dfranx commented 5 years ago

@feliwir thanks for reporting that. I have just added FindGLM.cmake script in one of the commits. Can't test it really because GLM library installed through vcpkg has the config file and for some reason it works normally on Linux too (I assume it also has the config file?).. Please reply back if you have now managed to compile SHADERed! :D