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