diff --git a/manual tests/3 standalone binaries/build_linux_package.sh b/manual tests/3 standalone binaries/build_linux_package.sh old mode 100644 new mode 100755 index 9a0406c8f..f080576d2 --- a/manual tests/3 standalone binaries/build_linux_package.sh +++ b/manual tests/3 standalone binaries/build_linux_package.sh @@ -3,7 +3,7 @@ curdir=`pwd` rm -rf buildtmp mkdir buildtmp -~/meson/meson.py buildtmp --buildtype=release --prefix=/tmp/myapp --libdir=lib +LDFLAGS=-static-libstdc++ ~/meson/meson.py buildtmp --buildtype=release --prefix=/tmp/myapp --libdir=lib ninja -C buildtmp install rm -rf buildtmp cd /tmp/ diff --git a/manual tests/3 standalone binaries/build_osx_package.sh b/manual tests/3 standalone binaries/build_osx_package.sh old mode 100644 new mode 100755 diff --git a/manual tests/3 standalone binaries/linux_bundler.sh b/manual tests/3 standalone binaries/linux_bundler.sh old mode 100644 new mode 100755 diff --git a/manual tests/3 standalone binaries/meson.build b/manual tests/3 standalone binaries/meson.build index 81708f095..e5e6ee06f 100644 --- a/manual tests/3 standalone binaries/meson.build +++ b/manual tests/3 standalone binaries/meson.build @@ -1,8 +1,8 @@ -project('myapp', 'c') +project('myapp', 'cpp') sdl = dependency('sdl2') -if meson.get_compiler('c').get_id() != 'msvc' +if meson.get_compiler('cpp').get_id() != 'msvc' add_global_arguments('-std=c++11', language : 'cpp') endif @@ -25,6 +25,6 @@ if host.name() == 'linux' endif -prog = executable('myapp', 'myapp.c', +prog = executable('myapp', 'myapp.cpp', dependencies : sdl, install : true) diff --git a/manual tests/3 standalone binaries/myapp.c b/manual tests/3 standalone binaries/myapp.c deleted file mode 100644 index 83a4e4ce2..000000000 --- a/manual tests/3 standalone binaries/myapp.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -int main(int argc, char **argv) { - SDL_Window *window; - SDL_Surface *screenSurface; - SDL_Event e; - int keepGoing = 1; - if(SDL_Init( SDL_INIT_VIDEO ) < 0) { - printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); - } - - window = SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN ); - - screenSurface = SDL_GetWindowSurface( window ); - - while(keepGoing) { - while(SDL_PollEvent(&e) != 0) { - if(e.type == SDL_QUIT) { - keepGoing = 0; - break; - } - } - SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0x00, 0x00 ) ); - SDL_UpdateWindowSurface( window ); - SDL_Delay(100); - } - - SDL_DestroyWindow(window); - SDL_Quit(); - return 0; -} diff --git a/manual tests/3 standalone binaries/myapp.cpp b/manual tests/3 standalone binaries/myapp.cpp new file mode 100644 index 000000000..fec80c510 --- /dev/null +++ b/manual tests/3 standalone binaries/myapp.cpp @@ -0,0 +1,29 @@ +#include +#include + +int main(int argc, char **argv) { + SDL_Surface *screenSurface; + SDL_Event e; + int keepGoing = 1; + if(SDL_Init( SDL_INIT_VIDEO ) < 0) { + printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); + } + atexit(SDL_Quit); + + std::unique_ptr window(SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN), SDL_DestroyWindow); + screenSurface = SDL_GetWindowSurface(window.get()); + + while(keepGoing) { + while(SDL_PollEvent(&e) != 0) { + if(e.type == SDL_QUIT) { + keepGoing = 0; + break; + } + } + SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0x00, 0x00)); + SDL_UpdateWindowSurface(window.get()); + SDL_Delay(100); + } + + return 0; +}