summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2017-11-25 20:27:53 +0100
committerAhmad Fatoum <[email protected]>2017-11-25 21:45:31 +0100
commitf991a075e18df5e58bd6f6f90c1b02b5b353cbe3 (patch)
tree051e2194584b063f9af06d8551b2e96d323b1528 /examples
parent853cc6f4c96f4de94a11aa8317e98fd0e42c64fd (diff)
downloadraylib-f991a075e18df5e58bd6f6f90c1b02b5b353cbe3.tar.gz
raylib-f991a075e18df5e58bd6f6f90c1b02b5b353cbe3.zip
Build examples and games on Travis CI
They were disabled because they failed to build, but this patch set fixes the build on Linux and macOS. This doesn't apply to the AppVeyor build on Windows yet; it currently fails at linking with OpenAL.
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt21
-rw-r--r--examples/others/audio_standalone.c7
2 files changed, 22 insertions, 6 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 354a1373..96ce37e0 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -7,9 +7,20 @@ include("../utils.cmake")
# TODO `build` directory should maybe be something else...
# TODO place somewhere else?
include_directories("../build/release")
+include_directories("../src/external")
+include_directories("../src/external/glfw/include")
# Get the sources together
-set(example_dirs audio core models others physac shaders text texutures)
+set(example_dirs audio core models others shaders text texutures)
+set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=199309L)
+ include(CheckSymbolExists)
+ check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
+ check_symbol_exists(QueryPerformanceCounter windows.h HAVE_QPC)
+set(CMAKE_REQUIRED_DEFINITIONS)
+if(HAVE_QPC OR HAVE_CLOCK_MONOTONIC)
+ set(example_dirs ${example_dirs} physac)
+endif()
+
set(example_sources)
set(example_resources)
foreach(example_dir ${example_dirs})
@@ -22,6 +33,14 @@ foreach(example_dir ${example_dirs})
list(APPEND example_resources ${resources})
endforeach()
+include(CheckIncludeFiles)
+check_include_files(OVR_CAPI_GL.h HAVE_OCULUS_CAPI)
+if(NOT HAVE_OCULUS_CAPI)
+ list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/oculus_rift.c)
+endif()
+list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
+
+
# Do each example
foreach(example_source ${example_sources})
# Create the basename for the example
diff --git a/examples/others/audio_standalone.c b/examples/others/audio_standalone.c
index 0a09c988..97c3fd0d 100644
--- a/examples/others/audio_standalone.c
+++ b/examples/others/audio_standalone.c
@@ -26,14 +26,11 @@
********************************************************************************************/
#include <stdio.h>
+#include "audio.h"
#if defined(_WIN32)
#include <conio.h> // Windows only, no stardard library
-#endif
-
-#include "audio.h"
-
-#if defined(__linux__)
+#else
#include <stdio.h>
#include <termios.h>
#include <unistd.h>