Переглянути джерело

Merge pull request #608 from a3f/master

CMake: Major cleanup to support find_package(raylib)
pull/610/head
Ahmad Fatoum 6 роки тому
committed by GitHub
джерело
коміт
6905a875ed
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: 4AEE18F83AFDEB23
19 змінених файлів з 377 додано та 284 видалено
  1. +31
    -19
      .travis.yml
  2. +1
    -1
      CMakeLists.txt
  3. +1
    -1
      appveyor.yml
  4. +24
    -0
      cmake/LibraryPathToLinkerFlags.cmake
  5. +11
    -0
      cmake/PopulateConfigVariablesLocally.cmake
  6. +21
    -0
      cmake/raylib-config-version.cmake
  7. +68
    -0
      cmake/raylib-config.cmake
  8. +0
    -85
      cmake/utils.cmake
  9. +24
    -13
      examples/CMakeLists.txt
  10. +5
    -10
      games/CMakeLists.txt
  11. +6
    -11
      games/drturtle/CMakeLists.txt
  12. +6
    -11
      games/just_do/CMakeLists.txt
  13. +6
    -11
      games/koala_seasons/CMakeLists.txt
  14. +6
    -11
      games/light_my_ritual/CMakeLists.txt
  15. +6
    -11
      games/skully_escape/CMakeLists.txt
  16. +6
    -11
      games/wave_collector/CMakeLists.txt
  17. +138
    -75
      src/CMakeLists.txt
  18. +14
    -11
      src/CMakeOptions.txt
  19. +3
    -3
      src/core.c

+ 31
- 19
.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 STATIC=OFF 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,25 +46,27 @@ 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;
- if [ -z "$USE_EXTERNAL_GLFW" ]; then export USE_EXTERNAL_GLFW=IF_POSSIBLE; fi
- if [ -z "$SHARED" ]; then export SHARED=ON ; fi
- if [ -z "$STATIC" ]; then export STATIC=ON ; fi
- if [ -z "$OPENAL" ]; then export OPENAL=OFF; fi
- if [[ "$INSTALL_GLFW" == "YES" && "$USE_EXTERNAL_GLFW" != "OFF" ]]; then
export DONT_TEST=1;
fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
if [[ "$ARCH" == *-android ]]; then
export DONT_TEST=1;
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;
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;
@ -72,19 +74,21 @@ before_install:
export CXX=${PREFIX}clang++;
export CMAKE_ARCH_ARGS='-DPLATFORM=Android';
elif [ "$ARCH" == "html5" ]; then
export DONT_TEST=1;
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';
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 export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu -DSUPPORT_FILEFORMAT_FLAC=OFF'; 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 +106,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,11 +114,19 @@ 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=$STATIC -DSHARED=$SHARED
-DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON
-DUSE_EXTERNAL_GLFW=$USE_EXTERNAL_GLFW
-DUSE_WAYLAND=$WAYLAND
-DUSE_OPENAL_BACKEND=$OPENAL
-DINCLUDE_EVERYTHING=ON
..
- $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
- if [w"> ! "$DONT_TEST" ]; then
pkg-config --static --libs raylib;
nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false);
ctest --output-on-failure;

+ 1
- 1
CMakeLists.txt Переглянути файл

@ -6,7 +6,7 @@ option(BUILD_EXAMPLES "Build the examples." ON)
option(BUILD_GAMES "Build the example games." ON)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended for run with ASAN)" OFF)
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
if(CMAKE_VERSION VERSION_LESS "3.1")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")

+ 1
- 1
appveyor.yml Переглянути файл

@ -39,7 +39,7 @@ before_build:
- cd build
build_script:
- cmake -G %GENERATOR% -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% ..
- cmake -G %GENERATOR% -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% -DINCLUDE_EVERYTHING=ON ..
- cmake --build . --target install
after_build:

+ 24
- 0
cmake/LibraryPathToLinkerFlags.cmake Переглянути файл

@ -0,0 +1,24 @@
function(library_path_to_linker_flags LD_FLAGS LIB_PATHS)
foreach(L ${LIB_PATHS})
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(${LD_FLAGS} ${${LD_FLAGS}} ${DIR_OPT} ${FILE_OPT} PARENT_SCOPE)
string (REPLACE ";" " " ${LD_FLAGS} "${${LD_FLAGS}}")
endforeach()
endfunction()

