Travis CI: Test Android configuration (#546)
I don't know if this actually works, but it compiles, which is good enough for CI.
This commit is contained in:
commit
cea78e4fc1
16 changed files with 187 additions and 69 deletions
21
.travis.yml
21
.travis.yml
|
@ -29,11 +29,25 @@ matrix:
|
||||||
- libegl1-mesa-dev
|
- libegl1-mesa-dev
|
||||||
- os: osx
|
- os: osx
|
||||||
env: ARCH=universal
|
env: ARCH=universal
|
||||||
|
- os: linux
|
||||||
|
env: ARCH=arm64-android
|
||||||
|
sudo: required
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
- export PLATFORM=Desktop
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||||
|
if [[ "$ARCH" == *-android ]]; then
|
||||||
|
export RAYLIB_PACKAGE_SUFFIX="-Android-arm64";
|
||||||
|
wget https://dl.google.com/android/repository/android-ndk-r17-linux-x86_64.zip;
|
||||||
|
unzip -qq android-ndk*.zip;
|
||||||
|
android-ndk*/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir /tmp/android-toolchain;
|
||||||
|
export PATH=/tmp/android-toolchain/bin:$PATH;
|
||||||
|
export PLATFORM=Android;
|
||||||
|
export CC=aarch64-linux-android-clang;
|
||||||
|
export CXX=aarch64-linux-android-clang++;
|
||||||
|
else
|
||||||
sudo apt-get install -y gcc-multilib
|
sudo apt-get install -y gcc-multilib
|
||||||
libasound2-dev:$ARCH
|
libasound2-dev:$ARCH
|
||||||
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
|
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
|
||||||
|
@ -48,6 +62,7 @@ before_install:
|
||||||
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
|
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
|
||||||
sudo dpkg -i libglfw3_3.2.1-1_amd64.deb libglfw3-dev_3.2.1-1_amd64.deb;
|
sudo dpkg -i libglfw3_3.2.1-1_amd64.deb libglfw3-dev_3.2.1-1_amd64.deb;
|
||||||
fi;
|
fi;
|
||||||
|
fi;
|
||||||
fi
|
fi
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
export RAYLIB_PACKAGE_SUFFIX="-macOS";
|
export RAYLIB_PACKAGE_SUFFIX="-macOS";
|
||||||
|
@ -66,12 +81,14 @@ script:
|
||||||
git checkout 1.12 && ./autogen.sh --prefix=/usr && make && sudo make install;
|
git checkout 1.12 && ./autogen.sh --prefix=/usr && make && sudo make install;
|
||||||
popd;
|
popd;
|
||||||
fi
|
fi
|
||||||
- cmake $CMAKE_ARCH_ARGS -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE -DUSE_WAYLAND=${USE_WAYLAND} ..
|
- cmake $CMAKE_ARCH_ARGS -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE -DUSE_WAYLAND=${USE_WAYLAND} -DPLATFORM=${PLATFORM} ..
|
||||||
- make VERBOSE=1
|
- make VERBOSE=1
|
||||||
- if [ "$GLFW" != "SYSTEM" ]; then make package; fi;
|
- if [ "$GLFW" != "SYSTEM" ]; then make package; fi;
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- pkg-config --static --libs raylib
|
- pkg-config --static --libs raylib
|
||||||
- nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false)
|
- if [[ "$ARCH" != *-android ]]; then
|
||||||
|
nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false);
|
||||||
|
fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
# Config options
|
# Config options
|
||||||
option(BUILD_EXAMPLES "Build the examples." ON)
|
option(BUILD_EXAMPLES "Build the examples." ON)
|
||||||
|
@ -15,47 +16,25 @@ else()
|
||||||
set (CMAKE_C_STANDARD 99)
|
set (CMAKE_C_STANDARD 99)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
include(AddIfFlagCompiles)
|
||||||
function(add_if_flag_works flag)
|
add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
|
||||||
CHECK_C_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
|
add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
||||||
set(outcome "Failed")
|
|
||||||
if(COMPILER_HAS_THOSE_TOGGLES)
|
|
||||||
foreach(var ${ARGN})
|
|
||||||
set(${var} "${flag} ${${var}}" PARENT_SCOPE)
|
|
||||||
endforeach()
|
|
||||||
set(outcome "works")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Testing if ${flag} can be used -- ${outcome}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
add_if_flag_works(-Werror=pointer-arith CMAKE_C_FLAGS)
|
|
||||||
add_if_flag_works(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
|
||||||
# src/external/jar_xm.h does shady stuff
|
# src/external/jar_xm.h does shady stuff
|
||||||
add_if_flag_works(-fno-strict-aliasing CMAKE_C_FLAGS)
|
add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)
|
||||||
|
|
||||||
message(STATUS "Testing if file system supports symlinks")
|
include(CheckFileSystemSymlinkSupport)
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink CMakeLists.txt "${CMAKE_CURRENT_BINARY_DIR}/TestingIfSymlinkWorks"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
RESULT_VARIABLE FILESYSTEM_LACKS_SYMLINKS
|
|
||||||
)
|
|
||||||
If (FILESYSTEM_LACKS_SYMLINKS)
|
|
||||||
message(STATUS "Testing if file system supports symlinks -- unsupported")
|
|
||||||
else()
|
|
||||||
message(STATUS "Testing if file system supports symlinks -- supported")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ENABLE_ASAN)
|
if (ENABLE_ASAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
if (ENABLE_UBSAN)
|
if (ENABLE_UBSAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
if (ENABLE_MSAN)
|
if (ENABLE_MSAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_MSAN AND ENABLE_ASAN)
|
if (ENABLE_MSAN AND ENABLE_ASAN)
|
||||||
|
|
12
cmake/AddIfFlagCompiles.cmake
Normal file
12
cmake/AddIfFlagCompiles.cmake
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
function(add_if_flag_compiles flag)
|
||||||
|
CHECK_C_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
|
||||||
|
set(outcome "Failed")
|
||||||
|
if(COMPILER_HAS_THOSE_TOGGLES)
|
||||||
|
foreach(var ${ARGN})
|
||||||
|
set(${var} "${flag} ${${var}}" PARENT_SCOPE)
|
||||||
|
endforeach()
|
||||||
|
set(outcome "compiles")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Testing if ${flag} can be used -- ${outcome}")
|
||||||
|
endfunction()
|
43
cmake/BuildType.cmake
Normal file
43
cmake/BuildType.cmake
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Set a default build type if none was specified
|
||||||
|
set(default_build_type "Release")
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||||
|
set(default_build_type "Debug")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||||
|
STRING "Choose the type of build." FORCE)
|
||||||
|
# Set the possible values of build type for cmake-gui
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||||
|
"MinSizeRel" "RelWithDebInfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Taken from the https://github.com/OpenChemistry/tomviz project
|
||||||
|
# Copyright (c) 2014-2017, Kitware, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
13
cmake/CheckFileSystemSymlinkSupport.cmake
Normal file
13
cmake/CheckFileSystemSymlinkSupport.cmake
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Populates a ${FILESYSTEM_LACKS_SYMLINKS} variable
|
||||||
|
message(STATUS "Testing if file system supports symlinks")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink CMakeLists.txt "${CMAKE_CURRENT_BINARY_DIR}/TestingIfSymlinkWorks"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE FILESYSTEM_LACKS_SYMLINKS
|
||||||
|
)
|
||||||
|
If (FILESYSTEM_LACKS_SYMLINKS)
|
||||||
|
message(STATUS "Testing if file system supports symlinks -- unsupported")
|
||||||
|
else()
|
||||||
|
message(STATUS "Testing if file system supports symlinks -- supported")
|
||||||
|
endif()
|
||||||
|
|
|
@ -16,6 +16,9 @@ if(APPLE)
|
||||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
# no pkg-config --static on Windows yet...
|
# no pkg-config --static on Windows yet...
|
||||||
|
elseif(${PLATFORM} MATCHES "Android")
|
||||||
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
|
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||||
else()
|
else()
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
|
@ -38,13 +41,15 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
|
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
||||||
find_package(glfw3 3.2.1 REQUIRED)
|
find_package(glfw3 3.2.1 REQUIRED)
|
||||||
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
||||||
find_package(glfw3 3.2.1 QUIET)
|
find_package(glfw3 3.2.1 QUIET)
|
||||||
endif()
|
endif()
|
||||||
if (glfw3_FOUND)
|
if (glfw3_FOUND)
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(examples)
|
project(examples)
|
||||||
|
|
||||||
include("../utils.cmake")
|
include("../cmake/utils.cmake")
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
# TODO `build` directory should maybe be something else...
|
# TODO `build` directory should maybe be something else...
|
||||||
|
@ -40,6 +40,29 @@ if(NOT HAVE_OCULUS_CAPI)
|
||||||
endif()
|
endif()
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
||||||
|
|
||||||
|
if(${PLATFORM} MATCHES "Android")
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_first_person.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
|
||||||
|
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_generation.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_heightmap.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_billboard.c)
|
||||||
|
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Do each example
|
# Do each example
|
||||||
foreach(example_source ${example_sources})
|
foreach(example_source ${example_sources})
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(games)
|
project(games)
|
||||||
|
|
||||||
include("../utils.cmake")
|
include("../cmake/utils.cmake")
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
# TODO `build` directory should maybe be something else...
|
# TODO `build` directory should maybe be something else...
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(drturtle)
|
project(drturtle)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(just_do)
|
project(just_do)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(koala_seasons)
|
project(koala_seasons)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(light_my_ritual)
|
project(light_my_ritual)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(skully_escape)
|
project(skully_escape)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(wave_collector)
|
project(wave_collector)
|
||||||
|
|
||||||
include("../../utils.cmake")
|
include("../../cmake/utils.cmake")
|
||||||
|
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(raylib)
|
project(raylib)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
||||||
|
|
||||||
set(PROJECT_VERSION 2.0.0)
|
set(PROJECT_VERSION 2.0.0)
|
||||||
set(API_VERSION 2)
|
set(API_VERSION 2)
|
||||||
set(RAYLIB raylib) # Name of the generated library
|
set(RAYLIB raylib) # Name of the generated library
|
||||||
|
|
||||||
include("CMakeOptions.txt")
|
include("CMakeOptions.txt")
|
||||||
|
include(BuildType)
|
||||||
configure_file(config.h.in ${CMAKE_BINARY_DIR}/cmake/config.h)
|
configure_file(config.h.in ${CMAKE_BINARY_DIR}/cmake/config.h)
|
||||||
include_directories(${CMAKE_BINARY_DIR})
|
include_directories(${CMAKE_BINARY_DIR})
|
||||||
|
include_directories(SYSTEM .)
|
||||||
|
|
||||||
if(MACOS_FATLIB)
|
if(MACOS_FATLIB)
|
||||||
if (CMAKE_OSX_ARCHITECTURES)
|
if (CMAKE_OSX_ARCHITECTURES)
|
||||||
|
@ -22,7 +25,7 @@ endif()
|
||||||
file(GLOB raylib_sources *.c)
|
file(GLOB raylib_sources *.c)
|
||||||
list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
|
list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
|
||||||
|
|
||||||
if(NOT glfw3_FOUND)
|
if(NOT glfw3_FOUND AND "${PLATFORM}" MATCHES "Desktop")
|
||||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
|
@ -39,7 +42,7 @@ if(NOT glfw3_FOUND)
|
||||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include("../utils.cmake")
|
include(utils)
|
||||||
|
|
||||||
if(USE_AUDIO)
|
if(USE_AUDIO)
|
||||||
file(GLOB stb_vorbis external/stb_vorbis.c)
|
file(GLOB stb_vorbis external/stb_vorbis.c)
|
||||||
|
@ -51,6 +54,8 @@ else()
|
||||||
set(sources ${raylib_sources})
|
set(sources ${raylib_sources})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(AddIfFlagCompiles)
|
||||||
|
|
||||||
### Config options ###
|
### Config options ###
|
||||||
# Translate the config options to what raylib wants
|
# Translate the config options to what raylib wants
|
||||||
if(${PLATFORM} MATCHES "Desktop")
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
|
@ -90,14 +95,27 @@ elseif(${PLATFORM} MATCHES "Web")
|
||||||
elseif(${PLATFORM} MATCHES "Android")
|
elseif(${PLATFORM} MATCHES "Android")
|
||||||
set(PLATFORM "PLATFORM_ANDROID")
|
set(PLATFORM "PLATFORM_ANDROID")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
add_if_flag_compiles(-ffunction-sections CMAKE_C_FLAGS)
|
||||||
|
add_if_flag_compiles(-funwind-tables CMAKE_C_FLAGS)
|
||||||
|
add_if_flag_compiles(-fstack-protector-strong CMAKE_C_FLAGS)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS)
|
||||||
|
add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS)
|
||||||
|
add_definitions(-DANDROID -D__ANDROID_API__=21)
|
||||||
|
include_directories(external/android/native_app_glue )
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate")
|
||||||
|
|
||||||
elseif(${PLATFORM} MATCHES "Raspberry Pi")
|
elseif(${PLATFORM} MATCHES "Raspberry Pi")
|
||||||
set(PLATFORM "PLATFORM_RPI")
|
set(PLATFORM "PLATFORM_RPI")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Which platform?
|
# Which platform?
|
||||||
if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
if(${PLATFORM} MATCHES "PLATFORM_WEB")
|
||||||
|
# For the web.
|
||||||
|
add_executable(${RAYLIB} ${sources})
|
||||||
|
|
||||||
|
else()
|
||||||
if(${SHARED})
|
if(${SHARED})
|
||||||
add_library(${RAYLIB}_shared SHARED ${sources})
|
add_library(${RAYLIB}_shared SHARED ${sources})
|
||||||
|
|
||||||
|
@ -111,7 +129,10 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set(CMAKE_MACOSX_RPATH ON)
|
set(CMAKE_MACOSX_RPATH ON)
|
||||||
|
|
||||||
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE} glfw ${GLFW_LIBRARIES})
|
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
|
||||||
|
if (${PLATFORM} MATCHES "Desktop")
|
||||||
|
target_link_libraries(${RAYLIB}_shared glfw ${GLFW_LIBRARIES})
|
||||||
|
endif()
|
||||||
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
|
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
|
||||||
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
|
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
|
||||||
else()
|
else()
|
||||||
|
@ -148,7 +169,9 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE})
|
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||||
|
if (${PLATFORM} MATCHES "Desktop")
|
||||||
target_link_libraries(${RAYLIB} glfw ${GLFW_LIBRARIES})
|
target_link_libraries(${RAYLIB} glfw ${GLFW_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_PIC)
|
if (WITH_PIC)
|
||||||
set_property(TARGET ${RAYLIB} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET ${RAYLIB} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
@ -169,9 +192,6 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
file(COPY "physac.h" DESTINATION ".")
|
file(COPY "physac.h" DESTINATION ".")
|
||||||
file(COPY "raymath.h" DESTINATION ".")
|
file(COPY "raymath.h" DESTINATION ".")
|
||||||
file(COPY "audio.h" DESTINATION ".")
|
file(COPY "audio.h" DESTINATION ".")
|
||||||
elseif(${PLATFORM} MATCHES "PLATFORM_WEB")
|
|
||||||
# For the web.
|
|
||||||
add_executable(${RAYLIB} ${sources})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Print the flags for the user
|
# Print the flags for the user
|
||||||
|
|
|
@ -57,6 +57,12 @@
|
||||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
||||||
#include <string.h> // Required for: strlen(), strrchr(), strcmp()
|
#include <string.h> // Required for: strlen(), strrchr(), strcmp()
|
||||||
|
|
||||||
|
/* This should be in <stdio.h>, but Travis doesn't find it... */
|
||||||
|
FILE *funopen(const void *cookie, int (*readfn)(void *, char *, int),
|
||||||
|
int (*writefn)(void *, const char *, int),
|
||||||
|
fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *));
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
#include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png()
|
#include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue