mirror of
https://github.com/ysoftdevs/cpp-examples.git
synced 2026-01-14 07:43:36 +01:00
update SDL2 example compilation with Gradle
This commit is contained in:
38
README.md
38
README.md
@@ -146,19 +146,39 @@ How to run (PowerShell + VS 2013):
|
||||
restore C++ REST SDK
|
||||
CTRL+F5 to run the project
|
||||
|
||||
Simple DirectMedia Layer 2
|
||||
--------------------------
|
||||
## Simple DirectMedia Layer 2
|
||||
|
||||
SDL2 is multiplatform library suitable for developing applications like games.
|
||||
Example is based on SDL2.
|
||||
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.
|
||||
You can use Gradle to build SDL2 examples.
|
||||
|
||||
How to run (PowerShell + VS 2013):
|
||||
### Preparing dependencies for Windows
|
||||
|
||||
cd sdl
|
||||
.\DownloadLibrary.ps1
|
||||
ii .\sdl2-sample.sln
|
||||
Root project contains reference to SDL2 library. Type:
|
||||
|
||||
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
|
||||
----
|
||||
|
||||
@@ -19,7 +19,8 @@ executables {
|
||||
main {
|
||||
binaries.all {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// sdl2-sample.cpp : SDL2 example - initialize and quit
|
||||
//
|
||||
// SDL2 example - initialize and quit
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
int main(int argc, char** argv){
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user