+ 11
- 0
cmake/PopulateConfigVariablesLocally.cmake Переглянути файл

@ -0,0 +1,11 @@
macro(populate_config_variables_locally target)
get_property(raylib_INCLUDE_DIRS TARGET ${target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
#get_property(raylib_LIBRARIES TARGET ${target} PROPERTY LOCATION) # only works for SHARED
get_property(raylib_LDFLAGS TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(raylib_DEFINITIONS TARGET ${target} PROPERTY DEFINITIONS)
set(raylib_INCLUDE_DIRS "${raylib_INCLUDE_DIRS}" PARENT_SCOPE)
#set(raylib_LIBRARIES "${raylib_INCLUDE_DIRS}" PARENT_SCOPE)
set(raylib_LDFLAGS "${raylib_LDFLAGS}" PARENT_SCOPE)
set(raylib_DEFINITIONS "${raylib_DEFINITIONS}" PARENT_SCOPE)
endmacro()

+ 21
- 0
cmake/raylib-config-version.cmake Переглянути файл

@ -0,0 +1,21 @@
set(PACKAGE_VERSION "@PROJECT_VERSION@")
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
if(NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else(NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif(NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

+ 68
- 0
cmake/raylib-config.cmake Переглянути файл

@ -0,0 +1,68 @@
# - Try to find raylib
# Options:
# raylib_USE_STATIC_LIBS - OFF by default
# raylib_VERBOSE - OFF by default
# Once done, this defines a raylib target that can be passed to
# target_link_libraries as well as following variables:
#
# raylib_FOUND - System has raylib installed
# raylib_INCLUDE_DIRS - The include directories for the raylib header(s)
# raylib_LIBRARIES - The libraries needed to use raylib
# raylib_LDFLAGS - The linker flags needed with raylib
# raylib_DEFINITIONS - Compiler switches required for using raylib
set(XPREFIX PC_RAYLIB)
if (raylib_USE_STATIC_LIBS)
set(XPREFIX ${XPREFIX}_STATIC)
endif()
find_package(PkgConfig)
pkg_check_modules(${XPREFIX} REQUIRED raylib)
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
find_path(raylib_INCLUDE_DIR
NAMES raylib.h
HINTS ${${XPREFIX}_INCLUDE_DIRS}
)
find_library(raylib_LIBRARY
NAMES raylib
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
set(raylib_LIBRARIES ${raylib_LIBRARY})
set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})
set(raylib_LIBRARY_DIR ${raylib_LIBRARY_DIRS})
set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(raylib DEFAULT_MSG
raylib_LIBRARY
raylib_INCLUDE_DIR
)
mark_as_advanced(raylib_LIBRARY raylib_INCLUDE_DIR)
if (raylib_USE_STATIC_LIBS)
add_library(raylib STATIC IMPORTED GLOBAL)
else()
add_library(raylib SHARED IMPORTED GLOBAL)
endif()
string (REPLACE ";" " " raylib_LDFLAGS "${raylib_LDFLAGS}")
set_target_properties(raylib
PROPERTIES
IMPORTED_LOCATION "${raylib_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${raylib_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${raylib_LDFLAGS}"
INTERFACE_COMPILE_OPTIONS "${raylib_DEFINITIONS}"
)
if (raylib_VERBOSE)
message(STATUS "raylib_FOUND: ${raylib_FOUND}")
message(STATUS "raylib_INCLUDE_DIRS: ${raylib_INCLUDE_DIRS}")
message(STATUS "raylib_LIBRARIES: ${raylib_LIBRARIES}")
message(STATUS "raylib_LDFLAGS: ${raylib_LDFLAGS}")
message(STATUS "raylib_DEFINITIONS: ${raylib_DEFINITIONS}")
endif()

+ 0
- 85
cmake/utils.cmake Переглянути файл

@ -1,85 +0,0 @@
# All sorts of things that we need cross project
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(${PLATFORM} MATCHES "Android")
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
elseif(${PLATFORM} MATCHES "Web")
elseif(APPLE)
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
elseif(WIN32)
# no pkg-config --static on Windows yet...
else()
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
set(OPENGL_LIBRARIES "GL")
endif()
include_directories(${OPENGL_INCLUDE_DIR})
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
find_library(OSS_LIBRARY ossaudio)
endif()
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
endif()
if(${PLATFORM} MATCHES "Desktop")
if(USE_EXTERNAL_GLFW STREQUAL "ON")
find_package(glfw3 3.2.1 REQUIRED)
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
find_package(glfw3 3.2.1 QUIET)
endif()
if (glfw3_FOUND)
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(LINUX TRUE)
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)
# Link raylib
if (TARGET raylib_shared)
target_link_libraries(${executable} raylib_shared)
elseif(${PLATFORM} MATCHES "Web")
target_link_libraries(${executable} ${__PKG_CONFIG_LIBS_PRIVATE})
target_link_libraries(${executable} raylib)
else()
target_link_libraries(${executable} raylib ${__PKG_CONFIG_LIBS_PRIVATE})
endif()
endfunction()

+ 24
- 13
examples/CMakeLists.txt Переглянути файл

@ -1,15 +1,6 @@
# Setup the project and settings
project(examples)
include("../cmake/utils.cmake")
# Make sure raylib has been built
# 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 shaders shapes text textures)
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=199309L)
@ -34,12 +25,12 @@ foreach(example_dir ${example_dirs})
endforeach()
include(CheckIncludeFiles)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) # see #588
set(OUTPUT_EXT)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.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}/others/standard_lighting.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)
@ -58,12 +49,19 @@ if(${PLATFORM} MATCHES "Android")
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)
elseif(${PLATFORM} MATCHES "Web")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/templates/web_shell/shell.html")
set(OUTPUT_EXT ".html")
endif()
include_directories(BEFORE SYSTEM others/external/include)
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
# Do each example
foreach(example_source ${example_sources})
@ -74,9 +72,22 @@ foreach(example_source ${example_sources})
# Setup the example
add_executable(${example_name} ${example_source})
# Link the libraries
link_libraries_to_executable(${example_name})
target_link_libraries(${example_name} raylib)
endforeach()
if (${PLATFORM} MATCHES "Desktop")
# rlgl_standalone can't be linked with raylib because of duplicate rlgl symbols
foreach (example_source "others/rlgl_standalone.c")
# Create the basename for the example
get_filename_component(example_name ${example_source} NAME)
string(REPLACE ".c" "${OUTPUT_EXT}" example_name ${example_name})
add_executable(${example_name} ${example_source})
add_dependencies(${example_name} raylib)
target_link_libraries(${example_name} ${raylib_LDFLAGS})
target_include_directories(${example_name} PRIVATE ${raylib_INCLUDE_DIRS})
endforeach()
endif()
# Copy all of the resource files to the destination
file(COPY ${example_resources} DESTINATION "resources/")

