forked from mirrors/principia
Initial macOS support
Compiles successfully, but no idea if it runs as I can't test OpenGL in a VM.
This commit is contained in:
parent
c57b38d53c
commit
fcbbfc261d
4 changed files with 23 additions and 21 deletions
|
|
@ -53,6 +53,8 @@ elseif(SCREENSHOT_BUILD)
|
|||
set(TMS_BACKEND "screenshot-linux")
|
||||
elseif(HAIKU)
|
||||
set(TMS_BACKEND "haiku")
|
||||
elseif(APPLE)
|
||||
set(TMS_BACKEND "macos")
|
||||
else()
|
||||
set(TMS_BACKEND "linux")
|
||||
endif()
|
||||
|
|
@ -271,6 +273,8 @@ else()
|
|||
set(COMMON_FLAGS "${COMMON_FLAGS} -DGL_GLEXT_PROTOTYPES -DNO_UI -DTMS_BACKEND_LINUX_SS")
|
||||
elseif(HAIKU)
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -DTMS_BACKEND_HAIKU")
|
||||
elseif(APPLE)
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -DTMS_BACKEND_MACOS")
|
||||
else()
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -DTMS_BACKEND_LINUX")
|
||||
endif()
|
||||
|
|
@ -292,9 +296,12 @@ set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_FLAGS_RELEASE} -O2 -fvisibility-inlines-hi
|
|||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_FLAGS_DEBUG}")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-O,-s,--gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-Wl,-O,--gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
|
||||
# macOS Clang's linker doesn't like these flags
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-O,-s,--gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-Wl,-O,--gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-mwindows")
|
||||
|
|
|
|||
2
src/tms/backends/macos/main.cc
Normal file
2
src/tms/backends/macos/main.cc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// Inherit from Linux backend
|
||||
#include "../linux/main.cc"
|
||||
|
|
@ -1,22 +1,6 @@
|
|||
#ifndef _BACKEND__H_
|
||||
#define _BACKEND__H_
|
||||
|
||||
#if !defined TMS_BACKEND_LINUX \
|
||||
&& !defined TMS_BACKEND_LINUX_SS \
|
||||
&& !defined TMS_BACKEND_ANDROID \
|
||||
&& !defined TMS_BACKEND_WINDOWS \
|
||||
&& !defined TMS_BACKEND_IOS \
|
||||
&& !defined TMS_BACKEND_HAIKU
|
||||
#error Undefined platform, please add a TMS backend for it
|
||||
#endif
|
||||
|
||||
#if !defined TMS_BACKEND_PC \
|
||||
&& !defined TMS_BACKEND_MOBILE
|
||||
#error Either TMS_BACKEND_PC or TMS_BACKEND_MOBILE need to be defined for your platform.
|
||||
#endif
|
||||
|
||||
#include <tms/core/err.h>
|
||||
|
||||
#if defined(TMS_BACKEND_WINDOWS)
|
||||
#define OS_STRING "Windows"
|
||||
#elif defined(TMS_BACKEND_LINUX) || defined(TMS_BACKEND_LINUX_SS)
|
||||
|
|
@ -27,10 +11,19 @@
|
|||
#define OS_STRING "iOS"
|
||||
#elif defined(TMS_BACKEND_HAIKU)
|
||||
#define OS_STRING "Haiku"
|
||||
#elif defined(TMS_BACKEND_MACOS)
|
||||
#define OS_STRING "macOS"
|
||||
#else
|
||||
#define OS_STRING "unknown"
|
||||
#error Undefined platform, please add a TMS backend for it
|
||||
#endif
|
||||
|
||||
#if !defined TMS_BACKEND_PC \
|
||||
&& !defined TMS_BACKEND_MOBILE
|
||||
#error Either TMS_BACKEND_PC or TMS_BACKEND_MOBILE need to be defined for your platform.
|
||||
#endif
|
||||
|
||||
#include <tms/core/err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
static struct tms_pipeline pipelines[TMS_NUM_PIPELINES] = {0};
|
||||
static int n_local_uniforms = 0;
|
||||
|
||||
#if defined(TMS_BACKEND_WINDOWS) || defined(TMS_BACKEND_LINUX) || defined(TMS_BACKEND_HAIKU)
|
||||
#if defined(TMS_BACKEND_PC) || !defined(TMS_BACKEND_LINUX_SS)
|
||||
// Some things in the pipeline are different for Windows/Linux as compared to Android (GL/GLES differences? dunno)
|
||||
// The desktop pipeline is the "cool" pipeline as decided by me.
|
||||
#define TMS_COOL_PIPELINE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue