Added compile with cmake for FreeBSD
This commit is contained in:
parent
2cf37708c0
commit
2f471414c2
2 changed files with 39 additions and 10 deletions
|
@ -5,7 +5,6 @@ include("../utils.cmake")
|
||||||
set(PROJECT_VERSION 1.9.1-dev)
|
set(PROJECT_VERSION 1.9.1-dev)
|
||||||
set(RAYLIB raylib) # Name of the generated library
|
set(RAYLIB raylib) # Name of the generated library
|
||||||
|
|
||||||
|
|
||||||
### Config options ###
|
### Config options ###
|
||||||
# Shared library is always PIC. Static library should be PIC too if linked into a shared 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)
|
set(WITH_PIC OFF CACHE BOOL "Compile static library as position-independent code" OFF)
|
||||||
|
@ -18,7 +17,6 @@ if(NOT (STATIC_RAYLIB OR SHARED_RAYLIB))
|
||||||
message(FATAL_ERROR "Nothing to do if both -DSHARED_RAYLIB=OFF and -DSTATIC_RAYLIB=OFF...")
|
message(FATAL_ERROR "Nothing to do if both -DSHARED_RAYLIB=OFF and -DSTATIC_RAYLIB=OFF...")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Platform
|
# Platform
|
||||||
set(PLATFORM "Desktop" CACHE STRING "Platform to build for.")
|
set(PLATFORM "Desktop" CACHE STRING "Platform to build for.")
|
||||||
set_property(CACHE PLATFORM PROPERTY STRINGS "Desktop" "Web" "Android" "Raspberry Pi")
|
set_property(CACHE PLATFORM PROPERTY STRINGS "Desktop" "Web" "Android" "Raspberry Pi")
|
||||||
|
@ -28,8 +26,14 @@ 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")
|
set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0")
|
||||||
### Config options ###
|
### Config options ###
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
find_package(OpenAL REQUIRED)
|
||||||
|
include_directories(${OPENGL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(external/glfw/include)
|
include_directories(external/glfw/include)
|
||||||
include_directories(external/openal/include) # For use with AppVeyor on Windows
|
include_directories(external/include) # For use with AppVeyor on Windows
|
||||||
|
|
||||||
# Translate the config options to what raylib wants
|
# Translate the config options to what raylib wants
|
||||||
if(${PLATFORM} MATCHES "Desktop")
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
|
@ -55,6 +59,7 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif(${PLATFORM} MATCHES "Web")
|
elseif(${PLATFORM} MATCHES "Web")
|
||||||
set(PLATFORM "PLATFORM_WEB")
|
set(PLATFORM "PLATFORM_WEB")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
@ -94,14 +99,20 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
foreach(L ${LIBS_PRIVATE})
|
foreach(L ${LIBS_PRIVATE})
|
||||||
set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}")
|
set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}")
|
||||||
endforeach(L)
|
endforeach(L)
|
||||||
|
endif()
|
||||||
|
|
||||||
elseif(APPLE)
|
if(APPLE)
|
||||||
# TODO extract framework location and name from ${LIBS_PRIVATE}
|
# TODO extract framework location and name from ${LIBS_PRIVATE}
|
||||||
# and specify them as -F and -framework instead of hardcoding
|
# and specify them as -F and -framework instead of hardcoding
|
||||||
foreach(F OpenGL OpenAL Cocoa)
|
foreach(F OpenGL OpenAL Cocoa)
|
||||||
set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -framework ${F}")
|
set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -framework ${F}")
|
||||||
endforeach(F)
|
endforeach(F)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||||
|
foreach(L OpenGL OpenAL)
|
||||||
|
set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}")
|
||||||
|
endforeach(L)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${SHARED_RAYLIB})
|
if(${SHARED_RAYLIB})
|
||||||
|
|
30
utils.cmake
30
utils.cmake
|
@ -1,9 +1,8 @@
|
||||||
# All sorts of things that we need cross project
|
# All sorts of things that we need cross project
|
||||||
cmake_minimum_required(VERSION 2.8.0)
|
cmake_minimum_required(VERSION 2.8.0)
|
||||||
|
|
||||||
# Detect linux
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
if(UNIX AND NOT APPLE)
|
set(LINUX TRUE)
|
||||||
set(LINUX TRUE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Linking for OS X -framework options
|
# Linking for OS X -framework options
|
||||||
|
@ -18,17 +17,36 @@ if(APPLE)
|
||||||
|
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY}
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY}
|
||||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||||
elseif(LINUX)
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
# Elsewhere (such as Linux), need `-lopenal -lGL`, etc...
|
# Elsewhere (such as Linux), need `-lopenal -lGL`, etc...
|
||||||
set(LIBS_PRIVATE
|
set(LIBS_PRIVATE
|
||||||
m pthread dl
|
m pthread dl
|
||||||
openal
|
openal
|
||||||
GL
|
GL
|
||||||
X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff
|
X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff
|
||||||
else()
|
|
||||||
# TODO Windows
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
find_package(OpenAL REQUIRED)
|
||||||
|
include_directories(${OPENGL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
find_library(OpenAL REQUIRED)
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_library(Xrandr NAMES Xrandr)
|
||||||
|
find_library(Xi NAMES Xi)
|
||||||
|
find_library(Xinerama NAMES Xinerama)
|
||||||
|
find_library(Xxf86vm NAMES Xxf86vm)
|
||||||
|
find_library(Xcursor NAMES Xcursor)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE m ${pthread} ${OPENAL_LIBRARY} ${X11_LIBRARIES} ${Xrandr} ${Xinerama} ${Xi} ${Xxf86vm} ${Xcursor})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO Support Windows
|
||||||
|
|
||||||
# Do the linking for executables that are meant to link raylib
|
# Do the linking for executables that are meant to link raylib
|
||||||
function(link_libraries_to_executable executable)
|
function(link_libraries_to_executable executable)
|
||||||
# And raylib
|
# And raylib
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue