diff --git a/.travis.yml b/.travis.yml index 44527b49..484c7296 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,10 +17,10 @@ matrix: env: ARCH=amd64 INSTALL_GLFW=YES USE_EXTERNAL_GLFW=OFF sudo: required - os: linux - env: ARCH=amd64 INSTALL_GLFW=YES RELEASE=NO + env: ARCH=amd64 INSTALL_GLFW=YES OPENAL=ON RELEASE=NO sudo: required - os: linux - env: USE_WAYLAND=ON ARCH=amd64 RELEASE=NO + env: WAYLAND=ON ARCH=amd64 RELEASE=NO sudo: required addons: apt: @@ -46,12 +46,9 @@ matrix: before_script: before_install: - - if [ -z "$USE_EXTERNAL_GLFW" ]; then - export USE_EXTERNAL_GLFW=IF_POSSIBLE; - fi - - if [ -z "$SHARED" ]; then - export SHARED=ON; - fi + - if [ -z "$USE_EXTERNAL_GLFW" ]; then USE_EXTERNAL_GLFW=IF_POSSIBLE; fi + - if [ -z "$SHARED" ]; then SHARED=ON ; fi + - if [ -z "$OPENAL" ]; then OPENAL=OFF ; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then if [[ "$ARCH" == *-android ]]; then export RAYLIB_PACKAGE_SUFFIX="-Android-arm64"; @@ -59,32 +56,32 @@ before_install: unzip -qq android-ndk*.zip; if [[ "$ARCH" == arm64-* ]]; then export RAYLIB_PACKAGE_SUFFIX="-Android-arm64"; - export TOOLCHAIN_ARCH=arm64; - export PREFIX=aarch64-linux-android-; + TOOLCHAIN_ARCH=arm64; + PREFIX=aarch64-linux-android-; else export RAYLIB_PACKAGE_SUFFIX="-Android-arm32"; - export TOOLCHAIN_ARCH=arm; - export PREFIX=arm-linux-androideabi-; + TOOLCHAIN_ARCH=arm; + PREFIX=arm-linux-androideabi-; fi; android-ndk*/build/tools/make_standalone_toolchain.py --arch $TOOLCHAIN_ARCH --api 21 --install-dir /tmp/android-toolchain; export PATH=/tmp/android-toolchain/bin:$PATH; export CC=${PREFIX}clang; export CXX=${PREFIX}clang++; - export CMAKE_ARCH_ARGS='-DPLATFORM=Android'; + CMAKE_ARCH_ARGS='-DPLATFORM=Android'; elif [ "$ARCH" == "html5" ]; then export RAYLIB_PACKAGE_SUFFIX="-html5"; docker run --privileged=true -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash; - export CMAKE_ARCH_ARGS='-DPLATFORM=Web -DCMAKE_TOOLCHAIN_FILE=../cmake/emscripten.cmake'; - export RUNNER='docker exec -it emscripten cmake -E chdir build'; + CMAKE_ARCH_ARGS='-DPLATFORM=Web -DCMAKE_TOOLCHAIN_FILE=../cmake/emscripten.cmake'; + RUNNER='docker exec -it emscripten cmake -E chdir build'; else sudo apt-get install -y gcc-multilib libasound2-dev:$ARCH libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH libx11-dev:$ARCH libxrandr-dev:$ARCH libxrandr2:$ARCH libxi-dev:$ARCH libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH; - if [ "$ARCH" == "i386" ]; then - export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu'; - fi; + + if [ "$OPENAL" == "ON" ]; then sudo apt-get install -y libopenal-dev; fi; + if [ "$ARCH" == "i386" ]; then CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu'; fi; export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; if [ "$INSTALL_GLFW" == "YES" ]; then wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_3.2.1-1_amd64.deb'; @@ -102,7 +99,7 @@ before_install: script: - cd build - - if test -n "${USE_WAYLAND}"; + - if test -n "$WAYLAND"; then wget https://mirrors.kernel.org/ubuntu/pool/universe/e/extra-cmake-modules/extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb; sudo dpkg -i extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb; git clone git://anongit.freedesktop.org/wayland/wayland-protocols; @@ -110,9 +107,16 @@ script: git checkout 1.12 && ./autogen.sh --prefix=/usr && make && sudo make install; popd; fi - - $RUNNER cmake $CMAKE_ARCH_ARGS -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=$SHARED -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=$USE_EXTERNAL_GLFW -DUSE_WAYLAND=${USE_WAYLAND} .. + - $RUNNER cmake $CMAKE_ARCH_ARGS + -DMACOS_FATLIB=ON + -DSTATIC=ON -DSHARED=$SHARED + -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON + -DUSE_EXTERNAL_GLFW=$USE_EXTERNAL_GLFW + -DUSE_WAYLAND=$WAYLAND + -DUSE_OPENAL_BACKEND=$OPENAL + .. - $RUNNER make VERBOSE=1 - - if [ "$RELEASE" != "NO" ]; then $RUNNER make package; fi; + - if [ "$RELEASE" != "NO" ]; then $RUNNER make package; fi - sudo $RUNNER make install - if [[ "$ARCH" != *-android && "$ARCH" != html5 ]]; then pkg-config --static --libs raylib; diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 417384ad..57829407 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -3,8 +3,10 @@ cmake_minimum_required(VERSION 2.8.0) add_definitions("-DRAYLIB_CMAKE=1") -# Linking for OS X -framework options -# Will do nothing on other OSes +if (${USE_OPENAL_BACKEND}) + find_package(OpenAL REQUIRED) +endif() + if(${PLATFORM} MATCHES "Android") find_library(OPENGL_LIBRARY OpenGL) set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c) @@ -22,8 +24,6 @@ else() set(OPENGL_LIBRARIES "GL") endif() - include_directories(${OPENGL_INCLUDE_DIR}) - if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD") find_library(OSS_LIBRARY ossaudio) endif() @@ -31,6 +31,9 @@ else() set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY}) endif() +include_directories(${OPENGL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR}) +set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY}) + if(${PLATFORM} MATCHES "Desktop") if(USE_EXTERNAL_GLFW STREQUAL "ON") find_package(glfw3 3.2.1 REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 05e3c0d2..e6cfe8b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,10 +40,16 @@ endif() include(utils) if(USE_AUDIO) + if (NOT USE_OPENAL_BACKEND) + file(GLOB mini_al external/mini_al.c) + MESSAGE(STATUS "Audio Backend: mini_al") + else() + MESSAGE(STATUS "Audio Backend: OpenAL") + endif() file(GLOB stb_vorbis external/stb_vorbis.c) - file(GLOB mini_al external/mini_al.c ${stb_vorbis}) - set(sources ${raylib_sources} ${mini_al}) + set(sources ${raylib_sources} ${mini_al} ${stb_vorbis}) else() + MESSAGE(STATUS "Audio Backend: None (-DUSE_AUDIO=OFF)") set(INCLUDE_AUDIO_MODULE 0) list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio.c) set(sources ${raylib_sources})