+ 5
- 10
games/CMakeLists.txt Переглянути файл

@ -1,17 +1,9 @@
# Setup the project and settings
project(games)
include("../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
# TODO place somewhere else?
include_directories("../build/release")
# Get the source toegher
file(GLOB sources *.c)
message("PLATFORM = ${PLATFORM}")
set(OUTPUT_EXT)
if(${PLATFORM} MATCHES "Web")
@ -20,18 +12,21 @@ if(${PLATFORM} MATCHES "Web")
set(OUTPUT_EXT ".html")
endif()
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
# Do each game
foreach(game_source ${sources})
# Create the basename for the game
get_filename_component(game_name ${game_source} NAME)
string(REPLACE ".c" "${OUTPUT_EXT}" game_name ${game_name})
# Setup the game
add_executable(${game_name} ${game_source})
# Link the libraries
link_libraries_to_executable(${game_name})
target_link_libraries(${game_name} raylib)
endforeach()
# Do the games with subdirectories

+ 6
- 11
games/drturtle/CMakeLists.txt Переглянути файл

@ -1,18 +1,13 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(drturtle)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Executable & linking
add_executable(drturtle 06_drturtle_final.c)
link_libraries_to_executable(drturtle)
add_executable(${PROJECT_NAME} 06_drturtle_final.c)
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 6
- 11
games/just_do/CMakeLists.txt Переглянути файл

@ -1,21 +1,16 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(just_do)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Grab the screens
file(GLOB screen_sources "screens/*.c")
# Executable & linking
add_executable(just_do just_do.c ${screen_sources})
link_libraries_to_executable(just_do)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources})
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 6
- 11
games/koala_seasons/CMakeLists.txt Переглянути файл

