Browse Source

Travis steps in own scripts

Thomas Buck 10 years ago
parent
commit
3cd82ede59

+ 6
- 8
.travis.yml View File

5
     - gcc
5
     - gcc
6
 
6
 
7
 before_install:
7
 before_install:
8
-    - sudo add-apt-repository -y ppa:zoogie/sdl2-snapshots
9
-    - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
10
-    - sudo apt-get -qq -y update
8
+    - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake/travis_before_install_linux.sh; fi
9
+    - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake/travis_before_install_mac.sh; fi
11
 
10
 
12
 install:
11
 install:
13
-    - sudo apt-get -qq -y install libsdl2-dev libsdl2-ttf-dev libalut-dev libpng12-dev zlib1g-dev
14
-    - if [ "$CC" = "gcc" ]; then sudo apt-get install gcc-4.8; fi
15
-    - if [ "$CXX" = "g++" ]; then sudo apt-get install g++-4.8; fi
12
+    - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake/travis_install_linux.sh; fi
13
+    - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake/travis_install_mac.sh; fi
16
 
14
 
17
 before_script:
15
 before_script:
18
-    - if [ "$CC" = "gcc" ]; then export CC="gcc-4.8"; fi
19
-    - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8"; fi
16
+    - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake/travis_before_script_linux.sh; fi
17
+    - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake/travis_before_script_mac.sh; fi
20
 
18
 
21
 script:
19
 script:
22
     - (mkdir build && cd build && cmake .. && make)
20
     - (mkdir build && cd build && cmake .. && make)

+ 6
- 4
CMakeLists.txt View File

32
 
32
 
33
 # Compiler specific flags
33
 # Compiler specific flags
34
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
34
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
35
-    set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed")
35
+    set (WARNINGS "${WARNINGS} -Weverything")
36
+    set (WARNINGS "${WARNINGS} -Wno-padded -Wno-packed")
36
     set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
37
     set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
37
     set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
38
     set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
38
-    set (WARNINGS "${WARNINGS} -Wno-missing-prototypes -Wno-missing-variable-declarations")
39
-    set (WARNINGS "${WARNINGS} -Wno-disabled-macro-expansion")
40
-    set (WARNINGS "${WARNINGS} -Wno-shorten-64-to-32 -Wno-sign-conversion")
39
+
40
+    set (WARNINGS "${WARNINGS} -Wno-sign-conversion")
41
+    #set (WARNINGS "${WARNINGS} -Wno-shorten-64-to-32")
42
+
41
     set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
43
     set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
42
     set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -g -O0 -ftrapv")
44
     set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -g -O0 -ftrapv")
43
     set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -O2 -fomit-frame-pointer")
45
     set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -O2 -fomit-frame-pointer")

+ 2
- 1
ChangeLog.md View File

3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
     [ 20140705 ]
5
     [ 20140705 ]
6
-    * Added basic Travis CI support (Linux + clang only)
6
+    * Added basic Travis CI support
7
+    * Removed global object, using lazy initialization
7
 
8
 
8
     [ 20140704 ]
9
     [ 20140704 ]
9
     * Removed unnecessary #include dependencies
10
     * Removed unnecessary #include dependencies

+ 3
- 4
TODO.md View File

30
 
30
 
31
 # Travis CI
31
 # Travis CI
32
 
32
 
33
-* Currently only building on Linux with clang, SDL, SDL_TTF, ALUT and PNG
34
-* Should also build with gcc, but needs newer gcc (4.8) with C++11 support
35
-* Should also build on Mac, but needs different before_install / install scripts,
36
-  that can detect the platform they’re running on
33
+* Currently only building on Linux
34
+    * Should also build on Mac, but needs different before_install / install scripts,
35
+      that can detect the platform they’re running on
37
 
36
 

+ 0
- 0
cmake/setup_mac.sh View File


+ 0
- 0
cmake/setup_win.bat View File


+ 6
- 0
cmake/travis_before_install_linux.sh View File

1
+#!/bin/bash
2
+
3
+sudo add-apt-repository -y ppa:zoogie/sdl2-snapshots
4
+sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
5
+sudo apt-get -qq -y update
6
+

+ 3
- 0
cmake/travis_before_install_mac.sh View File

1
+#!/bin/bash
2
+
3
+

+ 5
- 0
cmake/travis_before_script_linux.sh View File

1
+#!/bin/bash
2
+
3
+if [ "$CC" = "gcc" ]; then export CC="gcc-4.8"; fi
4
+if [ "$CXX" = "g++" ]; then export CXX="g++-4.8"; fi
5
+

+ 3
- 0
cmake/travis_before_script_mac.sh View File

1
+#!/bin/bash
2
+
3
+

+ 6
- 0
cmake/travis_install_linux.sh View File

1
+#!/bin/bash
2
+
3
+sudo apt-get -qq -y install libsdl2-dev libsdl2-ttf-dev libalut-dev libpng12-dev zlib1g-dev
4
+if [ "$CC" = "gcc" ]; then sudo apt-get install gcc-4.8; fi
5
+if [ "$CXX" = "g++" ]; then sudo apt-get install g++-4.8; fi
6
+

+ 3
- 0
cmake/travis_install_mac.sh View File

