169: Add Windows/glfw3 to CI r=kvark a=grovesNL



Co-authored-by: Joshua Groves <josh@joshgroves.com>
This commit is contained in:
bors[bot] 2019-06-05 01:55:24 +00:00
commit b1d9de0406
3 changed files with 27 additions and 12 deletions

View File

@ -16,6 +16,8 @@ matrix:
# Windows 64bit
- os: windows
rust: stable
- os: windows
rust: nightly
# macOS 64bit
- env: MACOSX_DEPLOYMENT_TARGET=10.9
@ -45,9 +47,6 @@ addons:
packages:
- cmake
- glfw3
choco:
packages:
- make
branches:
except:
@ -58,6 +57,18 @@ before_install:
script:
- cargo test
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]]; then cargo +nightly install cbindgen && make VERBOSE=1; fi
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME == "windows" ]]; then
wget -nc -O glfw.zip https://github.com/glfw/glfw/archive/3.3.zip &&
7z x glfw.zip -oglfw &&
cd glfw/glfw-3.3 &&
export GLFW3_INCLUDE_DIR=`pwd`/include &&
export GLFW3_INSTALL_DIR=`pwd`/install &&
cmake . -DCMAKE_INSTALL_PREFIX=$GLFW3_INSTALL_DIR -DCMAKE_GENERATOR_PLATFORM=x64 &&
cmake --build . --target install &&
cd ../.. &&
export CMAKE_PREFIX_PATH=$GLFW3_INSTALL_DIR &&
make examples-native VERBOSE=1;
fi
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME != "windows" ]]; then cargo +nightly install cbindgen && make VERBOSE=1; fi
# TODO: Temporarily only test building the gl backend, properly test when it is usable from C
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then cd wgpu-native && cargo build --features local,gfx-backend-gl; fi

View File

@ -3,6 +3,8 @@ EXCLUDES:=
FEATURE_RUST:=
FEATURE_NATIVE:=
GENERATOR_PLATFORM:=
FFI_DIR:=ffi
BUILD_DIR:=build
CLEAN_FFI_DIR:=
@ -17,6 +19,7 @@ endif
ifeq ($(OS),Windows_NT)
CLEAN_FFI_DIR=del $(FFI_DIR)\*.* /Q /S
CREATE_BUILD_DIR=mkdir $(BUILD_DIR)
GENERATOR_PLATFORM=-DCMAKE_GENERATOR_PLATFORM=x64
ifeq ($(TARGET),x86_64-pc-windows-gnu)
FEATURE_RUST=vulkan
@ -71,7 +74,7 @@ ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/**/*.rs wgp
rustup run nightly cbindgen wgpu-remote >$(FFI_DIR)/wgpu-remote.h
examples-native: lib-native $(FFI_DIR)/wgpu.h examples/hello_triangle_c/main.c
cd examples/hello_triangle_c && $(CREATE_BUILD_DIR) && cd build && cmake .. -DBACKEND=$(FEATURE_RUST) && make
cd examples/hello_triangle_c && $(CREATE_BUILD_DIR) && cd build && cmake .. -DBACKEND=$(FEATURE_RUST) $(GENERATOR_PLATFORM) && cmake --build .
examples-remote: lib-remote $(FFI_DIR)/wgpu-remote.h examples/hello_remote_c/main.c
cd examples/hello_remote_c && $(CREATE_BUILD_DIR) && cd build && cmake .. && make
cd examples/hello_remote_c && $(CREATE_BUILD_DIR) && cd build && cmake .. && cmake --build .

View File

@ -23,7 +23,6 @@ add_executable(hello_triangle main.c)
if(MSVC)
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
target_compile_options(${TARGET_NAME} PRIVATE /W4)
set(GLFW_LIBRARY glfw3)
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp")
if("${BACKEND}" STREQUAL "${BACKEND_DX11}")
list(APPEND OS_LIBRARIES "d3dcompiler" "D3D11" "DXGI")
@ -34,17 +33,19 @@ elseif(APPLE)
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)
set(GLFW_LIBRARY glfw)
endif(MSVC)
find_package(glfw3 REQUIRED)
find_package(glfw3 3.3 REQUIRED
HINTS "$ENV{GLFW3_INSTALL_DIR}"
)
find_library(WGPU_LIBRARY wgpu_native
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
)
target_link_libraries(${TARGET_NAME} ${GLFW_LIBRARY} ${WGPU_LIBRARY} ${OS_LIBRARIES})
target_include_directories(${TARGET_NAME} PUBLIC $ENV{GLFW3_INCLUDE_DIR})
target_link_libraries(${TARGET_NAME} glfw ${WGPU_LIBRARY} ${OS_LIBRARIES})