use gradle to build example

This commit is contained in:
Juraj Michalek
2014-04-19 12:01:24 +02:00
parent 64ef14f422
commit cc9f35d783
5 changed files with 70 additions and 27 deletions

View File

@@ -1,13 +0,0 @@
// sdl2-sample.cpp : SDL2 example - initialize and quit
//
#include <tchar.h>
#include "SDL.h"
int _tmain(int argc, _TCHAR* argv[])
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
return 0;
}

View File

@@ -0,0 +1,28 @@
apply plugin: 'c'
apply plugin: 'visual-studio'
sources {
main {
c {
source {
// Include just source, avoid including *.swp and other helper files
include "**/*.c"
}
exportedHeaders {
srcDir "../build/SDL2-2.0.3/include"
}
}
}
}
executables {
main {
binaries.all {
if (toolChain in VisualCpp) {
linker.args "/machine:X86", "/SUBSYSTEM:WINDOWS", "../build/SDL2-2.0.3/lib/x86/SDL2.lib"
//linker.args "/SUBSYSTEM:WINDOWS", "/LIBPATH:../build/SDL2-2.0.3/lib/x86/", "SDL2.lib"
}
}
}
}

View File

@@ -0,0 +1,11 @@
// sdl2-sample.cpp : SDL2 example - initialize and quit
//
#include "SDL.h"
int main(int argc, char* argv[]) {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
return 0;
}

View File

@@ -1,14 +0,0 @@
Write-Host("Downloading library")
$workingPath = (Get-Location).path
$clnt = new-object System.Net.WebClient
$url = "http://libsdl.org/release/SDL2-devel-2.0.1-VC.zip"
$file = $workingPath + "\SDL2-devel-2.0.1-VC.zip"
$clnt.DownloadFile($url,$file)
Write-Host("Unzip the file to local directory")
$shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($file)
$destination = $shell_app.namespace($workingPath)
$destination.Copyhere($zip_file.items())
Write-Host("Done")

31
sdl/build.gradle Normal file
View File

@@ -0,0 +1,31 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'de.undercouch:gradle-download-task:1.0'
}
}
import de.undercouch.gradle.tasks.download.Download
task downloadSdl(type: Download) {
description = "Download SDL2 library ZIP file."
src 'http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip'
dest 'build/sdl2.zip'
}
task extractSdl(type: Copy) {
description = "Unpack SDL2 library"
from zipTree('build/sdl2.zip')
into 'build/'
}
task prepare {
description = "Prepare build environment for SDL2"
}
extractSdl.dependsOn downloadSdl
prepare.dependsOn extractSdl