2023-02-04 19:18:34 +11:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
2023-02-03 15:38:23 +11:00
|
|
|
project(native-spirv-to-dxil)
|
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
# need python
|
|
|
|
find_package(Python COMPONENTS Interpreter REQUIRED)
|
|
|
|
if(DEFINED ENV{VIRTUAL_ENV} OR DEFINED ENV{CONDA_PREFIX})
|
|
|
|
set(_pip_args)
|
|
|
|
else()
|
|
|
|
set(_pip_args "--user")
|
|
|
|
endif()
|
|
|
|
|
2023-02-03 19:14:11 +11:00
|
|
|
find_program(PIP_EXE pip)
|
|
|
|
if(PIP_EXE STREQUAL "PIP_EXE-NOTFOUND")
|
|
|
|
message(FATAL_ERROR "pip required")
|
|
|
|
endif(PIP_EXE STREQUAL "PIP_EXE-NOTFOUND")
|
2023-02-03 15:38:23 +11:00
|
|
|
|
2023-02-03 19:14:11 +11:00
|
|
|
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install mako)
|
2023-02-03 15:38:23 +11:00
|
|
|
|
2023-02-03 19:14:11 +11:00
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} MESON_BUILD_TYPE)
|
2023-02-03 15:38:23 +11:00
|
|
|
|
|
|
|
set(MESA_EXTRA_FLAGS
|
2023-02-03 19:14:11 +11:00
|
|
|
-Dbuildtype=${MESON_BUILD_TYPE}
|
2023-02-03 19:20:05 +11:00
|
|
|
# enable spirv-to-dxil (obviously)
|
|
|
|
-Dspirv-to-dxil=true
|
2023-02-03 19:14:11 +11:00
|
|
|
# force zink because we want libvulkan_util
|
|
|
|
-Dgallium-drivers=zink
|
2023-02-03 19:20:05 +11:00
|
|
|
# set min-windows-version to 7 to remove need to link against synchronization.lib (we don't need futexes for the compiler)
|
|
|
|
-Dmin-windows-version=7
|
|
|
|
# disable everything we don't need.
|
2023-02-03 19:14:11 +11:00
|
|
|
-Dvulkan-drivers=
|
|
|
|
-Dopengl=false
|
2023-02-03 15:38:23 +11:00
|
|
|
-Dglx=disabled
|
2023-02-03 19:14:11 +11:00
|
|
|
-Dmicrosoft-clc=disabled
|
|
|
|
-Dgallium-d3d12-video=disabled
|
2023-02-03 15:38:23 +11:00
|
|
|
-Dgbm=disabled
|
|
|
|
-Degl=disabled
|
|
|
|
-Dgles1=disabled
|
|
|
|
-Dgles2=disabled
|
2023-02-03 19:14:11 +11:00
|
|
|
-Dllvm=disabled
|
2023-02-03 15:38:23 +11:00
|
|
|
-Dshared-llvm=disabled
|
2023-02-04 18:12:15 +11:00
|
|
|
-Dplatforms=
|
2023-02-03 19:14:11 +11:00
|
|
|
-Dzlib=disabled
|
2023-02-04 19:07:48 +11:00
|
|
|
-Dshader-cache=disabled
|
2023-02-03 15:38:23 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add(mesa
|
2023-02-04 19:18:34 +11:00
|
|
|
GIT_REPOSITORY https://gitlab.freedesktop.org/mesa/mesa
|
|
|
|
GIT_TAG ${MESA_HASH}
|
|
|
|
GIT_SHALLOW true
|
|
|
|
GIT_PROGRESS true
|
|
|
|
GIT_CONFIG core.symlinks=false
|
2023-02-03 15:38:23 +11:00
|
|
|
PREFIX ${CMAKE_BINARY_DIR}/mesa
|
|
|
|
CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/mesa/src/mesa && meson setup ${CMAKE_BINARY_DIR}/mesa/src/mesa-build ${MESA_EXTRA_FLAGS}
|
2023-02-04 19:18:34 +11:00
|
|
|
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/mesa/src/mesa-build && ninja src/vulkan/util/libvulkan_util.a && ninja src/microsoft/spirv_to_dxil/libspirv_to_dxil.a
|
2023-02-03 15:38:23 +11:00
|
|
|
INSTALL_COMMAND cmake -DOUT_DIR=${CMAKE_BINARY_DIR}/mesa -DMESA_BUILD=${CMAKE_BINARY_DIR}/mesa/src/mesa-build -P ${CMAKE_CURRENT_LIST_DIR}/install_spirv_to_dxil.cmake
|
2023-02-03 19:14:11 +11:00
|
|
|
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mesa/lib/spirv_to_dxil.lib ${CMAKE_BINARY_DIR}/mesa/lib/libspirv_to_dxil.a ${CMAKE_BINARY_DIR}/mesa/lib/vulkan_util.lib ${CMAKE_BINARY_DIR}/mesa/lib/libvulkan_util.a
|
2023-02-03 15:38:23 +11:00
|
|
|
)
|
|
|
|
|