sys: automatically ensure meson and ninja in cmake build

This commit is contained in:
chyyran 2023-02-06 01:40:51 -05:00
parent 90737b79d3
commit 09bdbcdbec
3 changed files with 17 additions and 4 deletions

2
Cargo.lock generated
View file

@ -207,7 +207,7 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "spirv-to-dxil" name = "spirv-to-dxil"
version = "0.2.4" version = "0.2.5"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"bytemuck", "bytemuck",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "spirv-to-dxil-sys" name = "spirv-to-dxil-sys"
version = "0.2.2" version = "0.2.3"
edition = "2021" edition = "2021"
description = "Raw bindings to spirv-to-dxil" description = "Raw bindings to spirv-to-dxil"
license = "MIT" license = "MIT"

View file

@ -15,10 +15,23 @@ if(PIP_EXE STREQUAL "PIP_EXE-NOTFOUND")
message(FATAL_ERROR "pip required") message(FATAL_ERROR "pip required")
endif(PIP_EXE STREQUAL "PIP_EXE-NOTFOUND") endif(PIP_EXE STREQUAL "PIP_EXE-NOTFOUND")
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install mako) cmake_path(GET Python_EXECUTABLE PARENT_PATH PYTHON_DIR)
cmake_path(APPEND PYTHON_DIR "Scripts" OUTPUT_VARIABLE PYTHON_SCRIPTS_DIR)
LIST(APPEND CMAKE_PROGRAM_PATH PYTHON_SCRIPTS_DIR ...)
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install meson ninja mako)
find_program(MESON_EXE meson)
if(MESON_EXE STREQUAL "MESON_EXE-NOTFOUND")
message(FATAL_ERROR "meson failed to install")
endif(MESON_EXE STREQUAL "MESON_EXE-NOTFOUND")
find_program(NINJA_EXE ninja)
if(NINJA_EXE STREQUAL "NINJA_EXE-NOTFOUND")
message(FATAL_ERROR "ninja failed to install")
endif(NINJA_EXE STREQUAL "NINJA_EXE-NOTFOUND")
string(TOLOWER ${CMAKE_BUILD_TYPE} MESON_BUILD_TYPE) string(TOLOWER ${CMAKE_BUILD_TYPE} MESON_BUILD_TYPE)
set(MESA_EXTRA_FLAGS set(MESA_EXTRA_FLAGS
-Dbuildtype=${MESON_BUILD_TYPE} -Dbuildtype=${MESON_BUILD_TYPE}
# enable spirv-to-dxil (obviously) # enable spirv-to-dxil (obviously)