1
+#!/bin/bash
2
+
3
+

+ 23
- 26
src/main.cpp View File

34
 #error No Windowing Library selected!
34
 #error No Windowing Library selected!
35
 #endif
35
 #endif
36
 
36
 
37
-Camera gCamera;
38
-Console gConsole;
39
-FontManager gFont;
40
-Game gGame;
41
-Menu gMenu;
42
-OpenRaider gOpenRaider;
43
-Render gRender;
44
-TextureManager gTextureManager;
45
-World gWorld;
46
-
47
-#ifdef USING_AL
48
-SoundAL gSound;
49
-#else
50
-SoundNull gSound;
51
-#endif
52
-
53
-#ifdef USING_SDL
54
-WindowSDL gWindow;
55
-#endif
56
-
57
 Camera &getCamera() {
37
 Camera &getCamera() {
38
+    static Camera gCamera;
58
     return gCamera;
39
     return gCamera;
59
 }
40
 }
60
 
41
 
61
 Console &getConsole() {
42
 Console &getConsole() {
43
+    static Console gConsole;
62
     return gConsole;
44
     return gConsole;
63
 }
45
 }
64
 
46
 
65
 Font &getFont() {
47
 Font &getFont() {
48
+    static FontManager gFont;
66
     return gFont;
49
     return gFont;
67
 }
50
 }
68
 
51
 
69
 Game &getGame() {
52
 Game &getGame() {
53
+    static Game gGame;
70
     return gGame;
54
     return gGame;
71
 }
55
 }
72
 
56
 
73
 Menu &getMenu() {
57
 Menu &getMenu() {
58
+    static Menu gMenu;
74
     return gMenu;
59
     return gMenu;
75
 }
60
 }
76
 
61
 
77
 OpenRaider &getOpenRaider() {
62
 OpenRaider &getOpenRaider() {
63
+    static OpenRaider gOpenRaider;
78
     return gOpenRaider;
64
     return gOpenRaider;
79
 }
65
 }
80
 
66
 
81
 Render &getRender() {
67
 Render &getRender() {
68
+    static Render gRender;
82
     return gRender;
69
     return gRender;
83
 }
70
 }
84
 
71
 
85
 Sound &getSound() {
72
 Sound &getSound() {
73
+#ifdef USING_AL
74
+    static SoundAL gSound;
75
+#else
76
+    static SoundNull gSound;
77
+#endif
86
     return gSound;
78
     return gSound;
87
 }
79
 }
88
 
80
 
89
 TextureManager &getTextureManager() {
81
 TextureManager &getTextureManager() {
82
+    static TextureManager gTextureManager;
90
     return gTextureManager;
83
     return gTextureManager;
91
 }
84
 }
92
 
85
 
93
 Window &getWindow() {
86
 Window &getWindow() {
87
+#ifdef USING_SDL
88
+    static WindowSDL gWindow;
89
+#endif
94
     return gWindow;
90
     return gWindow;
95
 }
91
 }
96
 
92
 
97
 World &getWorld() {
93
 World &getWorld() {
94
+    static World gWorld;
98
     return gWorld;
95
     return gWorld;
99
 }
96
 }
100
 
97
 
151
 
148
 
152
     // Try to load a configuration
149
     // Try to load a configuration
153
     if (configArg) {
150
     if (configArg) {
154
-        if (gOpenRaider.loadConfig(argv[1]) != 0) {
151
+        if (getOpenRaider().loadConfig(argv[1]) != 0) {
155
             std::cout << "Could not find the specified config file. Aborting..." << std::endl;
152
             std::cout << "Could not find the specified config file. Aborting..." << std::endl;
156
             return 2;
153
             return 2;
157
         }
154
         }
158
     } else {
155
     } else {
159
-        if (gOpenRaider.loadConfig(DEFAULT_CONFIG_FILE) != 0) {
160
-            if (gOpenRaider.loadConfig(DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE) != 0) {
156
+        if (getOpenRaider().loadConfig(DEFAULT_CONFIG_FILE) != 0) {
157
+            if (getOpenRaider().loadConfig(DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE) != 0) {
161
                 std::cout << "Could not find a config file. Aborting..." << std::endl;
158
                 std::cout << "Could not find a config file. Aborting..." << std::endl;
162
                 return 3;
159
                 return 3;
163
             }
160
             }
165
     }
162
     }
166
 
163
 
167
     // Initialize everything
164
     // Initialize everything
168
-    int error = gOpenRaider.initialize();
165
+    int error = getOpenRaider().initialize();
169
     if (error != 0) {
166
     if (error != 0) {
170
         std::cout << "Could not initialize OpenRaider (" << error << ")!" << std::endl;
167
         std::cout << "Could not initialize OpenRaider (" << error << ")!" << std::endl;
171
         return 4;
168
         return 4;
172
     }
169
     }
173
 
170
 
174
     // Enter Main loop
171
     // Enter Main loop
175
-    gConsole.print("Starting %s", VERSION);
176
-    gOpenRaider.run();
172
+    getConsole().print("Starting %s", VERSION);
173
+    getOpenRaider().run();
177
 
174
 
178
     return 0;
175
     return 0;
179
 }
176
 }

Loading…
Cancel
Save