aboutsummaryrefslogtreecommitdiff
path: root/manual tests
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-03-17 03:16:02 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-03-17 03:16:02 +0200
commita3c1a5eaa367e63fe58ed4a6dec16ac3a1f082e2 (patch)
tree02b8a97900cccb61d8e1ce895fc33a468d194ab3 /manual tests
parentefbbcd37867504261c0974d293d5f9576bc9effb (diff)
downloadmeson-a3c1a5eaa367e63fe58ed4a6dec16ac3a1f082e2.zip
meson-a3c1a5eaa367e63fe58ed4a6dec16ac3a1f082e2.tar.gz
meson-a3c1a5eaa367e63fe58ed4a6dec16ac3a1f082e2.tar.bz2
Converted binary sample project to C++ to demonstrate how to use C++11 and static libstdc++.
Diffstat (limited to 'manual tests')
-rwxr-xr-x[-rw-r--r--]manual tests/3 standalone binaries/build_linux_package.sh2
-rwxr-xr-x[-rw-r--r--]manual tests/3 standalone binaries/build_osx_package.sh0
-rwxr-xr-x[-rw-r--r--]manual tests/3 standalone binaries/linux_bundler.sh0
-rw-r--r--manual tests/3 standalone binaries/meson.build6
-rw-r--r--manual tests/3 standalone binaries/myapp.c31
-rw-r--r--manual tests/3 standalone binaries/myapp.cpp29
6 files changed, 33 insertions, 35 deletions
diff --git a/manual tests/3 standalone binaries/build_linux_package.sh b/manual tests/3 standalone binaries/build_linux_package.sh
index 9a0406c..f080576 100644..100755
--- 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
index eca11c6..eca11c6 100644..100755
--- a/manual tests/3 standalone binaries/build_osx_package.sh
+++ b/manual tests/3 standalone binaries/build_osx_package.sh
diff --git a/manual tests/3 standalone binaries/linux_bundler.sh b/manual tests/3 standalone binaries/linux_bundler.sh
index a0e5c12..a0e5c12 100644..100755
--- a/manual tests/3 standalone binaries/linux_bundler.sh
+++ b/manual tests/3 standalone binaries/linux_bundler.sh
diff --git a/manual tests/3 standalone binaries/meson.build b/manual tests/3 standalone binaries/meson.build
index 81708f0..e5e6ee0 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 83a4e4c..0000000
--- a/manual tests/3 standalone binaries/myapp.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include<SDL.h>
-
-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 0000000..fec80c5
--- /dev/null
+++ b/manual tests/3 standalone binaries/myapp.cpp
@@ -0,0 +1,29 @@
+#include<SDL.h>
+#include<memory>
+
+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<SDL_Window, void(*)(SDL_Window*)> 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;
+}