mirror of https://github.com/raysan5/raylib
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.
This commit is contained in:
parent
853cc6f4c9
commit
f991a075e1
|
@ -132,3 +132,8 @@ build
|
|||
|
||||
# Ignore Android generated files and folders
|
||||
templates/android_project/output
|
||||
|
||||
# Ignore GNU global tags
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
|
|
@ -41,7 +41,7 @@ before_install:
|
|||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF ..
|
||||
- cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED ..
|
||||
- make
|
||||
- make package
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -63,7 +63,7 @@ static void UpdateDrawFrame(void); // Update and Draw one frame
|
|||
#if defined(PLATFORM_ANDROID)
|
||||
void android_main(struct android_app *app)
|
||||
#else
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
// Initialization
|
||||
|
@ -315,4 +315,4 @@ static void UpdateDrawFrame(void)
|
|||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ if(${PLATFORM} MATCHES "Desktop")
|
|||
if(APPLE)
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
set_source_files_properties(rglfw.c PROPERTIES COMPILE_FLAGS "-x objective-c")
|
||||
link_libraries("-framework CoreFoundation -framework Cocoa -framework IOKit -framework CoreVideo")
|
||||
link_libraries("${LIBS_PRIVATE}")
|
||||
elseif(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
|
12
utils.cmake
12
utils.cmake
|
@ -12,8 +12,12 @@ if(APPLE)
|
|||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
find_library(OPENAL_LIBRARY OpenAL)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
||||
find_library(COREVIDEO_LIBRARY CoreVideo)
|
||||
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY})
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY}
|
||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||
elseif(LINUX)
|
||||
# Elsewhere (such as Linux), need `-lopenal -lGL`, etc...
|
||||
set(LIBS_PRIVATE
|
||||
|
@ -27,10 +31,10 @@ endif()
|
|||
|
||||
# Do the linking for executables that are meant to link raylib
|
||||
function(link_libraries_to_executable executable)
|
||||
# Link the libraries
|
||||
target_link_libraries(${executable} ${LIBS_PRIVATE})
|
||||
|
||||
# And raylib
|
||||
target_link_libraries(${executable} raylib)
|
||||
|
||||
# Link the libraries
|
||||
target_link_libraries(${executable} ${LIBS_PRIVATE})
|
||||
endfunction()
|
||||
|
||||
|
|
Loading…
Reference in New Issue