Quellcode durchsuchen

[cmake] Add dx12.hdll to build (#564)

tobil4sk vor 11 Monaten
Ursprung
Commit
b711d4d45d
2 geänderte Dateien mit 52 neuen und 28 gelöschten Zeilen
  1. 1 4
      libs/CMakeLists.txt
  2. 51 24
      libs/directx/CMakeLists.txt

+ 1 - 4
libs/CMakeLists.txt

@@ -10,10 +10,7 @@ function(set_as_hdll target)
 endfunction()
 
 if(WIN32)
-    option(WITH_DIRECTX "Build directx.hdll." ON)
-    if(WITH_DIRECTX)
-        add_subdirectory(directx)
-    endif()
+    add_subdirectory(directx)
 endif()
 
 option(WITH_FMT "Build fmt.hdll." ON)

+ 51 - 24
libs/directx/CMakeLists.txt

@@ -1,24 +1,51 @@
-find_package(DirectX)
-
-add_library(directx.hdll SHARED
-    directx.cpp
-    gamecontroller.c
-    window.c
-)
-
-set_as_hdll(directx)
-
-target_link_libraries(directx.hdll
-    libhl
-    d3d11
-    dxgi
-    d3dcompiler
-    xinput9_1_0
-    dinput8
-)
-
-install(
-    TARGETS
-        directx.hdll
-    DESTINATION ${HDLL_DESTINATION}
-)
+option(WITH_DIRECTX "Build directx.hdll." ON)
+
+if(WITH_DIRECTX)
+    find_package(DirectX)
+
+    add_library(directx.hdll SHARED
+        directx.cpp
+        gamecontroller.c
+        window.c
+    )
+
+    set_as_hdll(directx)
+
+    target_link_libraries(directx.hdll
+        libhl
+        d3d11
+        dxgi
+        d3dcompiler
+        xinput9_1_0
+        dinput8
+    )
+
+    install(
+        TARGETS
+            directx.hdll
+        DESTINATION ${HDLL_DESTINATION}
+    )
+endif()
+
+option(WITH_DX12 "Build dx12.hdll." ON)
+
+if(WITH_DX12)
+    add_library(dx12.hdll SHARED
+        dx12.cpp
+    )
+
+    set_as_hdll(dx12)
+
+    target_link_libraries(dx12.hdll
+        libhl
+        d3d12
+        dxgi
+        dxcompiler
+    )
+
+    install(
+        TARGETS
+            dx12.hdll
+        DESTINATION ${HDLL_DESTINATION}
+    )
+endif()