Fix cbindgen macro expansion and CI

This commit is contained in:
Dzmitry Malyshau committed 2019-05-10 21:55:09 -04:00
1 parent 5eda162748
commit 540451a66d
7 files changed
+84 -25

No files matched your search

+27 -12
View File
@@ -1,4 +1,6 @@
language: rust
sudo: false
dist: xenial
matrix:
include:
@@ -6,9 +8,11 @@ matrix:
- os: linux
rust: stable
compiler: gcc
- os: linux
rust: nightly
compiler: gcc
#TODO: unlock when libglfw3 on Ubuntu comes with Vulkan support
# or when we add a GL backend.
#- os: linux
# rust: nightly
# compiler: gcc
# Windows 64bit
- os: windows
rust: stable
@@ -19,11 +23,11 @@ matrix:
rust: stable
osx_image: xcode9.4
compiler: clang
#- env: MACOSX_DEPLOYMENT_TARGET=10.9
# os: osx
# rust: nightly
# osx_image: xcode9.4
# compiler: clang
- env: MACOSX_DEPLOYMENT_TARGET=10.9
os: osx
rust: nightly
osx_image: xcode9.4
compiler: clang
# iPhoneOS 64bit
#- env: TARGET=aarch64-apple-ios
@@ -31,16 +35,27 @@ matrix:
# osx_image: xcode9.4
# rust: nightly
addons:
apt:
packages:
- cmake
- libglfw3-dev
homebrew:
update: true
packages:
- cmake
- glfw3
choco:
packages:
- make
branches:
except:
- staging.tmp
before_install:
# Do not run bors builds against the nightly compiler.
# We want to find out about nightly bugs, so they're done in master, but we don't block on them.
- if [[ $TRAVIS_RUST_VERSION == "nightly" && $TRAVIS_BRANCH == "staging" ]]; then exit; fi
- if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install make; fi
script:
- cargo test
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && cargo install cbindgen && make ffi-examples); fi
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]]; then cargo +nightly install cbindgen && make VERBOSE=1; fi
+2 -2
View File
@@ -54,10 +54,10 @@ lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(wildcard wgpu-native/**/*.rs wgp
cargo build --manifest-path wgpu-remote/Cargo.toml --features $(FEATURE_RUST)
ffi/wgpu.h: wgpu-native/cbindgen.toml $(wildcard wgpu-native/**/*.rs)
cbindgen wgpu-native >ffi/wgpu.h
rustup run nightly cbindgen wgpu-native >ffi/wgpu.h
ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/**/*.rs wgpu-remote/**/*.rs)
cbindgen wgpu-remote >ffi/wgpu-remote.h
rustup run nightly cbindgen wgpu-remote >ffi/wgpu-remote.h
examples-native: lib-native ffi/wgpu.h examples/hello_triangle_c/main.c
cd examples/hello_triangle_c && mkdir -p build && cd build && cmake .. && make
+3 -3
View File
@@ -7,17 +7,17 @@ set(TARGET_NAME hello_triangle)
add_executable(hello_triangle main.c)
if(MSVC)
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
target_compile_options(${TARGET_NAME} PRIVATE /W4)
add_compile_definitions(WGPU_TARGET=WGPU_TARGET_WINDOWS)
set(GLFW_LIBRARY glfw3)
elseif(APPLE)
add_compile_definitions(WGPU_TARGET=WGPU_TARGET_MACOS)
add_definitions(-DWGPU_TARGET=WGPU_TARGET_MACOS)
set(OS_LIBRARIES "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
target_compile_options(${TARGET_NAME} PRIVATE -x objective-c)
set(GLFW_LIBRARY glfw)
else(MSVC)
add_definitions(-DWGPU_TARGET=WGPU_TARGET_LINUX)
target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic)
add_compile_definitions(WGPU_TARGET=WGPU_TARGET_LINUX)
set(GLFW_LIBRARY glfw)
endif(MSVC)
+1 -1
View File
@@ -1,6 +1,6 @@
/* Generated with cbindgen:0.8.3 */
/* Generated with cbindgen:0.8.6 */
#include <stdarg.h>
#include <stdbool.h>
+45 -6
View File
@@ -1,6 +1,6 @@
#define WGPU_LOCAL
/* Generated with cbindgen:0.8.3 */
/* Generated with cbindgen:0.8.6 */
#include <stdarg.h>
#include <stdbool.h>
@@ -630,7 +630,9 @@ typedef struct {
#if defined(WGPU_LOCAL)
WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id, const WGPUDeviceDescriptor *desc);
#endif
void wgpu_bind_group_destroy(WGPUBindGroupId bind_group_id);
@@ -672,10 +674,14 @@ void wgpu_command_buffer_copy_texture_to_texture(WGPUCommandBufferId command_buf
const WGPUTextureCopyView *destination,
WGPUExtent3d copy_size);
#if defined(WGPU_LOCAL)
WGPUComputePassId wgpu_command_encoder_begin_compute_pass(WGPUCommandEncoderId command_encoder_id);
#endif
#if defined(WGPU_LOCAL)
WGPURenderPassId wgpu_command_encoder_begin_render_pass(WGPUCommandEncoderId command_encoder_id,
WGPURenderPassDescriptor desc);
#endif
WGPUCommandBufferId wgpu_command_encoder_finish(WGPUCommandEncoderId command_encoder_id);
@@ -691,42 +697,68 @@ void wgpu_compute_pass_set_bind_group(WGPUComputePassId pass_id,
void wgpu_compute_pass_set_pipeline(WGPUComputePassId pass_id, WGPUComputePipelineId pipeline_id);
#if defined(WGPU_LOCAL)
WGPUInstanceId wgpu_create_instance(void);
#endif
#if defined(WGPU_LOCAL)
WGPUBindGroupId wgpu_device_create_bind_group(WGPUDeviceId device_id,
const WGPUBindGroupDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUBindGroupLayoutId wgpu_device_create_bind_group_layout(WGPUDeviceId device_id,
const WGPUBindGroupLayoutDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUBufferId wgpu_device_create_buffer(WGPUDeviceId device_id, const WGPUBufferDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUBufferId wgpu_device_create_buffer_mapped(WGPUDeviceId device_id,
const WGPUBufferDescriptor *desc,
uint8_t **mapped_ptr_out);
#endif
#if defined(WGPU_LOCAL)
WGPUCommandEncoderId wgpu_device_create_command_encoder(WGPUDeviceId device_id,
const WGPUCommandEncoderDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUComputePipelineId wgpu_device_create_compute_pipeline(WGPUDeviceId device_id,
const WGPUComputePipelineDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUPipelineLayoutId wgpu_device_create_pipeline_layout(WGPUDeviceId device_id,
const WGPUPipelineLayoutDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPURenderPipelineId wgpu_device_create_render_pipeline(WGPUDeviceId device_id,
const WGPURenderPipelineDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUSamplerId wgpu_device_create_sampler(WGPUDeviceId device_id, const WGPUSamplerDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUShaderModuleId wgpu_device_create_shader_module(WGPUDeviceId device_id,
const WGPUShaderModuleDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUSwapChainId wgpu_device_create_swap_chain(WGPUDeviceId device_id,
WGPUSurfaceId surface_id,
const WGPUSwapChainDescriptor *desc);
#endif
#if defined(WGPU_LOCAL)
WGPUTextureId wgpu_device_create_texture(WGPUDeviceId device_id, const WGPUTextureDescriptor *desc);
#endif
void wgpu_device_destroy(WGPUDeviceId device_id);
@@ -734,24 +766,27 @@ WGPUQueueId wgpu_device_get_queue(WGPUDeviceId device_id);
void wgpu_device_poll(WGPUDeviceId device_id, bool force_wait);
#if defined(WGPU_LOCAL)
WGPUSurfaceId wgpu_instance_create_surface_from_macos_layer(WGPUInstanceId instance_id,
void *layer);
#endif
#if defined(WGPU_LOCAL)
WGPUSurfaceId wgpu_instance_create_surface_from_windows_hwnd(WGPUInstanceId instance_id,
void *hinstance,
void *hwnd);
#if defined(WGPU_WINDOW_WINIT)
WGPUSurfaceId wgpu_instance_create_surface_from_winit(WGPUInstanceId instance_id,
const WGPUWindow *window);
#endif
#if defined(WGPU_LOCAL)
WGPUSurfaceId wgpu_instance_create_surface_from_xlib(WGPUInstanceId instance_id,
const void **display,
uint64_t window);
#endif
#if defined(WGPU_LOCAL)
WGPUAdapterId wgpu_instance_get_adapter(WGPUInstanceId instance_id,
const WGPUAdapterDescriptor *desc);
#endif
void wgpu_queue_submit(WGPUQueueId queue_id,
const WGPUCommandBufferId *command_buffer_ptr,
@@ -801,10 +836,14 @@ WGPUSwapChainOutput wgpu_swap_chain_get_next_texture(WGPUSwapChainId swap_chain_
void wgpu_swap_chain_present(WGPUSwapChainId swap_chain_id);
#if defined(WGPU_LOCAL)
WGPUTextureViewId wgpu_texture_create_default_view(WGPUTextureId texture_id);
#endif
#if defined(WGPU_LOCAL)
WGPUTextureViewId wgpu_texture_create_view(WGPUTextureId texture_id,
const WGPUTextureViewDescriptor *desc);
#endif
void wgpu_texture_destroy(WGPUTextureId texture_id);
+2 -1
View File
@@ -1,4 +1,4 @@
header = ""
header = "#define WGPU_LOCAL"
include_version = true
braces = "SameLine"
line_length = 100
@@ -14,6 +14,7 @@ exclude = ["BufferMapResult"]
parse_deps = false
[parse.expand]
crates = ["wgpu-native"]
features = ["local"]
[fn]
+4
View File
@@ -7,11 +7,15 @@ language = "C"
[export]
prefix = "WGPU"
exclude = ["BufferMapResult"]
[parse]
parse_deps = true
include = ["wgpu_native"]
[parse.expand]
crates = ["wgpu-native"]
[fn]
[struct]