@ -1,21 +1,16 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(koala_seasons)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Grab the screens
file(GLOB screen_sources "screens/*.c")
# Executable & linking
add_executable(koala_seasons koala_seasons.c ${screen_sources})
link_libraries_to_executable(koala_seasons)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources})
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 6
- 11
games/light_my_ritual/CMakeLists.txt Переглянути файл

@ -1,21 +1,16 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(light_my_ritual)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Grab the screens
file(GLOB screen_sources "screens/*.c")
# Executable & linking
add_executable(light_my_ritual light_my_ritual.c ${screen_sources})
link_libraries_to_executable(light_my_ritual)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources})
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 6
- 11
games/skully_escape/CMakeLists.txt Переглянути файл

@ -1,21 +1,16 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(skully_escape)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Grab the screens
file(GLOB screen_sources "screens/*.c")
# Executable & linking
add_executable(skully_escape skully_escape.c player.c monster.c ${screen_sources})
link_libraries_to_executable(skully_escape)
add_executable(${PROJECT_NAME} skully_escape.c player.c monster.c ${screen_sources})
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 6
- 11
games/wave_collector/CMakeLists.txt Переглянути файл

@ -1,21 +1,16 @@
err"># Setup the project and settings
nb">cmake_minimum_required(VERSION 2.6)
project(wave_collector)
include("../../cmake/utils.cmake")
# Make sure raylib has been built
# TODO `build` directory should maybe be something else...
include_directories("../../build/release")
# Grab the screens
file(GLOB screen_sources "screens/*.c")
# Executable & linking
add_executable(wave_collector wave_collector.c ${screen_sources})
link_libraries_to_executable(wave_collector)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources})
if (NOT TARGET raylib)
find_package(raylib 2.0 REQUIRED)
endif()
target_link_libraries(${PROJECT_NAME} raylib)
# Resources
# Copy all of the resource files to the destination
file(COPY "resources/" DESTINATION "resources/")

+ 138
- 75
src/CMakeLists.txt Переглянути файл

