update SDL2 example compilation with Gradle

This commit is contained in:
Juraj Michalek
2014-04-19 15:04:59 +02:00
parent cc9f35d783
commit ceadb4719a
4 changed files with 35 additions and 22 deletions

View File

@@ -146,19 +146,39 @@ How to run (PowerShell + VS 2013):
restore C++ REST SDK restore C++ REST SDK
CTRL+F5 to run the project CTRL+F5 to run the project
Simple DirectMedia Layer 2 ## Simple DirectMedia Layer 2
--------------------------
SDL2 is multiplatform library suitable for developing applications like games. SDL2 is multiplatform library suitable for developing applications like games.
Example is based on SDL2. You can use Gradle to build SDL2 examples.
You can download version for Visual Studio at: http://libsdl.org/release/SDL2-devel-2.0.1-VC.zip
This library is also available in all common Linux ditributions.
How to run (PowerShell + VS 2013): ### Preparing dependencies for Windows
cd sdl Root project contains reference to SDL2 library. Type:
.\DownloadLibrary.ps1
ii .\sdl2-sample.sln gradle prepare
It will download Windows version of SDL2 library for all projects.
Libraries will be placed in directory build.
Now you can build earch of subprojects.
### 01-sdl2-init
Simple example - init and quit SDL.
How to build:
gradle clean mainExecutable
Shorter version:
gradle clean mE
It is possible to generate project for Visual Studio:
gradle mainVisualStudio
Compiled binary will be stored in:
build\binaries\mainExecutable
node node
---- ----

View File

@@ -19,7 +19,8 @@ executables {
main { main {
binaries.all { binaries.all {
if (toolChain in VisualCpp) { if (toolChain in VisualCpp) {
linker.args "/machine:X86", "/SUBSYSTEM:WINDOWS", "../build/SDL2-2.0.3/lib/x86/SDL2.lib" cCompiler.args "/MD"
linker.args "/SUBSYSTEM:CONSOLE", "/LIBPATH:../build/SDL2-2.0.3/lib/x86/", "SDL2main.lib", "SDL2.lib"
//linker.args "/SUBSYSTEM:WINDOWS", "/LIBPATH:../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

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

View File

@@ -1,7 +0,0 @@
Dependencies
------------
Download and unzip dependency http://libsdl.org/release/SDL2-devel-2.0.1-VC.zip
to this directory. You should see directory SDL2-2.0.1 with SDL2 files.
Alternatively you can download library by DownloadLibrary.ps1 script.