changeset 473:04b8471bdab4

did: cleanup up a bit
author Sam <sam@basx.dev>
date Tue, 27 Dec 2022 20:47:48 +0700
parents af43f2acf2b9
children d4750f2e0760
files Makefile examples/hello_triangle.nim examples/test.nim src/platform/linux/symkey_map.nim src/vulkan_helpers.nim
diffstat 5 files changed, 32 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Dec 24 22:38:09 2022 +0700
+++ b/Makefile	Tue Dec 27 20:47:48 2022 +0700
@@ -6,32 +6,35 @@
 WINDOWS_RELEASE_OPTIONS := --cc:vcc --passC:'/MD' --passL:'ucrt.lib' 
 
 # build
-build/debug/linux/test: ${SOURCES}
+build/debug/linux/hello_triangle: ${SOURCES}
 	mkdir -p $$( dirname $@ )
-	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} -o:$@ examples/test.nim
-build/release/linux/test: ${SOURCES}
+	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
+build/release/linux/hello_triangle: ${SOURCES}
 	mkdir -p $$( dirname $@ )
-	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} -o:$@ examples/test.nim
-build/debug/windows/test.exe:  ${SOURCES}
+	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim
+build/debug/windows/hello_triangle.exe:  ${SOURCES}
 	mkdir -p $$( dirname $@ )
-	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} ${WINDOWS_DEBUG_OPTIONS} -o:$@ examples/test.nim
-build/release/windows/test.exe: ${SOURCES}
+	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} ${WINDOWS_DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
+build/release/windows/hello_triangle.exe: ${SOURCES}
 	mkdir -p $$( dirname $@ )
-	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} ${WINDOWS_RELEASE_OPTIONS} -o:$@ examples/test.nim
+	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} ${WINDOWS_RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim
 
-build_all_linux: build/debug/linux/test build/release/linux/test
-build_all_windows: build/debug/windows/test.exe build/release/windows/test.exe
+build_all_linux: build/debug/linux/hello_triangle build/release/linux/hello_triangle
+build_all_windows: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe
 
 build_all: build_all_linux build_all_windows
 
+clean:
+	rm -rf build
+
 # publish
-publish_linux_debug: build/debug/linux/test
+publish_linux_debug: build/debug/linux/hello_triangle
 	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
-publish_linux_release: build/release/linux/test
+publish_linux_release: build/release/linux/hello_triangle
 	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
-publish_windows_debug: build/debug/linux/test
+publish_windows_debug: build/debug/linux/hello_triangle
 	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
-publish_windows_release: build/release/linux/test
+publish_windows_release: build/release/linux/hello_triangle
 	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/
 
 publish_all: publish_linux_debug publish_linux_release publish_windows_debug publish_windows_release
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/hello_triangle.nim	Tue Dec 27 20:47:48 2022 +0700
@@ -0,0 +1,7 @@
+import engine
+
+
+when isMainModule:
+  var myengine = igniteEngine()
+  myengine.fullThrottle()
+  myengine.trash()
--- a/examples/test.nim	Sat Dec 24 22:38:09 2022 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-import engine
-
-
-when isMainModule:
-  var myengine = igniteEngine()
-  myengine.fullThrottle()
-  myengine.trash()
--- a/src/platform/linux/symkey_map.nim	Sat Dec 24 22:38:09 2022 +0700
+++ b/src/platform/linux/symkey_map.nim	Tue Dec 27 20:47:48 2022 +0700
@@ -2,7 +2,7 @@
 export tables
 
 import x11/keysym
-import x11/x
+# import x11/x
 
 import ../../events
 
--- a/src/vulkan_helpers.nim	Sat Dec 24 22:38:09 2022 +0700
+++ b/src/vulkan_helpers.nim	Tue Dec 27 20:47:48 2022 +0700
@@ -129,32 +129,23 @@
 
 proc createVulkanInstance*(vulkanVersion: uint32): VkInstance =
 
+  var requiredExtensions = @["VK_KHR_surface".cstring]
   when defined(linux):
-    var requiredExtensions = [
-      # "VK_EXT_acquire_xlib_display".cstring,
-      # "VK_EXT_direct_mode_display".cstring,
-      # "VK_KHR_display".cstring,
-      "VK_KHR_surface".cstring,
-      "VK_KHR_xlib_surface".cstring,
-      "VK_EXT_debug_utils".cstring,
-    ]
+    requiredExtensions.add("VK_KHR_xlib_surface".cstring)
   when defined(windows):
-    var requiredExtensions = [
-      "VK_KHR_win32_surface".cstring,
-      #"VK_KHR_display".cstring,
-      "VK_KHR_surface".cstring,
-      "VK_EXT_debug_utils".cstring,
-    ]
+    requiredExtensions.add("VK_KHR_win32_surface".cstring)
+  when ENABLEVULKANVALIDATIONLAYERS:
+    requiredExtensions.add("VK_EXT_debug_utils".cstring)
   
   let availableExtensions = getInstanceExtensions()
   for extension in requiredExtensions:
     assert $extension in availableExtensions, $extension
 
-  let desiredLayers = ["VK_LAYER_KHRONOS_validation".cstring, "VK_LAYER_MESA_overlay".cstring]
   let availableLayers = getValidationLayers()
   var usableLayers = newSeq[cstring]()
 
   when ENABLEVULKANVALIDATIONLAYERS:
+    const desiredLayers = ["VK_LAYER_KHRONOS_validation".cstring, "VK_LAYER_MESA_overlay".cstring]
     for layer in desiredLayers:
       if $layer in availableLayers:
         usableLayers.add(layer)
@@ -176,7 +167,7 @@
     enabledLayerCount: usableLayers.len.uint32,
     ppEnabledLayerNames: cast[ptr UncheckedArray[cstring]](addrOrNil(usableLayers)),
     enabledExtensionCount: requiredExtensions.len.uint32,
-    ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions))
+    ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions[0]))
   )
   checkVkResult vkCreateInstance(addr(createinfo), nil, addr(result))