build: Use registry files from vulkan-headers
authorMark Lobodzinski <mark@lunarg.com>
Wed, 13 Jun 2018 17:33:15 +0000 (11:33 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Thu, 14 Jun 2018 14:40:41 +0000 (08:40 -0600)
icd/CMakeLists.txt
scripts/kvt_genvk.py

index 3c4d17a..bb695c9 100644 (file)
@@ -9,8 +9,8 @@ set (PYTHON_CMD ${PYTHON_EXECUTABLE})
 # Define macro used for building vk.xml generated files
 macro(run_vk_xml_generate dependency output)
     add_custom_command(OUTPUT ${output}
-    COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/kvt_genvk.py -registry ${SCRIPTS_DIR}/vk.xml ${output}
-    DEPENDS ${SCRIPTS_DIR}/vk.xml ${SCRIPTS_DIR}/generator.py ${SCRIPTS_DIR}/${dependency} ${SCRIPTS_DIR}/kvt_genvk.py ${SCRIPTS_DIR}/reg.py
+    COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/kvt_genvk.py -registry ${VulkanRegistry_DIR}/vk.xml -scripts ${VulkanRegistry_DIR} ${output}
+    DEPENDS ${VulkanRegistry_DIR}/vk.xml ${VulkanRegistry_DIR}/generator.py ${SCRIPTS_DIR}/${dependency} ${SCRIPTS_DIR}/kvt_genvk.py ${VulkanRegistry_DIR}/reg.py
     )
 endmacro()
 
index 428d845..92d6939 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import argparse, cProfile, pdb, string, sys, time
-from reg import *
-from generator import write
-from cgenerator import CGeneratorOptions, COutputGenerator
-# Generator Modifications
-from mock_icd_generator import MockICDGeneratorOptions, MockICDOutputGenerator
-from vulkan_tools_helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions
+import argparse, cProfile, pdb, string, sys, time, os
 
 # Simple timer functions
 startTime = None
@@ -283,8 +277,24 @@ if __name__ == '__main__':
     parser.add_argument('-verbose', action='store_false', dest='quiet', default=True,
                         help='Enable script output during normal execution.')
 
+    # This argument tells us where to load the script from the Vulkan-Headers registry
+    parser.add_argument('-scripts', action='store',
+                        help='Find additional scripts in this directory')
+
     args = parser.parse_args()
 
+    scripts_directory_path = os.path.dirname(os.path.abspath(__file__))
+    registry_headers_path = os.path.join(scripts_directory_path, args.scripts)
+    sys.path.insert(0, registry_headers_path)
+
+    from reg import *
+    from generator import write
+    from cgenerator import CGeneratorOptions, COutputGenerator
+
+    # Generator Modifications
+    from mock_icd_generator import MockICDGeneratorOptions, MockICDOutputGenerator
+    from vulkan_tools_helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions
+
     # This splits arguments which are space-separated lists
     args.feature = [name for arg in args.feature for name in arg.split()]
     args.extension = [name for arg in args.extension for name in arg.split()]