From 2cf37708c024cb18267c41db3d604d570f6fe670 Mon Sep 17 00:00:00 2001 From: Martinfx Date: Wed, 29 Nov 2017 00:04:29 +0100 Subject: Added glfw support for FreeBSD --- src/rglfw.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/rglfw.c b/src/rglfw.c index 83e0021b..5cd2c937 100644 --- a/src/rglfw.c +++ b/src/rglfw.c @@ -36,6 +36,9 @@ #ifdef __linux__ #define _GLFW_X11 #endif +#ifdef __FreeBSD__ + #define _GLFW_X11 +#endif #ifdef __APPLE__ #define _GLFW_COCOA #define _GLFW_USE_CHDIR // To chdir to the Resources subdirectory of the application bundle during glfwInit @@ -77,6 +80,20 @@ #include "external/glfw/src/osmesa_context.c" #endif +#ifdef __FreeBSD__ + #include "external/glfw/src/x11_init.c" + #include "external/glfw/src/x11_monitor.c" + #include "external/glfw/src/x11_window.c" + #include "external/glfw/src/xkb_unicode.c" + // TODO: Joistick implementation + #include "external/glfw/src/null_joystick.c" + #include "external/glfw/src/posix_time.c" + #include "external/glfw/src/posix_thread.c" + #include "external/glfw/src/glx_context.c" + #include "external/glfw/src/egl_context.c" + #include "external/glfw/src/osmesa_context.c" +#endif + #ifdef __APPLE__ #include "external/glfw/src/cocoa_init.m" #include "external/glfw/src/cocoa_joystick.m" -- cgit v1.2.3 From 2f471414c2f830e61a200ecd956f37e45ce94e96 Mon Sep 17 00:00:00 2001 From: Martinfx Date: Wed, 29 Nov 2017 00:05:39 +0100 Subject: Added compile with cmake for FreeBSD --- src/CMakeLists.txt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 47bee1ce..e4f5e8fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,6 @@ include("../utils.cmake") set(PROJECT_VERSION 1.9.1-dev) set(RAYLIB raylib) # Name of the generated library - ### Config options ### # 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) @@ -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...") endif() - # Platform set(PLATFORM "Desktop" CACHE STRING "Platform to build for.") 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") ### 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/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 if(${PLATFORM} MATCHES "Desktop") @@ -55,6 +59,7 @@ if(${PLATFORM} MATCHES "Desktop") elseif(WIN32) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() + elseif(${PLATFORM} MATCHES "Web") set(PLATFORM "PLATFORM_WEB") set(GRAPHICS "GRAPHICS_API_OPENGL_ES2") @@ -94,14 +99,20 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") foreach(L ${LIBS_PRIVATE}) set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}") endforeach(L) + endif() - elseif(APPLE) + if(APPLE) # TODO extract framework location and name from ${LIBS_PRIVATE} # and specify them as -F and -framework instead of hardcoding foreach(F OpenGL OpenAL Cocoa) set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -framework ${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() if(${SHARED_RAYLIB}) -- cgit v1.2.3 From 69a1c19735bd808c7fe5f6d546c1d238a21ccc24 Mon Sep 17 00:00:00 2001 From: Martinfx Date: Wed, 29 Nov 2017 13:17:02 +0100 Subject: Fixed use ${LIBS_PRIVATE} for FreeBSD --- src/CMakeLists.txt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e4f5e8fc..33f0fec5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,14 +24,8 @@ set_property(CACHE PLATFORM PROPERTY STRINGS "Desktop" "Web" "Android" "Raspberr # OpenGL version 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") -### 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() +### Config options ### include_directories(external/glfw/include) include_directories(external/include) # For use with AppVeyor on Windows @@ -110,7 +104,7 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") endif() if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) - foreach(L OpenGL OpenAL) + foreach(L ${LIBS_PRIVATE}) set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} -l${L}") endforeach(L) endif() -- cgit v1.2.3 From 825d15b06976ef2f9a05255ecc86c04d5f73953f Mon Sep 17 00:00:00 2001 From: Martinfx Date: Wed, 29 Nov 2017 16:54:25 +0100 Subject: Fixed broken include for AppVeyor --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 33f0fec5..cb8af48d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0") ### Config options ### include_directories(external/glfw/include) -include_directories(external/include) # For use with AppVeyor on Windows +include_directories(external/openal/include) # For use with AppVeyor on Windows # Translate the config options to what raylib wants if(${PLATFORM} MATCHES "Desktop") -- cgit v1.2.3