From 9ec8c0f1d6d7b4cace71930cfefcc17f68a6d424 Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 22 Nov 2017 17:29:46 +0100 Subject: Updated OSX compilation with clang --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 703206e2..a621217d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; wget 'https://github.com/a3f/GLFW-3.2.1-Debian-binary-package/releases/download/v3.2.1/GLFW-3.2.1-Linux.deb' && sudo dpkg -i GLFW-3.2.1-Linux.deb; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; export CC=clang fi - "$CC --version" script: -- cgit v1.2.3 From f70a0a996cc7a9a3cd1f5e3c7e3466b1d2528fd3 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 22 Nov 2017 19:51:38 +0100 Subject: Review file issue --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index a621217d..7a5148ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; wget 'https://github.com/a3f/GLFW-3.2.1-Debian-binary-package/releases/download/v3.2.1/GLFW-3.2.1-Linux.deb' && sudo dpkg -i GLFW-3.2.1-Linux.deb; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; export CC=clang fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; export CC=clang; fi - "$CC --version" script: -- cgit v1.2.3 From b2acff66dec7bce30e9704aa9b13070f7c3ffac1 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 22 Nov 2017 22:33:47 +0100 Subject: Fix macOS build of new rglfw.c approach There have been two problems: * GLFW itself was compiled with the definitions for compiling _against_ GLFW (fixed by removing requirement for external glfw) * rglfw.c was being compiled as C code, although it includes Objective C files. This _might_ break the Windows build, needs to be checked. Fixes #391, but as noted I'd prefer though a separate source directory and build script for GLFW. --- .travis.yml | 3 +-- src/CMakeLists.txt | 6 +++--- src/gestures.h | 6 +++--- src/rglfw.c | 2 +- utils.cmake | 7 ------- 5 files changed, 8 insertions(+), 16 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 7a5148ad..8b122c47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,8 @@ before_install: libopenal-dev libxcursor-dev libxinerama-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; - wget 'https://github.com/a3f/GLFW-3.2.1-Debian-binary-package/releases/download/v3.2.1/GLFW-3.2.1-Linux.deb' && sudo dpkg -i GLFW-3.2.1-Linux.deb; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; export CC=clang; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; fi - "$CC --version" script: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a398d665..f362b52f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,7 @@ set(OPENGL_VERSION "3.3" CACHE STRING "OpenGL Version to build raylib with") set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0") ### Config options ### +include_directories(external/glfw/include) # Translate the config options to what raylib wants if(${PLATFORM} MATCHES "Desktop") @@ -40,6 +41,8 @@ if(${PLATFORM} MATCHES "Desktop") # See: https://github.com/raysan5/raylib/issues/341 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") endif() elseif(${PLATFORM} MATCHES "Web") set(PLATFORM "PLATFORM_WEB") @@ -93,9 +96,6 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") target_link_libraries(${RAYLIB} GL) endif() - # Add in GLFW as a linking target - target_link_libraries(${RAYLIB} glfw) - # Library file & Header set_target_properties(${RAYLIB} PROPERTIES PUBLIC_HEADER "raylib.h") install( diff --git a/src/gestures.h b/src/gestures.h index 2e343154..e2f004e2 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -140,9 +140,6 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang #if defined(GESTURES_IMPLEMENTATION) -#include // Required for: atan2(), sqrt() -#include // Required for: uint64_t - #if defined(_WIN32) // Functions required to query time on Windows int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount); @@ -154,6 +151,9 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang #endif #include // Required for: timespec #include // Required for: clock_gettime() + + #include // Required for: atan2(), sqrt() + #include // Required for: uint64_t #endif //---------------------------------------------------------------------------------- diff --git a/src/rglfw.c b/src/rglfw.c index b1b4eed7..83e0021b 100644 --- a/src/rglfw.c +++ b/src/rglfw.c @@ -86,5 +86,5 @@ #include "external/glfw/src/posix_thread.c" #include "external/glfw/src/nsgl_context.m" #include "external/glfw/src/egl_context.c" - #include "external/glfw/src/osmesa_context.c.m" + #include "external/glfw/src/osmesa_context.c" #endif diff --git a/utils.cmake b/utils.cmake index c902f60e..f260fa5e 100644 --- a/utils.cmake +++ b/utils.cmake @@ -6,10 +6,6 @@ if(UNIX AND NOT APPLE) set(LINUX TRUE) endif() -# Need GLFW 3.2.1 -find_package(glfw3 3.2.1 REQUIRED) - - # Linking for OS X -framework options # Will do nothing on other OSes function(link_os_x_frameworks binary) @@ -40,9 +36,6 @@ function(link_libraries_to_executable executable) # TODO windows endif() - # Add in GLFW as a linking target - target_link_libraries(${executable} glfw) - # And raylib target_link_libraries(${executable} raylib) endfunction() -- cgit v1.2.3 From 44376c04fa8ed5bc9ca48598afa1d177d169fa32 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 11 Oct 2017 22:33:09 +0200 Subject: Generate and install pkg-config pc file After installation, compiling new programs is possible with $ cc game.c `pkg-config --static --libs --cflags raylib` or $ cc game.c `pkg-config --libs --cflags raylib` depending on configuration Also adds following configuration options: - WITH_PIC "Compile static library as position-independent code" - STATIC_RAYLIB "Build raylib as a static library" - MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" --- .travis.yml | 8 ++-- appveyor.yml | 2 +- raylib.pc.in | 13 ++++++ src/CMakeLists.txt | 124 +++++++++++++++++++++++++++++++++++------------------ utils.cmake | 40 ++++++++--------- 5 files changed, 117 insertions(+), 70 deletions(-) create mode 100644 raylib.pc.in (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 8b122c47..ce4998c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ env: global: - VERBOSE=1 matrix: - - CFLAGS=-m64 - - CFLAGS=-m32 - + - CFLAGS=-m64 SHARED=ON + - CFLAGS=-m32 SHARED=OFF +# We don't install x11 32-bit libraries, so skip shared libraries on -m32 before_script: - export CFLAGS="-std=gnu99 $CFLAGS" @@ -32,7 +32,7 @@ before_install: script: - mkdir build - cd build - - cmake -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. + - cmake -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. - make # - make package # - sudo make install diff --git a/appveyor.yml b/appveyor.yml index 36f161c3..864d0c68 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,7 +37,7 @@ before_build: - cd build build_script: - - cmake -G %GENERATOR% -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. + - cmake -G %GENERATOR% -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. - cmake --build . --target install after_build: diff --git a/raylib.pc.in b/raylib.pc.in new file mode 100644 index 00000000..0472c283 --- /dev/null +++ b/raylib.pc.in @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: raylib +Description: Simple and easy-to-use library to learn videogames programming +URL: https://github.com/raysan5/raylib +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lraylib +Libs.private:@PKG_CONFIG_LIBS_PRIVATE@ +Requires.private: +Cflags: -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ab8e606..b29c29fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,8 +8,17 @@ set(RAYLIB raylib) # Name of the generated library ### Config options ### -# Build a static or shared raylib? +# Shared library is always PIC. Static library should be PIC too if linked into a shared library +set(WITH_PIC OFF CACHE BOOL "Compile static library as position-independent code" OFF) +# Build a static and/or shared raylib? set(SHARED_RAYLIB OFF CACHE BOOL "Build raylib as a dynamic library") +set(STATIC_RAYLIB ON CACHE BOOL "Build raylib as a static library") +set(MACOS_FATLIB ON CACHE BOOL "Build fat library for both i386 and x86_64 on macOS") + +if(NOT (STATIC_RAYLIB OR SHARED_RAYLIB)) + message(FATAL_ERROR "Nothing to do if both -DSHARED_RAYLIB=OFF and -DSTATIC_RAYLIB=OFF...") +endif() + # Platform set(PLATFORM "Desktop" CACHE STRING "Platform to build for.") @@ -66,6 +75,14 @@ elseif(${PLATFORM} MATCHES "Raspberry Pi") set(GRAPHICS "GRAPHICS_API_OPENGL_ES2") endif() +if(BUILD_MACOS_FATLIB) + if (CMAKE_OSX_ARCHITECTURES) + message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides BUILD_MACOS_FATLIB=ON") + else() + SET(CMAKE_OSX_ARCHITECTURES "x86_64;i386") + endif() +endif() + # Get the sources together file(GLOB raylib_sources *.c) file(GLOB stb_vorbis external/stb_vorbis.c) @@ -73,40 +90,72 @@ set(sources ${raylib_sources} ${stb_vorbis}) # Which platform? if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") - # Build a static or shared raylib? - # TODO clean this up a bit? - if(${SHARED_RAYLIB}) - # Shared library - add_library(${RAYLIB} SHARED ${sources}) - - # Will link -framework (if on OS X) - link_os_x_frameworks(raylib) - else() - # Static library - add_library(${RAYLIB} STATIC ${sources}) - - if(LINUX) - # On Linux, need to link a few extra things for static - target_link_libraries(${RAYLIB} m pthread dl) - target_link_libraries(${RAYLIB} X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff - endif() - endif() - - # Always need to link OpenAL and OpenGL + if(LINUX) - # Elsewhere (such as Linux), need `-lopenal -lGL` - target_link_libraries(${RAYLIB} openal) - target_link_libraries(${RAYLIB} GL) + foreach(L ${LIBS_PRIVATE}) + set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}") + endforeach(L) + + elseif(APPLE) + # TODO extract framework location and name from ${LIBS_PRIVATE} + # and specify them as -F and -framework instead of hardcoding + foreach(F OpenGL OpenAL Cocoa) + set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -framework ${F}") + endforeach(F) + endif() - - # Library file & Header - set_target_properties(${RAYLIB} PROPERTIES PUBLIC_HEADER "raylib.h") - install( - TARGETS ${RAYLIB} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - PUBLIC_HEADER DESTINATION include - ) + + if(${SHARED_RAYLIB}) + add_library(${RAYLIB}_shared SHARED ${sources}) + + target_compile_definitions(${RAYLIB}_shared + PUBLIC ${PLATFORM} + PUBLIC ${GRAPHICS} + ) + + set_property(TARGET ${RAYLIB}_shared PROPERTY POSITION_INDEPENDENT_CODE ON) + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_MACOSX_RPATH ON) + + target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE}) + set_target_properties(${RAYLIB}_shared PROPERTIES PUBLIC_HEADER "raylib.h") + if(WIN32) + install( + TARGETS ${RAYLIB}_shared + RUNTIME DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) + else() # Keep lib*.(a|dll) name, but avoid *.lib files overwriting each other on Windows + set_target_properties(${RAYLIB}_shared PROPERTIES OUTPUT_NAME ${RAYLIB}) + install( + TARGETS ${RAYLIB}_shared + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) + endif() + endif(${SHARED_RAYLIB}) + + if(${STATIC_RAYLIB}) + add_library(${RAYLIB} STATIC ${sources}) + + target_compile_definitions(${RAYLIB} + PUBLIC ${PLATFORM} + PUBLIC ${GRAPHICS} + ) + + if (WITH_PIC) + set_property(TARGET ${RAYLIB} PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() + set_target_properties(${RAYLIB} PROPERTIES PUBLIC_HEADER "raylib.h") + install(TARGETS ${RAYLIB} + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) + endif(${STATIC_RAYLIB}) + + configure_file(../raylib.pc.in raylib.pc @ONLY) + install(FILES ${CMAKE_BINARY_DIR}/release/raylib.pc DESTINATION lib/pkgconfig) # Copy the header files to the build directory file(COPY "raylib.h" DESTINATION ".") @@ -119,15 +168,6 @@ elseif(${PLATFORM} MATCHES "PLATFORM_WEB") add_executable(${RAYLIB} ${sources}) endif() - -# Set the compile flags to raylib -target_compile_definitions(${RAYLIB} - PUBLIC ${PLATFORM} - PUBLIC ${GRAPHICS} -) - - - # Print the flags for the user message(STATUS "Compiling with the flags:") message(STATUS " PLATFORM=" ${PLATFORM}) diff --git a/utils.cmake b/utils.cmake index f260fa5e..54221b9c 100644 --- a/utils.cmake +++ b/utils.cmake @@ -1,5 +1,5 @@ # All sorts of things that we need cross project -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 2.8.0) # Detect linux if(UNIX AND NOT APPLE) @@ -8,33 +8,27 @@ endif() # Linking for OS X -framework options # Will do nothing on other OSes -function(link_os_x_frameworks binary) - if(APPLE) - find_library(OPENGL_LIBRARY OpenGL) - find_library(OPENAL_LIBRARY OpenAL) - find_library(COCOA_LIBRARY Cocoa) - - set(OSX_FRAMEWORKS ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY}) - target_link_libraries(${binary} ${OSX_FRAMEWORKS}) - endif() -endfunction() +if(APPLE) + find_library(OPENGL_LIBRARY OpenGL) + find_library(OPENAL_LIBRARY OpenAL) + find_library(COCOA_LIBRARY Cocoa) + set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY}) +elseif(LINUX) + # Elsewhere (such as Linux), need `-lopenal -lGL`, etc... + set(LIBS_PRIVATE + m pthread dl + openal + GL + X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff +else() + # TODO Windows +endif() # Do the linking for executables that are meant to link raylib function(link_libraries_to_executable executable) # Link the libraries - if(APPLE) - # OS X, we use frameworks - link_os_x_frameworks(${executable}) - elseif(LINUX) - # Elsewhere (such as Linux), need `-lopenal -lGL`, etc... - target_link_libraries(${executable} m pthread dl) - target_link_libraries(${executable} openal) - target_link_libraries(${executable} GL) - target_link_libraries(${executable} X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff - else() - # TODO windows - endif() + target_link_libraries(${executable} ${LIBS_PRIVATE}) # And raylib target_link_libraries(${executable} raylib) -- cgit v1.2.3 From 49c5a433df48c1b9efafb70e51724c2fc3a5e608 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 24 Nov 2017 19:57:44 +0100 Subject: Setup CMake package target and CI auto-deploy tags cmake --build . --target package # or make package if make is used can now be used to create binary packages for raylib. AppVeyor and Travis CI are configured to push the artifacts that result from building git tags to the related Github releases page. --- .travis.yml | 52 ++++++++++++++++++++++++++++-------------------- README.md | 10 ++++++---- appveyor.yml | 58 ++++++++++++++++++++++++++++-------------------------- raylib.pc.in | 2 +- src/CMakeLists.txt | 16 +++++++++++++-- 5 files changed, 82 insertions(+), 56 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index ce4998c7..40817fba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,38 +12,48 @@ os: env: global: - VERBOSE=1 - matrix: - - CFLAGS=-m64 SHARED=ON - - CFLAGS=-m32 SHARED=OFF -# We don't install x11 32-bit libraries, so skip shared libraries on -m32 + matrix: # We don't install x11 32-bit libraries, so skip shared libraries on -m32 + - ARCH=i386 SHARED=OFF + - ARCH=amd64 SHARED=ON + +matrix: + exclude: # This is already covered by building universal (fat) libraries by default + - os: osx + env: ARCH=i386 SHARED=OFF + before_script: - - export CFLAGS="-std=gnu99 $CFLAGS" + - export CFLAGS="-std=gnu99" before_install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y gcc-multilib libopenal-dev libxcursor-dev libxinerama-dev - mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; + mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev + libgl1-mesa-dev libglu1-mesa-dev libglew-dev; + export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; + if [ "$ARCH" == "i386" ]; then export CFLAGS="$CFLAGS -m32"; fi; + if [ "$ARCH" == "amd64" ]; then export CFLAGS="$CFLAGS -m64"; fi; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export RAYLIB_PACKAGE_SUFFIX="-macOS"; fi - "$CC --version" script: - mkdir build - cd build - - cmake -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. + - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. - make -# - make package -# - sudo make install -# -#deploy: -# provider: releases -# api_key: -# secure: XXX -# file_glob: true -# file: raylib-*.tar.gz -# skip_cleanup: true -# on: -# branch: master -# tags: true + - make package + +deploy: + provider: releases + api_key: + secure: LvqUIAN/3dJul+Ra2iK3tSaNG5IwsNMmGIwVMy0DK5IBCxiQPBc9pWGiE30RTBPt6Z+N4BhMEE8DtUl+vnISlMoHWNIIhF2zwC66hs/F7zY7qEITMRSmfiLcqxQysknFOnJB06CATgXcFqlEo9j+t4abrG/f3qcb92J4O2uNz336Au2myTx93Q5MxbyA7KiUuEutFnb2dWiPCY4d+sGeXEfsiD2R7aj/8MaWOkoGdZVrTkI9juMgvpImkjQBArvqdjUMeT3MsRrwgOIq5v2GFV9dOl8k1WzPeT8B2JHh00ed/o1/wuFq/cLLOxtYo2+Pv3+xatOrlexoX0WkDm7C9/L1W5U4rLexU3CQ9mMBmHPnp6k/WXZ5QXEE4uUF0+LpN3XlIXzFpdZmZiVV8VLxg2WvyncMmivYiu7/MTkyfZxyKkzwl7sZZslzHA9kOGedGaN7b7/2B77OFHoQK8lKfdFml7jJnarh+89nenNZYMab0E8qkOJOyb2bYlDTa0/2nyxGiyymYgq6YHLNrDbhqB/1LzdgzjMliQ8ri5q9Ux2vjfcqOzhfAmcwFwnY/D6yXJWYi0DWpHZdpKl3du6dYDrypW91/yDWbwiJ/YhrE7ZunzrcB6GH/QkbuzWxdCth39rQAHih8DG01co/K3Gvi4yGjvIH5tFUpyEolMnpMiA= + file_glob: true + file: raylib-*.tar.gz + skip_cleanup: true + on: + repo: raysan5/raylib + branch: + - develop + - master diff --git a/README.md b/README.md index 0be62fda..1c078f52 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ features * Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD) * Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5** * VR stereo rendering support with configurable HMD device parameters - * Minimal external dependencies (GLFW3, OpenGL, OpenAL) + * Minimal external dependencies (OpenGL, OpenAL) * Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go)) raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option I found for @@ -44,10 +44,12 @@ to accomodate to Android, Raspberry Pi and HTML5. *On Raspberry Pi, Videocore API and EGL libraries are used for window/context management and raw inputs reading.* -building --------- +build and installation +---------------------- + +Binary releases for Windows, Linux and macOS are available at the [Github Releases](https://github.com/raysan5/raylib/releases) page. -For detailed building instructions, check [raylib Wiki](https://github.com/raysan5/raylib/wiki). +To build raylib yourself, check out the [raylib Wiki](https://github.com/raysan5/raylib/wiki) for detailed instructions. raylib has been developed using exclusively two tools: diff --git a/appveyor.yml b/appveyor.yml index 864d0c68..2363bd3f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,29 +10,30 @@ init: - cmake -E remove c:\programdata\chocolatey\bin\cpack.exe - set PATH=%PATH:C:\Program Files (x86)\Git\usr\bin;=% - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% - - set PATH=%prefix_dir%\bin;%PATH% + - if [%BITS%]==[32] set MINGW=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32 + - if [%BITS%]==[64] set MINGW=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64 + - if [%COMPILER%]==[mingw] set PATH=%MINGW%\bin;%PATH% + - set RAYLIB_PACKAGE_SUFFIX=-Win%BITS%-%COMPILER% + - set VERBOSE=1 environment: matrix: - - compiler: MinGW-w64 + - compiler: mingw bits: 32 - prefix_dir: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32 - - compiler: MinGW-w64 + - compiler: mingw bits: 64 - prefix_dir: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64 - - compiler: MSVC15 + - compiler: msvc15 bits: 32 - - compiler: MSVC15 + - compiler: msvc15 bits: 64 before_build: - appveyor DownloadFile http://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip - 7z x openal-soft-1.17.2-bin.zip - move openal-soft-1.17.2-bin src\external\openal - - if [%COMPILER%]==[MinGW-w64] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles" - - if [%COMPILER%]==[MSVC15] if [%BITS%]==[32] set GENERATOR="Visual Studio 14 2015" - - if [%COMPILER%]==[MSVC15] if [%BITS%]==[64] set GENERATOR="Visual Studio 14 2015 Win64" - - set VERBOSE=1 + - if [%compiler%]==[mingw] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles" + - if [%COMPILER%]==[msvc15] if [%BITS%]==[32] set GENERATOR="Visual Studio 14 2015" + - if [%COMPILER%]==[msvc15] if [%BITS%]==[64] set GENERATOR="Visual Studio 14 2015 Win64" - mkdir build - cd build @@ -41,25 +42,26 @@ build_script: - cmake --build . --target install after_build: -# - cmake --build . --target package + - cmake --build . --target package before_test: test_script: -#artifacts: -# - path: 'build\*.zip' -# -#deploy: -# description: 'Automatic build by CI' -# provider: GitHub -# auth_token: -# secure: XXX -# artifact: /.*\.zip/ -# draft: false -# prerelease: false -# force_update: true -# on: -# branch: master -# appveyor_repo_tag: true # deploy on tag push only -# +artifacts: + - path: 'build\*.zip' + +deploy: + description: 'Automatic build by CI' + provider: GitHub + auth_token: + secure: lqkfPGZPK828Mmopbicrng08QaaQXAshp0a9E3bMXt8+hpA8vCfDAT3jgU8kaSsW + artifact: /.*\.zip/ + draft: false + prerelease: false + force_update: true + on: + branch: + - master + - develop + appveyor_repo_tag: true # deploy on tag push only diff --git a/raylib.pc.in b/raylib.pc.in index 0472c283..93984363 100644 --- a/raylib.pc.in +++ b/raylib.pc.in @@ -5,7 +5,7 @@ includedir=${prefix}/include Name: raylib Description: Simple and easy-to-use library to learn videogames programming -URL: https://github.com/raysan5/raylib +URL: http://github.com/raysan5/raylib Version: @PROJECT_VERSION@ Libs: -L${libdir} -lraylib Libs.private:@PKG_CONFIG_LIBS_PRIVATE@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b29c29fc..1fec104f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,8 +2,7 @@ project(raylib) include("../utils.cmake") -set(raylib_VERSION_MAJOR 1) -set(raylib_VERSION_MINOR 8) +set(PROJECT_VERSION 1.9.0dev) set(RAYLIB raylib) # Name of the generated library @@ -173,3 +172,16 @@ message(STATUS "Compiling with the flags:") message(STATUS " PLATFORM=" ${PLATFORM}) message(STATUS " GRAPHICS=" ${GRAPHICS}) +# Packaging +SET(CPACK_PACKAGE_NAME "raylib") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple and easy-to-use library to learn videogames programming") +SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") +SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") +SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") +SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README.md") +SET(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/../README.md") +SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE.md") +SET(CPACK_PACKAGE_FILE_NAME "raylib-${PROJECT_VERSION}$ENV{RAYLIB_PACKAGE_SUFFIX}") +SET(CPACK_GENERATOR "ZIP;TGZ") # Remove this, if you want the NSIS installer on Windows +include(CPack) -- cgit v1.2.3 From 13fa61f7d9a4be326812a77a4148472961415776 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 24 Nov 2017 22:46:23 +0100 Subject: CI: Only push binaries for develop branch builds ... for now. Syntax was confusing Travis CI, AppVeyor is reporting 401, so lets see if this change at least fixes Travis. If this doesn't work, it might be that @raysan5's token is required. --- .travis.yml | 4 +--- appveyor.yml | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 40817fba..d7124970 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,4 @@ deploy: skip_cleanup: true on: repo: raysan5/raylib - branch: - - develop - - master + branch: develop diff --git a/appveyor.yml b/appveyor.yml index 2363bd3f..bfda4ec3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,16 +52,13 @@ artifacts: - path: 'build\*.zip' deploy: - description: 'Automatic build by CI' - provider: GitHub - auth_token: - secure: lqkfPGZPK828Mmopbicrng08QaaQXAshp0a9E3bMXt8+hpA8vCfDAT3jgU8kaSsW - artifact: /.*\.zip/ - draft: false - prerelease: false - force_update: true - on: - branch: - - master - - develop - appveyor_repo_tag: true # deploy on tag push only + - provider: GitHub + auth_token: + secure: lqkfPGZPK828Mmopbicrng08QaaQXAshp0a9E3bMXt8+hpA8vCfDAT3jgU8kaSsW + artifact: /.*\.zip/ + draft: false + prerelease: false + force_update: true + on: + branch: develop + appveyor_repo_tag: true # deploy on tag push only -- cgit v1.2.3 From d54ea107f7c1bf7c006f4782a435ba9c33e33f73 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 24 Nov 2017 23:03:02 +0100 Subject: [CI] Push Github artifacts only on tag Forgot that one the first time round, which created some unnecssary releases. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index d7124970..af381d5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,3 +55,4 @@ deploy: on: repo: raysan5/raylib branch: develop + tags: true -- cgit v1.2.3 From f991a075e18df5e58bd6f6f90c1b02b5b353cbe3 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 25 Nov 2017 20:27:53 +0100 Subject: 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. --- .gitignore | 5 +++++ .travis.yml | 2 +- examples/CMakeLists.txt | 21 ++++++++++++++++++++- examples/others/audio_standalone.c | 7 ++----- games/wave_collector/wave_collector.c | 4 ++-- src/CMakeLists.txt | 2 +- utils.cmake | 12 ++++++++---- 7 files changed, 39 insertions(+), 14 deletions(-) (limited to '.travis.yml') diff --git a/.gitignore b/.gitignore index 331d062d..65b3020c 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,8 @@ build # Ignore Android generated files and folders templates/android_project/output + +# Ignore GNU global tags +GPATH +GRTAGS +GTAGS diff --git a/.travis.yml b/.travis.yml index af381d5b..ea51039e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 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 +#include "audio.h" #if defined(_WIN32) #include // Windows only, no stardard library -#endif - -#include "audio.h" - -#if defined(__linux__) +#else #include #include #include diff --git a/games/wave_collector/wave_collector.c b/games/wave_collector/wave_collector.c index d4ce33d9..e28c0b84 100644 --- a/games/wave_collector/wave_collector.c +++ b/games/wave_collector/wave_collector.c @@ -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(); //---------------------------------------------------------------------------------- -} \ No newline at end of file +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 47938030..47bee1ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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() diff --git a/utils.cmake b/utils.cmake index 54221b9c..84c73fe2 100644 --- a/utils.cmake +++ b/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() -- cgit v1.2.3 From ca921e5a53fdd3412f5f81e3a739f54d68cb63a7 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 27 Nov 2017 01:24:08 +0100 Subject: CMake: Explicitly ask for C99 support Otherwise using a compiler that defaults to -std=c89 or -std=gnu89 will fail. Example: http://www.cpantesters.org/cpan/report/abb85066-d283-11e7-9926-b2f4efb9c382 Apparently, -m32 Travis CI build was broken: -m32 was overridden by -std=gnu99. This fixes that. --- .travis.yml | 36 ++++++++++++++++-------------------- CMakeLists.txt | 8 ++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index ea51039e..28641b38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,28 +1,24 @@ language: c -sudo: required dist: trusty git: depth: 3 -os: - - osx - - linux +# TODO we could use a 32 bit Docker container for running true 32-bit tests +# services: - docker -env: - global: - - VERBOSE=1 - matrix: # We don't install x11 32-bit libraries, so skip shared libraries on -m32 - - ARCH=i386 SHARED=OFF - - ARCH=amd64 SHARED=ON - -matrix: - exclude: # This is already covered by building universal (fat) libraries by default - - os: osx - env: ARCH=i386 SHARED=OFF +matrix: # We don't install x11 32-bit libraries, so skip shared libraries on -m32 + include: + - os: linux + env: ARCH=i386 SHARED=OFF EXAMPLES=OFF + sudo: required + - os: linux + env: ARCH=amd64 SHARED=ON EXAMPLES=ON + sudo: required + - os: osx + env: ARCH=amd64 SHARED=ON EXAMPLES=ON before_script: - - export CFLAGS="-std=gnu99" before_install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then @@ -32,8 +28,8 @@ before_install: mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; - if [ "$ARCH" == "i386" ]; then export CFLAGS="$CFLAGS -m32"; fi; - if [ "$ARCH" == "amd64" ]; then export CFLAGS="$CFLAGS -m64"; fi; + if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi; + if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export RAYLIB_PACKAGE_SUFFIX="-macOS"; fi - "$CC --version" @@ -41,8 +37,8 @@ before_install: script: - mkdir build - cd build - - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED .. - - make + - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=$EXAMPLES -DBUILD_GAMES=$EXAMPLES .. + - make VERBOSE=1 - make package deploy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dfa0857..057481bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,14 @@ cmake_minimum_required(VERSION 3.0) set(BUILD_EXAMPLES ON CACHE BOOL "Build the examples.") set(BUILD_GAMES ON CACHE BOOL "Build the example games.") +if(CMAKE_VERSION VERSION_LESS "3.1") + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}") + endif() +else() + set (CMAKE_C_STANDARD 99) +endif() + add_subdirectory(src release) if (${BUILD_EXAMPLES}) -- cgit v1.2.3 From de78fa69bc49afa83898e33e73b6dfbffc43f0e4 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 6 Dec 2017 22:18:14 +0100 Subject: Fix CI builds after mini_al changes --- .travis.yml | 2 +- appveyor.yml | 3 --- src/CMakeLists.txt | 3 +-- src/external/mini_al.h | 4 +++- utils.cmake | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 28641b38..7d1ffef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_script: before_install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y gcc-multilib - libopenal-dev + libasound2-dev libxcursor-dev libxinerama-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; diff --git a/appveyor.yml b/appveyor.yml index bee59fa5..a8572d07 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,9 +28,6 @@ environment: bits: 64 before_build: - - appveyor DownloadFile http://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip - - 7z x openal-soft-1.17.2-bin.zip - - move openal-soft-1.17.2-bin src\external\openal - if [%compiler%]==[mingw] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles" - if [%COMPILER%]==[msvc15] if [%BITS%]==[32] set GENERATOR="Visual Studio 14 2015" - if [%COMPILER%]==[msvc15] if [%BITS%]==[64] set GENERATOR="Visual Studio 14 2015 Win64" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 819dd1a4..200ae6f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -83,8 +83,7 @@ endif() # Get the sources together file(GLOB raylib_sources *.c) file(GLOB stb_vorbis external/stb_vorbis.c) -file(GLOB mini_al external/mini_al.c) -set(sources ${raylib_sources} ${stb_vorbis}) +file(GLOB mini_al external/mini_al.c ${stb_vorbis}) set(sources ${raylib_sources} ${mini_al}) # Which platform? diff --git a/src/external/mini_al.h b/src/external/mini_al.h index 7d83b548..36c394ad 100644 --- a/src/external/mini_al.h +++ b/src/external/mini_al.h @@ -2745,12 +2745,14 @@ static mal_result mal_context__try_get_device_name_by_id(mal_context* pContext, } } break; #endif + #if 0 #ifdef MAL_HAS_COREAUDIO - case mal_backend_coreaudio + case mal_backend_coreaudio: { // TODO: Implement me. } break; #endif + #endif #ifdef MAL_HAS_OSS case mal_backend_oss: { diff --git a/utils.cmake b/utils.cmake index 43b479da..d2c82cd1 100644 --- a/utils.cmake +++ b/utils.cmake @@ -23,7 +23,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux) # Elsewhere (such as Linux), need `-lopenal -lGL`, etc... set(LIBS_PRIVATE m pthread dl - openal GL X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff endif() -- cgit v1.2.3 From 263e81b5c92a575b35e44a33b4b5f833489073a0 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 14 Dec 2017 12:20:05 +0100 Subject: Build shared libs, games and examples on CI Now with external OpenAL and GLFW dependencies removed, we don't have to worry about installing them in CI. Shared libraries are now always built along with static libs. Games and examples are built everwhere except for Visual Studio, because Physac needs pthreads, which VS doesn't provide. --- .travis.yml | 18 +++++++++--------- appveyor.yml | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 7d1ffef0..62278cd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,26 +7,26 @@ git: # TODO we could use a 32 bit Docker container for running true 32-bit tests # services: - docker -matrix: # We don't install x11 32-bit libraries, so skip shared libraries on -m32 +matrix: include: - os: linux - env: ARCH=i386 SHARED=OFF EXAMPLES=OFF + env: ARCH=i386 sudo: required - os: linux - env: ARCH=amd64 SHARED=ON EXAMPLES=ON + env: ARCH=amd64 sudo: required - os: osx - env: ARCH=amd64 SHARED=ON EXAMPLES=ON + env: ARCH=amd64 before_script: before_install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y gcc-multilib - libasound2-dev - libxcursor-dev libxinerama-dev - mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev - libgl1-mesa-dev libglu1-mesa-dev libglew-dev; + libasound2-dev:$ARCH + libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH + libx11-dev:$ARCH libxrandr-dev:$ARCH libxi-dev:$ARCH + libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH libglew-dev:$ARCH; export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi; if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi; @@ -37,7 +37,7 @@ before_install: script: - mkdir build - cd build - - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=$SHARED -DBUILD_EXAMPLES=$EXAMPLES -DBUILD_GAMES=$EXAMPLES .. + - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON .. - make VERBOSE=1 - make package diff --git a/appveyor.yml b/appveyor.yml index a8572d07..4148e744 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,12 +20,16 @@ environment: matrix: - compiler: mingw bits: 32 + examples: ON - compiler: mingw bits: 64 + examples: ON - compiler: msvc15 bits: 32 + examples: OFF - compiler: msvc15 bits: 64 + examples: OFF before_build: - if [%compiler%]==[mingw] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles" @@ -35,7 +39,7 @@ before_build: - cd build build_script: - - cmake -G %GENERATOR% -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. + - cmake -G %GENERATOR% -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% .. - cmake --build . --target install after_build: -- cgit v1.2.3 From 1ab3c058f5e0ecbb64de0ba266065833f6abf198 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 26 Jan 2018 22:10:02 +0100 Subject: Drop libglew-dev as prereq for Travis build Noted by @eserte in athreef/Alien-raylib#2. Thanks! --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 62278cd4..49584010 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ before_install: libasound2-dev:$ARCH libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH libx11-dev:$ARCH libxrandr-dev:$ARCH libxi-dev:$ARCH - libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH libglew-dev:$ARCH; + libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH; export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi; if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi; -- cgit v1.2.3 From d5bbcbc15f9111381b82bd02e7c498c9fca586d2 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 27 Jan 2018 01:04:28 +0100 Subject: Travis CI: Don't set CFLAGS=-m64 for macOS build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 49584010..0974b218 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: env: ARCH=amd64 sudo: required - os: osx - env: ARCH=amd64 + env: ARCH=universal before_script: -- cgit v1.2.3 From 7f5fa4d49c4641a8dc0a6716b64cec9166f3fcdc Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 3 Feb 2018 10:17:51 +0100 Subject: CMake: Add tristate option for using system GLFW (#455) -DWITH_SYSTEM_GLFW=ON: Link against system glfw and fail otherwise -DWITH_SYSTEM_GLFW=OFF: Use embedded rglfw.c -DWITH_SYSTEM_GLFW=IF_POSSIBLE: Probe for system glfw but fallback to rglfw if unavailable Also change Linux 64-bit CI build to install system glfw and use it, so this doesn't bitrot. Addresses #453. --- .travis.yml | 14 +++++++++++--- src/CMakeLists.txt | 43 ++++++++++++------------------------------- utils.cmake | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 67 insertions(+), 40 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 0974b218..b22892eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: env: ARCH=i386 sudo: required - os: linux - env: ARCH=amd64 + env: ARCH=amd64 GLFW=SYSTEM sudo: required - os: osx env: ARCH=universal @@ -30,14 +30,22 @@ before_install: export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi; if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi; + if [ "$GLFW" == "SYSTEM" ]; then + wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_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; + fi; + fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then + export RAYLIB_PACKAGE_SUFFIX="-macOS"; + if [ "$GLFW" == "SYSTEM" ]; then brew update; brew install glfw; fi; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export RAYLIB_PACKAGE_SUFFIX="-macOS"; fi - "$CC --version" script: - mkdir build - cd build - - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON .. + - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DWITH_SYSTEM_GLFW=IF_POSSIBLE .. - make VERBOSE=1 - make package diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 809eb4ce..54d3e59c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,9 +26,19 @@ set_property(CACHE PLATFORM PROPERTY STRINGS "Desktop" "Web" "Android" "Raspberr set(OPENGL_VERSION "3.3" CACHE STRING "OpenGL Version to build raylib with") set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0") -### Config options ### -include_directories(external/glfw/include) +# Get the sources together +file(GLOB raylib_sources *.c) +if(glfw3_FOUND) + list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c) +else() + include_directories(external/glfw/include) +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}) + +### Config options ### # Translate the config options to what raylib wants if(${PLATFORM} MATCHES "Desktop") set(PLATFORM "PLATFORM_DESKTOP") @@ -81,38 +91,9 @@ if(MACOS_FATLIB) endif() endif() -# Get the sources together -file(GLOB raylib_sources *.c) -file(GLOB stb_vorbis external/stb_vorbis.c) -file(GLOB mini_al external/mini_al.c ${stb_vorbis}) -set(sources ${raylib_sources} ${mini_al}) - # Which platform? if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") - foreach(L ${LIBS_PRIVATE}) - get_filename_component(DIR ${L} PATH) - get_filename_component(LIBFILE ${L} NAME_WE) - STRING(REGEX REPLACE "^lib" "" FILE ${LIBFILE}) - - if (${L} MATCHES "[.]framework$") - set(FILE_OPT "-framework ${FILE}") - set(DIR_OPT "-F${DIR} ") - else() - set(FILE_OPT "-l${FILE}") - set(DIR_OPT "-L${DIR} ") - endif() - - if ("${DIR}" STREQUAL "" OR "${DIR}" STREQUAL "${LASTDIR}") - set (DIR_OPT "") - endif() - - set(LASTDIR ${DIR}) - - set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} ${DIR_OPT}${FILE_OPT}") - endforeach(L) - - if(${SHARED_RAYLIB}) add_library(${RAYLIB}_shared SHARED ${sources}) diff --git a/utils.cmake b/utils.cmake index efdfae50..871ad119 100644 --- a/utils.cmake +++ b/utils.cmake @@ -1,6 +1,9 @@ # All sorts of things that we need cross project cmake_minimum_required(VERSION 2.8.0) +set(WITH_SYSTEM_GLFW OFF CACHE STRING "Link raylib against system GLFW instead of embedded one") +set_property(CACHE WITH_SYSTEM_GLFW PROPERTY STRINGS ON OFF IF_POSSIBLE) + # Linking for OS X -framework options # Will do nothing on other OSes if(APPLE) @@ -27,24 +30,59 @@ else() find_library(XINERAMA_LIBRARY Xinerama) find_library(XXF86VM_LIBRARY Xxf86vm) find_library(XCURSOR_LIBRARY Xcursor) - include_directories(${OPENGL_INCLUDE_DIR}) set(LIBS_PRIVATE m ${pthread} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${XRANDR_LIBRARY} ${XINERAMA_LIBRARY} ${XI_LIBRARY} ${XXF86VM_LIBRARY} ${XCURSOR_LIBRARY}) endif() endif() +if(WITH_SYSTEM_GLFW STREQUAL "ON") + find_package(glfw3 3.2.1 REQUIRED) +else(WITH_SYSTEM_GLFW STREQUAL "IF_POSSIBLE") + find_package(glfw3 3.2.1) +endif() +if (glfw3_FOUND) + set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw) +endif() + + if(CMAKE_SYSTEM_NAME STREQUAL Linux) set(LINUX TRUE) set(LIBS_PRIVATE dl ${LIBS_PRIVATE}) endif() +foreach(L ${LIBS_PRIVATE}) + get_filename_component(DIR ${L} PATH) + get_filename_component(LIBFILE ${L} NAME_WE) + STRING(REGEX REPLACE "^lib" "" FILE ${LIBFILE}) + + if (${L} MATCHES "[.]framework$") + set(FILE_OPT "-framework ${FILE}") + set(DIR_OPT "-F${DIR}") + else() + set(FILE_OPT "-l${FILE}") + set(DIR_OPT "-L${DIR}") + endif() + + if ("${DIR}" STREQUAL "" OR "${DIR}" STREQUAL "${LASTDIR}") + set (DIR_OPT "") + endif() + + set(LASTDIR ${DIR}) + + set(PKG_CONFIG_LIBS_PRIVATE ${PKG_CONFIG_LIBS_PRIVATE} ${DIR_OPT} ${FILE_OPT}) + string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}") +endforeach(L) + + + # Do the linking for executables that are meant to link raylib function(link_libraries_to_executable executable) - # And raylib - target_link_libraries(${executable} raylib) - - # Link the libraries - target_link_libraries(${executable} ${LIBS_PRIVATE}) + # Link raylib + if (TARGET raylib_shared) + target_link_libraries(${executable} raylib_shared) + else() + target_link_libraries(${executable} raylib ${PKG_CONFIG_LIBS_PRIVATE}) + endif() endfunction() -- cgit v1.2.3 From cb66c89dfa096239be8522fc3a518c94b76d0cd4 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 4 Feb 2018 12:08:36 +0100 Subject: CMake: Rename WITH_SYSTEM_GLFW to USE_EXTERNAL_GLFW for consistency with Makefile. Requested by @raysan5 in #453. --- .travis.yml | 2 +- utils.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index b22892eb..55d8357d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: script: - mkdir build - cd build - - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DWITH_SYSTEM_GLFW=IF_POSSIBLE .. + - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE .. - make VERBOSE=1 - make package diff --git a/utils.cmake b/utils.cmake index ad709b22..68fd1f76 100644 --- a/utils.cmake +++ b/utils.cmake @@ -1,8 +1,8 @@ # All sorts of things that we need cross project cmake_minimum_required(VERSION 2.8.0) -set(WITH_SYSTEM_GLFW OFF CACHE STRING "Link raylib against system GLFW instead of embedded one") -set_property(CACHE WITH_SYSTEM_GLFW PROPERTY STRINGS ON OFF IF_POSSIBLE) +set(USE_EXTERNAL_GLFW OFF CACHE STRING "Link raylib against system GLFW instead of embedded one") +set_property(CACHE USE_EXTERNAL_GLFW PROPERTY STRINGS ON OFF IF_POSSIBLE) # Linking for OS X -framework options # Will do nothing on other OSes @@ -36,9 +36,9 @@ else() endif() endif() -if(WITH_SYSTEM_GLFW STREQUAL "ON") +if(USE_EXTERNAL_GLFW STREQUAL "ON") find_package(glfw3 3.2.1 REQUIRED) -elseif(WITH_SYSTEM_GLFW STREQUAL "IF_POSSIBLE") +elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE") find_package(glfw3 3.2.1) endif() if (glfw3_FOUND) -- cgit v1.2.3 From 184df917bebdcad54ca0334ff80fe05a0f924817 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 4 Feb 2018 13:33:55 +0100 Subject: Travis CI: Don't use external GLFW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While nice to test, this would mean that the tagged release will depend on GLFW as well… Therefore disable it for now. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 55d8357d..e3a0e67d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: env: ARCH=i386 sudo: required - os: linux - env: ARCH=amd64 GLFW=SYSTEM + env: ARCH=amd64 sudo: required - os: osx env: ARCH=universal -- cgit v1.2.3 From 051040af2d0829933f474e1accf8441b352bed13 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 16 Feb 2018 05:43:13 +0100 Subject: CMake: Remove _RAYLIB suffix from -D{SHARED,STATIC}_RAYLIB They were named so for compatibility with make, but make doesn't use the anymore. I always forget whether it's SHARED_RAYLIB or RAYLIB_SHARED... For now, RAYLIB_SHARED and STATIC_RAYLIB may still be used, but print a deprecation warning. --- .travis.yml | 2 +- appveyor.yml | 2 +- src/CMakeLists.txt | 27 ++++++++++++++++++--------- 3 files changed, 20 insertions(+), 11 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index e3a0e67d..19241346 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: script: - mkdir build - cd build - - cmake -DMACOS_FATLIB=ON -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE .. + - cmake -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE .. - make VERBOSE=1 - make package diff --git a/appveyor.yml b/appveyor.yml index 4148e744..bec37da8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,7 +39,7 @@ before_build: - cd build build_script: - - cmake -G %GENERATOR% -DSTATIC_RAYLIB=ON -DSHARED_RAYLIB=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% .. + - cmake -G %GENERATOR% -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% .. - cmake --build . --target install after_build: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 40871455..6f759324 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,12 +10,21 @@ set(RAYLIB raylib) # Name of the generated library # Shared library is always PIC. Static library should be PIC too if linked into a shared library set(WITH_PIC OFF CACHE BOOL "Compile static library as position-independent code" OFF) # Build a static and/or shared raylib? -set(SHARED_RAYLIB OFF CACHE BOOL "Build raylib as a dynamic library") -set(STATIC_RAYLIB ON CACHE BOOL "Build raylib as a static library") +set(SHARED OFF CACHE BOOL "Build raylib as a dynamic library") +set(STATIC ON CACHE BOOL "Build raylib as a static library") set(MACOS_FATLIB ON CACHE BOOL "Build fat library for both i386 and x86_64 on macOS") -if(NOT (STATIC_RAYLIB OR SHARED_RAYLIB)) - message(FATAL_ERROR "Nothing to do if both -DSHARED_RAYLIB=OFF and -DSTATIC_RAYLIB=OFF...") +if(NOT (STATIC OR SHARED)) + message(FATAL_ERROR "Nothing to do if both -DSHARED=OFF and -DSTATIC=OFF...") +endif() + +if(DEFINED SHARED_RAYLIB) + set(SHARED ${SHARED_RAYLIB}) + message(DEPRECATION "-DSHARED_RAYLIB is deprecated. Please use -DSHARED instead.") +endif() +if(DEFINED STATIC_RAYLIB) + set(STATIC ${STATIC_RAYLIB}) + message(DEPRECATION "-DSTATIC_RAYLIB is deprecated. Please use -DSTATIC instead.") endif() # Platform @@ -85,7 +94,7 @@ endif() if(MACOS_FATLIB) if (CMAKE_OSX_ARCHITECTURES) - message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides BUILD_MACOS_FATLIB=ON") + message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON") else() SET(CMAKE_OSX_ARCHITECTURES "x86_64;i386") endif() @@ -94,7 +103,7 @@ endif() # Which platform? if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") - if(${SHARED_RAYLIB}) + if(${SHARED}) add_library(${RAYLIB}_shared SHARED ${sources}) target_compile_definitions(${RAYLIB}_shared @@ -127,9 +136,9 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") PUBLIC_HEADER DESTINATION include ) endif() - endif(${SHARED_RAYLIB}) + endif(${SHARED}) - if(${STATIC_RAYLIB}) + if(${STATIC}) add_library(${RAYLIB} STATIC ${sources}) target_compile_definitions(${RAYLIB} @@ -147,7 +156,7 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include ) - endif(${STATIC_RAYLIB}) + endif(${STATIC}) configure_file(../raylib.pc.in raylib.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/release/raylib.pc DESTINATION lib/pkgconfig) -- cgit v1.2.3 From d892243d18aaae5b2c425cd8a504775f105413fe Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 19 Feb 2018 13:56:55 +0100 Subject: CI: Build artifacts for master, not develop tags See #443 for more information. --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 19241346..5037a717 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,5 +58,5 @@ deploy: skip_cleanup: true on: repo: raysan5/raylib - branch: develop + branch: master tags: true diff --git a/appveyor.yml b/appveyor.yml index bec37da8..6452a089 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -61,5 +61,5 @@ deploy: prerelease: false force_update: true on: - branch: develop + branch: master appveyor_repo_tag: true # deploy on tag push only -- cgit v1.2.3