dfranx / SHADERed

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

The CMake install target doesn't install SHADERed binaries #33

Closed Calinou closed 4 years ago

Calinou commented 4 years ago

When I install the project (from commit https://github.com/dfranx/SHADERed/commit/624e77c18837bd2cfd94d07b2046e45f6aad5a28) using CMake 3.14.5 on Fedora 31, I noticed headers are being installed but not the SHADERed binary (and associated resource folders):

❯ sudo cmake --build build --target install
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib64/libglslang.a
-- Installing: /usr/local/include/glslang/Public/ShaderLang.h
-- Installing: /usr/local/include/glslang/Include/arrays.h
-- Installing: /usr/local/include/glslang/Include/BaseTypes.h
-- Installing: /usr/local/include/glslang/Include/Common.h
-- Installing: /usr/local/include/glslang/Include/ConstantUnion.h
-- Installing: /usr/local/include/glslang/Include/InfoSink.h
-- Installing: /usr/local/include/glslang/Include/InitializeGlobals.h
-- Installing: /usr/local/include/glslang/Include/intermediate.h
-- Installing: /usr/local/include/glslang/Include/PoolAlloc.h
-- Installing: /usr/local/include/glslang/Include/ResourceLimits.h
-- Installing: /usr/local/include/glslang/Include/revision.h
-- Installing: /usr/local/include/glslang/Include/ShHandle.h
-- Installing: /usr/local/include/glslang/Include/Types.h
-- Installing: /usr/local/include/glslang/MachineIndependent/attribute.h
-- Installing: /usr/local/include/glslang/MachineIndependent/glslang_tab.cpp.h
-- Installing: /usr/local/include/glslang/MachineIndependent/gl_types.h
-- Installing: /usr/local/include/glslang/MachineIndependent/Initialize.h
-- Installing: /usr/local/include/glslang/MachineIndependent/iomapper.h
-- Installing: /usr/local/include/glslang/MachineIndependent/LiveTraverser.h
-- Installing: /usr/local/include/glslang/MachineIndependent/localintermediate.h
-- Installing: /usr/local/include/glslang/MachineIndependent/ParseHelper.h
-- Installing: /usr/local/include/glslang/MachineIndependent/reflection.h
-- Installing: /usr/local/include/glslang/MachineIndependent/RemoveTree.h
-- Installing: /usr/local/include/glslang/MachineIndependent/Scan.h
-- Installing: /usr/local/include/glslang/MachineIndependent/ScanContext.h
-- Installing: /usr/local/include/glslang/MachineIndependent/SymbolTable.h
-- Installing: /usr/local/include/glslang/MachineIndependent/Versions.h
-- Installing: /usr/local/include/glslang/MachineIndependent/parseVersions.h
-- Installing: /usr/local/include/glslang/MachineIndependent/propagateNoContraction.h
-- Installing: /usr/local/include/glslang/MachineIndependent/preprocessor/PpContext.h
-- Installing: /usr/local/include/glslang/MachineIndependent/preprocessor/PpTokens.h
-- Installing: /usr/local/lib64/libOSDependent.a
-- Installing: /usr/local/lib64/libOGLCompiler.a
-- Installing: /usr/local/lib64/libSPIRV.a
-- Installing: /usr/local/include/glslang/SPIRV/bitutils.h
-- Installing: /usr/local/include/glslang/SPIRV/spirv.hpp
-- Installing: /usr/local/include/glslang/SPIRV/GLSL.std.450.h
-- Installing: /usr/local/include/glslang/SPIRV/GLSL.ext.EXT.h
-- Installing: /usr/local/include/glslang/SPIRV/GLSL.ext.KHR.h
-- Installing: /usr/local/include/glslang/SPIRV/GlslangToSpv.h
-- Installing: /usr/local/include/glslang/SPIRV/hex_float.h
-- Installing: /usr/local/include/glslang/SPIRV/Logger.h
-- Installing: /usr/local/include/glslang/SPIRV/SpvBuilder.h
-- Installing: /usr/local/include/glslang/SPIRV/spvIR.h
-- Installing: /usr/local/include/glslang/SPIRV/doc.h
-- Installing: /usr/local/include/glslang/SPIRV/SpvTools.h
-- Installing: /usr/local/include/glslang/SPIRV/disassemble.h
-- Installing: /usr/local/include/glslang/SPIRV/GLSL.ext.AMD.h
-- Installing: /usr/local/include/glslang/SPIRV/GLSL.ext.NV.h
-- Installing: /usr/local/include/glslang/SPIRV/SPVRemapper.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/doc.h
-- Installing: /usr/local/lib64/libHLSL.a

It would be good if SHADERed could be installed system-wide using CMake. This would make it easier to integrate it into Linux distributions or Flatpak.

dfranx commented 4 years ago

@Calinou sorry for asking such questions, but where are resource files supposed to be installed?

For example, /usr/local/bin/ is where the binary will be, but where should all the resource files go?

Calinou commented 4 years ago

@dfranx I think they should go to a path like /usr/local/share/shadered. The application code should check for resources in this path after attempting to load data in the current working directory.

Also, don't hardcode /usr/local, use the CMAKE_INSTALL_PREFIX variable and make it default to /usr/local. This way, the prefix can be customized depending on the use case. For instance, Linux distribution packages will use /usr instead of /usr/local.

dfranx commented 4 years ago

@Calinou thanks for help! I've pushed a commit that contains implementation for this but I am not completely sure if it works properly/if it is a proper implementation so could you please test it? :smiley:

Calinou commented 4 years ago

@dfranx It seems to be working well :+1:

Here's the install log for reference:

-- Install configuration: "Release"
-- Installing: /usr/local/bin/SHADERed
-- Installing: /usr/local/share/SHADERed/data
-- Installing: /usr/local/share/SHADERed/data/icofont.ttf
-- Installing: /usr/local/share/SHADERed/data/shortcuts.kb
-- Installing: /usr/local/share/SHADERed/data/workspace.dat
-- Installing: /usr/local/share/SHADERed/data/inconsolata.ttf
-- Installing: /usr/local/share/SHADERed/data/NotoSans.ttf
-- Installing: /usr/local/share/SHADERed/data/gui.dat
-- Installing: /usr/local/share/SHADERed/data/gizmo.obj
-- Installing: /usr/local/share/SHADERed/data/settings.ini
-- Installing: /usr/local/share/SHADERed/data/preload.dat
-- Installing: /usr/local/share/SHADERed/templates
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/template.sprj
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/shaders
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/shaders/ProcessingVS.hlsl
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/shaders/SimplePS.hlsl
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/shaders/SimpleVS.hlsl
-- Installing: /usr/local/share/SHADERed/templates/DeferredRendering/shaders/ProcessingPS.hlsl
-- Installing: /usr/local/share/SHADERed/templates/GLSL
-- Installing: /usr/local/share/SHADERed/templates/GLSL/template.sprj
-- Installing: /usr/local/share/SHADERed/templates/GLSL/shaders
-- Installing: /usr/local/share/SHADERed/templates/GLSL/shaders/SimplePS.glsl
-- Installing: /usr/local/share/SHADERed/templates/GLSL/shaders/SimpleVS.glsl
-- Installing: /usr/local/share/SHADERed/templates/HLSL
-- Installing: /usr/local/share/SHADERed/templates/HLSL/template.sprj
-- Installing: /usr/local/share/SHADERed/templates/HLSL/shaders
-- Installing: /usr/local/share/SHADERed/templates/HLSL/shaders/SimplePS.hlsl
-- Installing: /usr/local/share/SHADERed/templates/HLSL/shaders/SimpleVS.hlsl
-- Installing: /usr/local/share/SHADERed/themes
-- Installing: /usr/local/share/SHADERed/themes/corporategray.ini
-- Installing: /usr/local/share/SHADERed/themes/lightgreen.ini
-- Installing: /usr/local/share/SHADERed/themes/cherry.ini
-- Installing: /usr/local/share/SHADERed/themes/gray.ini
-- Installing: /usr/local/share/SHADERed/themes/dracula.ini
-- Installing: /usr/local/lib64/libglslang.a
-- Up-to-date: /usr/local/include/glslang/Public/ShaderLang.h
-- Up-to-date: /usr/local/include/glslang/Include/arrays.h
-- Up-to-date: /usr/local/include/glslang/Include/BaseTypes.h
-- Up-to-date: /usr/local/include/glslang/Include/Common.h
-- Up-to-date: /usr/local/include/glslang/Include/ConstantUnion.h
-- Up-to-date: /usr/local/include/glslang/Include/InfoSink.h
-- Up-to-date: /usr/local/include/glslang/Include/InitializeGlobals.h
-- Up-to-date: /usr/local/include/glslang/Include/intermediate.h
-- Up-to-date: /usr/local/include/glslang/Include/PoolAlloc.h
-- Up-to-date: /usr/local/include/glslang/Include/ResourceLimits.h
-- Up-to-date: /usr/local/include/glslang/Include/revision.h
-- Up-to-date: /usr/local/include/glslang/Include/ShHandle.h
-- Up-to-date: /usr/local/include/glslang/Include/Types.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/attribute.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/glslang_tab.cpp.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/gl_types.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/Initialize.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/iomapper.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/LiveTraverser.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/localintermediate.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/ParseHelper.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/reflection.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/RemoveTree.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/Scan.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/ScanContext.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/SymbolTable.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/Versions.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/parseVersions.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/propagateNoContraction.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/preprocessor/PpContext.h
-- Up-to-date: /usr/local/include/glslang/MachineIndependent/preprocessor/PpTokens.h
-- Installing: /usr/local/lib64/libOSDependent.a
-- Installing: /usr/local/lib64/libOGLCompiler.a
-- Installing: /usr/local/bin/glslangValidator
-- Installing: /usr/local/bin/spirv-remap
-- Installing: /usr/local/lib64/libSPVRemapper.a
-- Installing: /usr/local/lib64/libSPIRV.a
-- Up-to-date: /usr/local/include/glslang/SPIRV/bitutils.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/spirv.hpp
-- Up-to-date: /usr/local/include/glslang/SPIRV/GLSL.std.450.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/GLSL.ext.EXT.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/GLSL.ext.KHR.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/GlslangToSpv.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/hex_float.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/Logger.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/SpvBuilder.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/spvIR.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/doc.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/SpvTools.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/disassemble.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/GLSL.ext.AMD.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/GLSL.ext.NV.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/SPVRemapper.h
-- Up-to-date: /usr/local/include/glslang/SPIRV/doc.h
-- Installing: /usr/local/lib64/libHLSL.a

Also, I think it'd be better to use shadered as a folder/binary name rather than SHADERed. This way, it's easier to type to run it from a terminal (as Linux filesystems are case-sensitive).

dfranx commented 4 years ago

@Calinou sure! It should now install SHADERed as "shadered" (in lowercase). Well, glad it works! I guess I can close this issue then..

Also, maybe I should try to make it not to install glslang related stuff... Not sure how to do that right now though.