@ -8,8 +8,17 @@ set(RAYLIB raylib)    # Name of the generated library  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			# # #  C o n f i g  o p t i o n s  # # #  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  B u i l d  a  s t a t i c  o r  s h a r e d  r a y l i b ?  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  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 ( 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 ( )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  P l a t f o r m  
			
		 
		
	
		
			
			 
			 
			
			 
			
			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 ( )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  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 )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			file ( GLOB  stb_vorbis  external/stb_vorbis.c )  
			
		 
		
	
	
		
			
				
				
				
				
					
						 
					 
				
				 
			
			 
			
			@ -73,40 +90,72 @@ set(sources ${raylib_sources} ${stb_vorbis})  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  W h i c h  p l a t f o r m ?  
			
		 
		
	
		
			
			 
			 
			
			 
			
			if ( ${ PLATFORM }  MATCHES  "PLATFORM_DESKTOP" )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  #  B u i l d  a  s t a t i c  o r  s h a r e d  r a y l i b ?   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  #  T O D O  c l e a n  t h i s  u p  a  b i t ?   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  if ( ${ SHARED_RAYLIB } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  S h a r e d  l i b r a r y   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    add_library ( ${ RAYLIB }  SHARED  ${ sources } )    
			
		 
		
	
		
			
			 
			 
			
			 
			
			    
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  W i l l  l i n k  - framework  ( if  on  OS  X )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    link_os_x_frameworks ( raylib )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  else ( )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  S t a t i c  l i b r a r y   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    add_library ( ${ RAYLIB }  STATIC  ${ sources } )    
			
		 
		
	
		
			
			 
			 
			
			 
			
			    
			
		 
		
	
		
			
			 
			 
			
			 
			
			    if ( LINUX )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      #  O n  L i n u x ,  n e e d  t o  l i n k  a  f e w  e x t r a  t h i n g s  f o r  s t a t i c   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      target_link_libraries ( ${ RAYLIB }  m  pthread  dl )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      target_link_libraries ( ${ RAYLIB }  X11  Xrandr  Xinerama  Xi  Xxf86vm  Xcursor )   #  X 1 1  s t u f f   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    endif ( )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  endif ( )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    
			
		 
		
	
		
			
			 
			 
			
			 
			
			  #  A l w a y s  n e e d  t o  l i n k  O p e n A L  a n d  O p e n G L   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  if ( LINUX )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  Elsewhere  ( such  as  Linux ) ,  n e e d  ` - l o p e n a l  - l G L `   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    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 )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  T O D O  e x t r a c t  f r a m e w o r k  l o c a t i o n  a n d  n a m e  f r o m  $ { L I B S _ P R I V A T E }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    #  a n d  s p e c i f y  t h e m  a s  - F  a n d  - f r a m e w o r k  i n s t e a d  o f  h a r d c o d i n g   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    foreach ( F  OpenGL  OpenAL  Cocoa )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      set ( PKG_CONFIG_LIBS_PRIVATE  "${PKG_CONFIG_LIBS_PRIVATE} -framework ${F}" )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    endforeach ( F )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  endif ( )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    
			
		 
		
	
		
			
			 
			 
			
			 
			
			  #  L i b r a r y  f i l e  &  H e a d e r   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  set_target_properties ( ${ RAYLIB }  PROPERTIES  PUBLIC_HEADER  "raylib.h" )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  install (   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    T A R G E T S  $ { R A Y L I B }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    A R C H I V E  D E S T I N A T I O N  l i b   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    L I B R A R Y  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   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  if ( ${ SHARED_RAYLIB } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    add_library ( ${ RAYLIB } _shared  SHARED  ${ sources } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			    target_compile_definitions ( ${ RAYLIB } _shared   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        P U B L I C  $ { P L A T F O R M }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        P U B L I C  $ { G R A P H I C S }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			    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 (   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        T A R G E T S  $ { R A Y L I B } _ s h a r e d   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        R U N T I M 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   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    else ( )  #  K e e p  l i b * . ( a | d l l )  n a m e ,  b u t  a v o i d  * . l i b  f i l e s  o v e r w r i t i n g  e a c h  o t h e r  o n  W i n d o w s   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      set_target_properties ( ${ RAYLIB } _shared  PROPERTIES  OUTPUT_NAME  ${ RAYLIB } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      install (   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        T A R G E T S  $ { R A Y L I B } _ s h a r e d   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        L I B R A R Y  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 ( )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  endif ( ${ SHARED_RAYLIB } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  if ( ${ STATIC_RAYLIB } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    add_library ( ${ RAYLIB }  STATIC  ${ sources } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			    target_compile_definitions ( ${ RAYLIB }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        P U B L I C  $ { P L A T F O R M }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			        P U B L I C  $ { G R A P H I C S }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			    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 }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			      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 } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  configure_file ( ../raylib.pc.in  raylib.pc  @ONLY )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  install ( FILES  ${ CMAKE_BINARY_DIR } /release/raylib.pc  DESTINATION  lib/pkgconfig )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			    
			
		 
		
	
		
			
			 
			 
			
			 
			
			  #  C o p y  t h e  h e a d e r  f i l e s  t o  t h e  b u i l d  d i r e c t o r y   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  file ( COPY  "raylib.h"  DESTINATION  "." )   
			
		 
		
	
	
		
			
				
				
				
				
					
						 
					 
				
				 
			
			 
			
			@ -119,15 +168,6 @@ elseif(${PLATFORM} MATCHES "PLATFORM_WEB")  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  add_executable ( ${ RAYLIB }  ${ sources } )   
			
		 
		
	
		
			
			 
			 
			
			 
			
			endif ( )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  S e t  t h e  c o m p i l e  f l a g s  t o  r a y l i b  
			
		 
		
	
		
			
			 
			 
			
			 
			
			target_compile_definitions ( ${ RAYLIB }  
			
		 
		
	
		
			
			 
			 
			
			 
			
			  P U B L I C  $ { P L A T F O R M }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			  P U B L I C  $ { G R A P H I C S }   
			
		 
		
	
		
			
			 
			 
			
			 
			
			)  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			
  
			
		 
		
	
		
			
			 
			 
			
			 
			
			#  P r i n t  t h e  f l a g s  f o r  t h e  u s e r  
			
		 
		
	
		
			
			 
			 
			
			 
			
			message ( STATUS  "Compiling with the flags:" )  
			
		 
		
	
		
			
			 
			 
			
			 
			
			message ( STATUS  "  PLATFORM="  ${ PLATFORM } )