@ -5,20 +5,28 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
set(PROJECT_VERSION 2.0.0)
set(API_VERSION 2)
set(RAYLIB raylib) # Name of the generated library
include("CMakeOptions.txt")
include(BuildType)
configure_file(config.h.in ${CMAKE_BINARY_DIR}/cmake/config.h)
include_directories(${CMAKE_BINARY_DIR})
include_directories(SYSTEM .)
include_directories(${CMAKE_BINARY_DIR} .)
# Get the sources together
file(GLOB raylib_sources *.c)
list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
if(USE_EXTERNAL_GLFW STREQUAL "ON")
find_package(glfw3 3.2.1 REQUIRED)
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
find_package(glfw3 3.2.1 QUIET)
endif()
if (glfw3_FOUND)
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
endif()
# Explicitly check against "ON", because USE_EXTERNAL_GLFW is a tristate option
if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
MESSAGE(STATUS "Using raylib's GLFW")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
@ -30,54 +38,63 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT
endif()
add_subdirectory(external/glfw)
include_directories(external/glfw/include)
include_directories(BEFORE SYSTEM external/glfw/include)
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
else()
MESSAGE(STATUS "Using external GLFW")
set(GLFW_PKG_DEPS glfw)
endif()
include(utils)
add_definitions("-DRAYLIB_CMAKE=1")
if(USE_AUDIO)
if (NOT USE_OPENAL_BACKEND)
file(GLOB mini_al external/mini_al.c)
MESSAGE(STATUS "Audio Backend: mini_al")
else()
find_package(OpenAL REQUIRED)
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})
endif()
include(AddIfFlagCompiles)
### Config options ###
# Translate the config options to what raylib wants
if(${PLATFORM} MATCHES "Desktop")
set(PLATFORM "PLATFORM_DESKTOP")
# OpenGL version
if (${OPENGL_VERSION} MATCHES "3.3")
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
elseif (${OPENGL_VERSION} MATCHES "2.1")
set(GRAPHICS "GRAPHICS_API_OPENGL_21")
elseif (${OPENGL_VERSION} MATCHES "1.1")
set(GRAPHICS "GRAPHICS_API_OPENGL_11")
elseif (${OPENGL_VERSION} MATCHES "ES 2.0")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
endif()
set(PLATFORM_CPP "PLATFORM_DESKTOP")
if(APPLE)
# Need to force OpenGL 3.3 on OS X
# See: https://github.com/raysan5/raylib/issues/341
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
link_libraries("${LIBS_PRIVATE}")
elseif(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
set(OPENGL_LIBRARIES "GL")
endif()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
find_library(OSS_LIBRARY ossaudio)
endif()
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
endif()
elseif(${PLATFORM} MATCHES "Web")
set(PLATFORM "PLATFORM_WEB")
set(PLATFORM_CPP "PLATFORM_WEB")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
set(CMAKE_C_FLAGS "-s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
@ -85,8 +102,9 @@ elseif(${PLATFORM} MATCHES "Web")
# Change the name of the output library
elseif(${PLATFORM} MATCHES "Android")
set(PLATFORM "PLATFORM_ANDROID")
set(PLATFORM_CPP "PLATFORM_ANDROID")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
include(AddIfFlagCompiles)
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)
@ -97,94 +115,139 @@ elseif(${PLATFORM} MATCHES "Android")
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")
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
elseif(${PLATFORM} MATCHES "Raspberry Pi")
set(PLATFORM "PLATFORM_RPI")
set(PLATFORM_CPP "PLATFORM_RPI")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
endif()
if(${SHARED})
add_library(${RAYLIB}_shared SHARED ${sources})
if (${OPENGL_VERSION})
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
if (${OPENGL_VERSION} MATCHES "3.3")
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
elseif (${OPENGL_VERSION} MATCHES "2.1")
set(GRAPHICS "GRAPHICS_API_OPENGL_21")
elseif (${OPENGL_VERSION} MATCHES "1.1")
set(GRAPHICS "GRAPHICS_API_OPENGL_11")
elseif (${OPENGL_VERSION} MATCHES "ES 2.0")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
endif()
if (${SUGGESTED_GRAPHICS} AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
endif()
endif()
if(NOT GRAPHICS)
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
endif()
include_directories(${OPENGL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR})
set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
include(LibraryPathToLinkerFlags)
library_path_to_linker_flags(__PKG_CONFIG_LIBS_PRIVATE "${LIBS_PRIVATE}")
if(STATIC)
if(${PLATFORM} MATCHES "Web")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
endif()
add_library(raylib_static STATIC ${sources})
target_compile_definitions(${RAYLIB}_shared
PUBLIC ${PLATFORM}
target_compile_definitions(raylib_static
PUBLIC ${PLATFORM_CPP}
PUBLIC ${GRAPHICS}
)
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
if (${PLATFORM} MATCHES "Desktop")
target_link_libraries(raylib_static glfw ${GLFW_LIBRARIES} ${LIBS_PRIVATE})
endif()
if (WITH_PIC)
set_property(TARGET raylib_static PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
set_target_properties(raylib_static PROPERTIES PUBLIC_HEADER "raylib.h")
if(NOT WIN32) # Keep lib*.(a|dll) name, but avoid *.lib files overwriting each other on Windows
set_target_properties(raylib_static PROPERTIES OUTPUT_NAME raylib)
endif()
install(
TARGETS raylib_static
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
set_target_properties(raylib_static PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/release")
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
endif(STATIC)
if(SHARED)
add_library(raylib SHARED ${sources})
target_compile_definitions(raylib
PUBLIC ${PLATFORM_CPP}
PUBLIC ${GRAPHICS}
)
set(PKG_CONFIG_LIBS_EXTRA "")
set_property(TARGET ${RAYLIB}_shared PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET s">raylib PROPERTY POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MACOSX_RPATH ON)
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
target_link_libraries(${RAYLIB}_shared glfw)
target_link_libraries(s">raylib ${LIBS_PRIVATE})
if (${PLATFORM} MATCHES "Desktop")
target_link_libraries(s">raylib glfw)
endif()
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
else()
set_target_properties(${RAYLIB}_shared PROPERTIES
set_target_properties(s">raylib PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${API_VERSION}
)
endif()
set_target_properties(${RAYLIB}_shared PROPERTIES
set_target_properties(s">raylib PROPERTIES
PUBLIC_HEADER "raylib.h"
)
if(WIN32)
if (WIN32)
install(
TARGETS ${RAYLIB}_shared
RUNTIME DESTINATION lib
PUBLIC_HEADER DESTINATION include
TARGETS raylib
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})
else()
install(
TARGETS ${RAYLIB}_shared
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
TARGETS raylib
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
endif()
set_target_properties(raylib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/release")
add_test("pkg-config" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh)
endif(${SHARED})
if(${STATIC})
if(${PLATFORM} MATCHES "PLATFORM_WEB")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
endif()
add_library(${RAYLIB} STATIC ${sources})
target_compile_definitions(${RAYLIB}
PUBLIC ${PLATFORM}
PUBLIC ${GRAPHICS}
)
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
target_link_libraries(${RAYLIB} glfw ${GLFW_LIBRARIES})
endif()
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 "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
endif(${STATIC})
else(SHARED)
add_library(raylib ALIAS raylib_static)
endif(SHARED)
if (NOT DEFINED PKG_CONFIG_LIBS_EXTRA)
set(PKG_CONFIG_LIBS_EXTRA "${PKG_CONFIG_LIBS_PRIVATE}")
endif()
configure_file(../raylib.pc.in raylib.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/release/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/release/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
include(PopulateConfigVariablesLocally)
populate_config_variables_locally(raylib)
# Copy the header files to the build directory
file(COPY "raylib.h" DESTINATION ".")
@ -195,7 +258,7 @@ file(COPY "audio.h" DESTINATION ".")
# Print the flags for the user
message(STATUS "Compiling with the flags:")
message(STATUS " PLATFORM=" ${PLATFORM})
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
message(STATUS " GRAPHICS=" ${GRAPHICS})
# Packaging

+ 14
- 11
src/CMakeOptions.txt Переглянути файл

@ -4,13 +4,13 @@ include(EnumOption)
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi" "Platform to build for.")
enum_option(OPENGL_VERSION "3.3;2.1;1.1;ES 2.0" "OpenGL Version to build raylib with")
enum_option(OPENGL_VERSION "OFF;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
option(WITH_PIC "Compile static library as position-independent code" OFF)
option(SHARED "Build raylib as a dynamic library" OFF)
option(STATIC "Build raylib as a static library" ON)
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" ON)
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
option(USE_AUDIO "Build raylib with audio module" ON)
if(${PLATFORM} MATCHES "Web")
cmake_dependent_option(USE_OPENAL_BACKEND "Link raylib with openAL instead of mini-al" ON "USE_AUDIO" OFF)
@ -23,6 +23,9 @@ if(UNIX AND NOT APPLE)
option(USE_WAYLAND "Use Wayland for window creation" OFF)
endif()
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
# core.c
option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" ON)
@ -48,13 +51,13 @@ option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON)
option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON)
option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON)
option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON)
option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" OFF)
option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" OFF)
option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" OFF)
option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" OFF)
option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" OFF)
option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" OFF)
option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" OFF)
option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF})
option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF})
option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF})
option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF})
option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF})
option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF})
option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF})
# models.c
option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON)
@ -66,11 +69,11 @@ option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON)
option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" ON)
option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON)
option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON)
option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" OFF)
option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF})
# utils.c
option(SUPPORT_SAVE_PNG "Support saving image data in PNG file format" ON)
option(SUPPORT_SAVE_BMP "Support saving image data in BMP file format" OFF)
option(SUPPORT_SAVE_BMP "Support saving image data in BMP file format" ${OFF})
option(SUPPORT_TRACELOG "Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown" ON)
option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON)

+ 3
- 3
src/core.c Переглянути файл

@ -1915,14 +1915,14 @@ static bool InitGraphicsDevice(int width, int height)
if (configFlags & FLAG_WINDOW_UNDECORATED) glfwWindowHint(GLFW_DECORATED, GL_FALSE); // Border and buttons on Window
else glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Decorated window
#if !defined(PLATFORM_WEB) // FLAG_WINDOW_TRANSPARENT not supported on HTML5
// FLAG_WINDOW_TRANSPARENT not supported on HTML5 and not included in any released GLFW version yet
#if defined(GLFW_TRANSPARENT_FRAMEBUFFER)
if (configFlags & FLAG_WINDOW_TRANSPARENT) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
#endif
if (configFlags & FLAG_MSAA_4X_HINT) glfwWindowHint(GLFW_SAMPLES, 4); // Tries to enable multisampling x4 (MSAA), default is 0
// NOTE: When asking for an OpenGL context version, most drivers provide highest supported version
// with forward compatibility to older OpenGL versions.
// For example, if using OpenGL 1.1, driver can provide a 4.3 context forward compatible.

Завантаження…
Відмінити
Зберегти