1fd4e5da5Sopenharmony_ci# Copyright (c) 2016 LunarG Inc. 2fd4e5da5Sopenharmony_ci# 3fd4e5da5Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 4fd4e5da5Sopenharmony_ci# you may not use this file except in compliance with the License. 5fd4e5da5Sopenharmony_ci# You may obtain a copy of the License at 6fd4e5da5Sopenharmony_ci# 7fd4e5da5Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 8fd4e5da5Sopenharmony_ci# 9fd4e5da5Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 10fd4e5da5Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 11fd4e5da5Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fd4e5da5Sopenharmony_ci# See the License for the specific language governing permissions and 13fd4e5da5Sopenharmony_ci# limitations under the License. 14fd4e5da5Sopenharmony_ci 15fd4e5da5Sopenharmony_ci# Install a script for use with the auto-compression feature of emacs(1). 16fd4e5da5Sopenharmony_ci# Upon loading a file with the .spv extension, the file will be disassembled 17fd4e5da5Sopenharmony_ci# using spirv-dis, and the result colorized with asm-mode in emacs. The file 18fd4e5da5Sopenharmony_ci# may be edited within the constraints of validity, and when re-saved will be 19fd4e5da5Sopenharmony_ci# re-assembled using spirv-as. 20fd4e5da5Sopenharmony_ci 21fd4e5da5Sopenharmony_ci# It is required that those tools be in your PATH. If that is not the case 22fd4e5da5Sopenharmony_ci# when starting emacs, the path can be modified as in this example: 23fd4e5da5Sopenharmony_ci# (setenv "PATH" (concat (getenv "PATH") ":/path/to/spirv/tools")) 24fd4e5da5Sopenharmony_ci# 25fd4e5da5Sopenharmony_ci# See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 26fd4e5da5Sopenharmony_ci 27fd4e5da5Sopenharmony_ci# This is an absolute directory, and ignores CMAKE_INSTALL_PREFIX, or 28fd4e5da5Sopenharmony_ci# it will not be found by emacs upon startup. It is only installed if 29fd4e5da5Sopenharmony_ci# both of the following are true: 30fd4e5da5Sopenharmony_ci# 1. SPIRV_TOOLS_INSTALL_EMACS_HELPERS is defined 31fd4e5da5Sopenharmony_ci# 2. The directory /etc/emacs/site-start.d already exists at the time of 32fd4e5da5Sopenharmony_ci# cmake invocation (not at the time of make install). This is 33fd4e5da5Sopenharmony_ci# typically true if emacs is installed on the system. 34fd4e5da5Sopenharmony_ci 35fd4e5da5Sopenharmony_ci# Note that symbol IDs are not preserved through a load/edit/save operation. 36fd4e5da5Sopenharmony_ci# This may change if the ability is added to spirv-as. 37fd4e5da5Sopenharmony_ci 38fd4e5da5Sopenharmony_cioption(SPIRV_TOOLS_INSTALL_EMACS_HELPERS 39fd4e5da5Sopenharmony_ci "Install Emacs helper to disassemble/assemble SPIR-V binaries on file load/save." 40fd4e5da5Sopenharmony_ci ${SPIRV_TOOLS_INSTALL_EMACS_HELPERS}) 41fd4e5da5Sopenharmony_ciif (${SPIRV_TOOLS_INSTALL_EMACS_HELPERS}) 42fd4e5da5Sopenharmony_ci if(EXISTS /etc/emacs/site-start.d) 43fd4e5da5Sopenharmony_ci if(ENABLE_SPIRV_TOOLS_INSTALL) 44fd4e5da5Sopenharmony_ci install(FILES 50spirv-tools.el DESTINATION /etc/emacs/site-start.d) 45fd4e5da5Sopenharmony_ci endif(ENABLE_SPIRV_TOOLS_INSTALL) 46fd4e5da5Sopenharmony_ci endif() 47fd4e5da5Sopenharmony_ciendif() 48fd4e5da5Sopenharmony_ci 49