@ -10,17 +10,37 @@ include("CMakeOptions.txt")
configure_file ( config.h.in ${ CMAKE_BINARY_DIR } /cmake/config.h )
include_directories ( ${ CMAKE_BINARY_DIR } )
include ( "../utils.cmake" )
if ( MACOS_FATLIB )
if ( CMAKE_OSX_ARCHITECTURES )
message ( FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON" )
else ( )
SET ( CMAKE_OSX_ARCHITECTURES "x86_64;i386" )
endif ( )
endif ( )
# G e t t h e s o u r c e s t o g e t h e r
file ( GLOB raylib_sources *.c )
list ( REMOVE_ITEM raylib_sources ${ CMAKE_CURRENT_SOURCE_DIR } /rglfw.c )
if ( NOT glfw3_FOUND )
set ( GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE )
set ( GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE )
set ( GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE )
set ( GLFW_INSTALL OFF CACHE BOOL "" FORCE )
set ( BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE )
set ( GLFW_USE_WAYLAND ${ USE_WAYLAND } CACHE BOOL "" FORCE )
if ( USE_PIC OR SHARED )
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
endif ( )
if ( glfw3_FOUND )
list ( REMOVE_ITEM raylib_sources ${ CMAKE_CURRENT_SOURCE_DIR } /rglfw.c )
else ( )
add_subdirectory ( external/glfw )
include_directories ( external/glfw/include )
list ( APPEND raylib_sources $< TARGET_OBJECTS:glfw_objlib > )
endif ( )
include ( "../utils.cmake" )
if ( USE_AUDIO )
file ( GLOB stb_vorbis external/stb_vorbis.c )
file ( GLOB mini_al external/mini_al.c ${ stb_vorbis } )
@ -51,7 +71,6 @@ if(${PLATFORM} MATCHES "Desktop")
# S e e : h t t p s : / / g i t h u b . c o m / r a y s a n 5 / r a y l i b / i s s u e s / 3 4 1
if ( APPLE )
set ( GRAPHICS "GRAPHICS_API_OPENGL_33" )
set_source_files_properties ( rglfw.c PROPERTIES COMPILE_FLAGS "-x objective-c" )
link_libraries ( "${LIBS_PRIVATE}" )
elseif ( WIN32 )
add_definitions ( -D_CRT_SECURE_NO_WARNINGS )
@ -76,14 +95,6 @@ elseif(${PLATFORM} MATCHES "Raspberry Pi")
set ( GRAPHICS "GRAPHICS_API_OPENGL_ES2" )
endif ( )
if ( MACOS_FATLIB )
if ( CMAKE_OSX_ARCHITECTURES )
message ( FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON" )
else ( )
SET ( CMAKE_OSX_ARCHITECTURES "x86_64;i386" )
endif ( )
endif ( )
# W h i c h p l a t f o r m ?
if ( ${ PLATFORM } MATCHES "PLATFORM_DESKTOP" )
@ -100,7 +111,7 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
set ( CMAKE_MACOSX_RPATH ON )
target_link_libraries ( ${ RAYLIB } _shared ${ LIBS_PRIVATE } )
target_link_libraries ( ${ RAYLIB } _shared ${ LIBS_PRIVATE } glfw ${ GLFW_LIBRARIES } )
if ( UNIX AND ${ FILESYSTEM_LACKS_SYMLINKS } )
MESSAGE ( WARNING "Can't version UNIX shared library on file system without symlink support" )
else ( )
@ -137,6 +148,7 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
)
set ( PKG_CONFIG_LIBS_PRIVATE ${ __PKG_CONFIG_LIBS_PRIVATE } )
target_link_libraries ( ${ RAYLIB } glfw ${ GLFW_LIBRARIES } )
if ( WITH_PIC )
set_property ( TARGET ${ RAYLIB } PROPERTY POSITION_INDEPENDENT_CODE ON )