@ -10,12 +10,21 @@ set(RAYLIB raylib) # Name of the generated library
# S h a r e d l i b r a r y i s a l w a y s P I C . S t a t i c l i b r a r y s h o u l d b e P I C t o o i f l i n k e d i n t o a s h a r e d l i b r a r y
set ( WITH_PIC OFF CACHE BOOL "Compile static library as position-independent code" OFF )
# B u i l d a s t a t i c a n d / o r s h a r e d r a y l i b ?
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 ( )
# P l a t f o r m
@ -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 -D MACOS_FATLIB=ON" )
else ( )
SET ( CMAKE_OSX_ARCHITECTURES "x86_64;i386" )
endif ( )
@ -94,7 +103,7 @@ endif()
# W h i c h p l a t f o r m ?
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")
P U B L I C _ H E A D E R D E S T I N A T I O N i n c l u d e
)
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")
A R C H I V E D E S T I N A T I O N l i b
P U B L I C _ H E A D E R D E S T I N A T I O N i n c l u d e
)
endif ( ${ STATIC_RAYLIB } )
endif ( ${ STATIC } )
configure_file ( ../raylib.pc.in raylib.pc @ONLY )
install ( FILES ${ CMAKE_BINARY_DIR } /release/raylib.pc DESTINATION lib/pkgconfig )