From 5142747ceb3081ee90f8353dc3f6c7a0cddef778 Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 6 Mar 2020 20:39:40 +0300 Subject: [PATCH] examples: move SDL examples from vlib to examples dir --- .github/workflows/ci.yml | 10 ++++++++-- .github/workflows/windows-install-sdl.bat | 16 ++++++++++++++++ .gitignore | 5 +++++ .../sdl}/basic_window/main.v | 0 .../sdl}/tvintris/README.md | 0 .../sdl}/tvintris/fonts/RobotoMono-Regular.ttf | Bin .../sdl}/tvintris/images/tvintris.png | Bin .../sdl}/tvintris/images/v-logo_30_30.png | Bin .../sdl}/tvintris/sounds/TwintrisThosenine.mod | Bin .../sdl}/tvintris/sounds/block.wav | Bin .../sdl}/tvintris/sounds/single.wav | Bin .../sdl}/tvintris/sounds/triple.wav | Bin .../sdl}/tvintris/tvintris.v | 0 vlib/sdl/image/image.v | 9 +++++---- vlib/sdl/mixer/mixer.v | 4 ++++ vlib/sdl/sdl.v | 6 +++--- vlib/sdl/ttf/ttf.v | 4 ++++ 17 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/windows-install-sdl.bat rename {vlib/sdl/examples => examples/sdl}/basic_window/main.v (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/README.md (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/fonts/RobotoMono-Regular.ttf (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/images/tvintris.png (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/images/v-logo_30_30.png (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/sounds/TwintrisThosenine.mod (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/sounds/block.wav (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/sounds/single.wav (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/sounds/triple.wav (100%) rename {vlib/sdl/examples => examples/sdl}/tvintris/tvintris.v (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ef7651b40..ff7bfcdd74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,10 +212,13 @@ jobs: #- uses: actions/setup-node@v1 # with: # node-version: 12.x + - name: Install dependencies + run: | + git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/ + .\.github\workflows\windows-install-sdl.bat - name: Build run: | gcc --version - git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/ .\make.bat -gcc - name: Test run: | @@ -235,11 +238,14 @@ jobs: #- uses: actions/setup-node@v1 # with: # node-version: 12.x + - name: Install dependencies + run: | + git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/ + .\.github\workflows\windows-install-sdl.bat - name: Build run: | echo %VFLAGS% echo $VFLAGS - git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/ .\make.bat -msvc - name: Test run: | diff --git a/.github/workflows/windows-install-sdl.bat b/.github/workflows/windows-install-sdl.bat new file mode 100644 index 0000000000..7a0ffdbc2a --- /dev/null +++ b/.github/workflows/windows-install-sdl.bat @@ -0,0 +1,16 @@ +@echo off + +curl -L https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip -o SDL2.zip +curl -L https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip -o SDL2_ttf.zip +curl -L https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip -o SDL2_image.zip +curl -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip -o SDL2_mixer.zip + +unzip SDL2.zip -d thirdparty/ +unzip SDL2_ttf.zip -d thirdparty/ +unzip SDL2_image.zip -d thirdparty/ +unzip SDL2_mixer.zip -d thirdparty/ + +mv thirdparty/SDL2-2.0.10 thirdparty/SDL2 +mv thirdparty/SDL2_ttf-2.0.15 thirdparty/SDL2_ttf +mv thirdparty/SDL2_image-2.0.5 thirdparty/SDL2_image +mv thirdparty/SDL2_mixer-2.0.4 thirdparty/SDL2_mixer diff --git a/.gitignore b/.gitignore index e9110b218a..9a12a60e28 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,11 @@ info.log *~ thirdparty/freetype/ +thirdparty/sdl2/ +thirdparty/SDL2_image/ +thirdparty/SDL2_mixer/ +thirdparty/SDL2_ttf/ + cachegrind.out.* .gdb_history diff --git a/vlib/sdl/examples/basic_window/main.v b/examples/sdl/basic_window/main.v similarity index 100% rename from vlib/sdl/examples/basic_window/main.v rename to examples/sdl/basic_window/main.v diff --git a/vlib/sdl/examples/tvintris/README.md b/examples/sdl/tvintris/README.md similarity index 100% rename from vlib/sdl/examples/tvintris/README.md rename to examples/sdl/tvintris/README.md diff --git a/vlib/sdl/examples/tvintris/fonts/RobotoMono-Regular.ttf b/examples/sdl/tvintris/fonts/RobotoMono-Regular.ttf similarity index 100% rename from vlib/sdl/examples/tvintris/fonts/RobotoMono-Regular.ttf rename to examples/sdl/tvintris/fonts/RobotoMono-Regular.ttf diff --git a/vlib/sdl/examples/tvintris/images/tvintris.png b/examples/sdl/tvintris/images/tvintris.png similarity index 100% rename from vlib/sdl/examples/tvintris/images/tvintris.png rename to examples/sdl/tvintris/images/tvintris.png diff --git a/vlib/sdl/examples/tvintris/images/v-logo_30_30.png b/examples/sdl/tvintris/images/v-logo_30_30.png similarity index 100% rename from vlib/sdl/examples/tvintris/images/v-logo_30_30.png rename to examples/sdl/tvintris/images/v-logo_30_30.png diff --git a/vlib/sdl/examples/tvintris/sounds/TwintrisThosenine.mod b/examples/sdl/tvintris/sounds/TwintrisThosenine.mod similarity index 100% rename from vlib/sdl/examples/tvintris/sounds/TwintrisThosenine.mod rename to examples/sdl/tvintris/sounds/TwintrisThosenine.mod diff --git a/vlib/sdl/examples/tvintris/sounds/block.wav b/examples/sdl/tvintris/sounds/block.wav similarity index 100% rename from vlib/sdl/examples/tvintris/sounds/block.wav rename to examples/sdl/tvintris/sounds/block.wav diff --git a/vlib/sdl/examples/tvintris/sounds/single.wav b/examples/sdl/tvintris/sounds/single.wav similarity index 100% rename from vlib/sdl/examples/tvintris/sounds/single.wav rename to examples/sdl/tvintris/sounds/single.wav diff --git a/vlib/sdl/examples/tvintris/sounds/triple.wav b/examples/sdl/tvintris/sounds/triple.wav similarity index 100% rename from vlib/sdl/examples/tvintris/sounds/triple.wav rename to examples/sdl/tvintris/sounds/triple.wav diff --git a/vlib/sdl/examples/tvintris/tvintris.v b/examples/sdl/tvintris/tvintris.v similarity index 100% rename from vlib/sdl/examples/tvintris/tvintris.v rename to examples/sdl/tvintris/tvintris.v diff --git a/vlib/sdl/image/image.v b/vlib/sdl/image/image.v index 40691a53c0..a74c570078 100644 --- a/vlib/sdl/image/image.v +++ b/vlib/sdl/image/image.v @@ -2,11 +2,12 @@ module image import sdl #flag linux -lSDL2_image -#include -// following kludge until `sdl2-config ...` is supported also on windows -#flag windows -I/msys64/mingw64/include/SDL2 -#flag windows -L/mingw64/lib -lSDL2_image +#flag windows -I @VROOT/thirdparty/SDL2_image/include +#flag windows -L @VROOT/thirdparty/SDL2_image/lib/x64 +#flag windows -lSDL2_image + +#include ////////////////////////////////////////////////////////// // SDL_Image.h diff --git a/vlib/sdl/mixer/mixer.v b/vlib/sdl/mixer/mixer.v index 8f6db1d615..2a7215d390 100644 --- a/vlib/sdl/mixer/mixer.v +++ b/vlib/sdl/mixer/mixer.v @@ -1,6 +1,10 @@ module mixer import sdl +#flag windows -I @VROOT/thirdparty/SDL2_mixer/include +#flag windows -L @VROOT/thirdparty/SDL2_mixer/lib/x64 +#flag windows -lSDL2_mixer + #include diff --git a/vlib/sdl/sdl.v b/vlib/sdl/sdl.v index 75b0e0784d..e675e906a4 100644 --- a/vlib/sdl/sdl.v +++ b/vlib/sdl/sdl.v @@ -13,10 +13,10 @@ module sdl #flag -DSDL_DISABLE_IMMINTRIN_H -// following kludge until `sdl2-config ...` is supported also on windows -#flag windows -I/msys64/mingw64/include/SDL2 +#flag windows -I @VROOT/thirdparty/SDL2/include #flag windows -Dmain=SDL_main -#flag windows -L/mingw64/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf -lSDL2_mixer -lSDL2_image +#flag windows -lSDL2main -lSDL2 +#flag windows -L @VROOT/thirdparty/SDL2/lib/x64 #include diff --git a/vlib/sdl/ttf/ttf.v b/vlib/sdl/ttf/ttf.v index 8a1d4df742..d430f8f964 100644 --- a/vlib/sdl/ttf/ttf.v +++ b/vlib/sdl/ttf/ttf.v @@ -2,6 +2,10 @@ module ttf import sdl +#flag windows -I @VROOT/thirdparty/SDL2_ttf/include +#flag windows -L @VROOT/thirdparty/SDL2_ttf/lib/x64 +#flag windows -lSDL2_ttf + #include [typedef]