platform -> os;

The function names are staying the same for now.
This commit is contained in:
bjorn 2019-12-13 19:36:46 -08:00
parent 63dc8f6c9b
commit e2d8f8c645
24 changed files with 36 additions and 34 deletions

View File

@ -296,7 +296,6 @@ set(LOVR_SRC
src/core/fs.c
src/core/maf.c
src/core/map.c
src/core/platform.c
src/core/ref.c
src/core/utf.c
src/core/util.c
@ -513,6 +512,7 @@ endif()
# Platforms
if(WIN32)
target_sources(lovr PRIVATE src/core/os_win32.c)
set_target_properties(lovr PROPERTIES COMPILE_FLAGS "/wd4244 /MP")
set_target_properties(lovr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
set_target_properties(lovr PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
@ -541,6 +541,7 @@ if(WIN32)
move_dll(${LOVR_LEAP})
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
elseif(APPLE)
target_sources(lovr PRIVATE src/core/os_macos.c)
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
if(LOVR_BUILD_BUNDLE)
function(move_lib)
@ -570,10 +571,13 @@ elseif(APPLE)
)
endif()
elseif(EMSCRIPTEN)
target_sources(lovr PRIVATE src/core/os_web.c)
target_compile_definitions(lovr PRIVATE -DLOVR_WEBGL)
elseif(ANDROID)
target_sources(lovr PRIVATE src/core/os_android.c)
target_link_libraries(lovr log EGL GLESv3)
target_compile_definitions(lovr PRIVATE -DLOVR_GLES)
elseif(UNIX)
target_sources(lovr PRIVATE src/core/os_linux.c)
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
endif()

View File

@ -5,7 +5,7 @@ SRC += src/core/arr.c
SRC += src/core/fs.c
SRC += src/core/maf.c
SRC += src/core/map.c
SRC += src/core/platform.c
SRC += src/core/os_$(PLATFORM).c
SRC += src/core/ref.c
SRC += src/core/utf.c
SRC += src/core/util.c

View File

@ -41,14 +41,25 @@ CFLAGS_@(WEBVR) += LOVR_USE_WEBVR
CFLAGS_@(LEAP) += LOVR_USE_LEAP
## Platforms
# $(LDFLAGS_@(TUP_PLATFORM)) doesn't seem to work, oh well
ifeq (@(TUP_PLATFORM),macosx)
# A little gnarly, but basically you can set CONFIG_PLATFORM to pick a specific one, otherwise
# we use the builtin TUP_PLATFORM which is the current OS (so it won't work with android/web).
# Also macosx gets converted to macos
ifeq (@(PLATFORM),)
PLATFORM = @(TUP_PLATFORM)
else
PLATFORM = @(PLATFORM)
endif
ifeq ($(PLATFORM),macosx)
PLATFORM = macos
endif
ifeq ($(PLATFORM),macosx)
LDFLAGS += -lobjc
LDFLAGS += -pagezero_size 10000 -image_base 100000000
ORIGIN = @executable_path
SO = dylib
endif
ifeq (@(TUP_PLATFORM),linux)
ifeq ($(PLATFORM),linux)
LDFLAGS += -lm -lpthread
ORIGIN = \$ORIGIN
SO = so

View File

@ -1,6 +1,6 @@
#include "api.h"
#include "core/os.h"
#include "core/ref.h"
#include "core/platform.h"
#include "core/util.h"
#include <stdlib.h>
#include <stdarg.h>

View File

@ -1,7 +1,7 @@
#include "api.h"
#include "event/event.h"
#include "thread/thread.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/ref.h"
#include "core/util.h"
#include <stdlib.h>

View File

@ -2,7 +2,7 @@
#include "filesystem/filesystem.h"
#include "data/blob.h"
#include "core/fs.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/ref.h"
#include <stdlib.h>
#include <string.h>

View File

@ -1,6 +1,6 @@
#include "api.h"
#include "core/os.h"
#include "core/util.h"
#include "core/platform.h"
#include "lib/lua-cjson/lua_cjson.h"
#include "lib/lua-enet/enet.h"

View File

@ -1,7 +1,5 @@
#include "util.h"
// Include this in ONE translation unit
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#ifndef EMSCRIPTEN

View File

@ -1,8 +1,8 @@
#include "platform.h"
#include "os.h"
#include <string.h>
#include <time.h>
#include "platform_glfw.c.h"
#include "os_glfw.h"
static uint64_t epoch;
#define NS_PER_SEC 1000000000ULL

View File

@ -1,13 +0,0 @@
#include "platform.h"
#ifdef _WIN32
#include "platform_windows.c.h"
#elif __APPLE__
#include "platform_macos.c.h"
#elif __ANDROID__
#include "platform_android.c.h"
#elif __linux__
#include "platform_linux.c.h"
#elif EMSCRIPTEN
#include "platform_web.c.h"
#endif

View File

@ -1,6 +1,6 @@
#include "resources/boot.lua.h"
#include "api/api.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/util.h"
#include <stdbool.h>
#include <string.h>

View File

@ -1,6 +1,6 @@
#include "event/event.h"
#include "core/arr.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/ref.h"
#include "core/util.h"
#include <stdlib.h>

View File

@ -1,7 +1,7 @@
#include "graphics/font.h"
#include "data/modelData.h"
#include "core/maf.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/util.h"
#include <stdbool.h>
#include <stdint.h>

View File

@ -1,7 +1,7 @@
#include "headset/headset.h"
#include "graphics/graphics.h"
#include "core/maf.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/util.h"
#include <math.h>
#include <stdint.h>

View File

@ -1,6 +1,6 @@
#include "headset/headset.h"
#include "core/maf.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/util.h"
#include "lib/tinycthread/tinycthread.h"
#include <LeapC.h>

View File

@ -2,7 +2,7 @@
#include "oculus_mobile_bridge.h"
#include "graphics/graphics.h"
#include "graphics/canvas.h"
#include "core/platform.h"
#include "core/os.h"
#include "lib/glad/glad.h"
#include <android/log.h>
#include <assert.h>

View File

@ -8,7 +8,7 @@
#include "graphics/graphics.h"
#include "graphics/canvas.h"
#include "core/maf.h"
#include "core/platform.h"
#include "core/os.h"
#include "core/ref.h"
#include <stdbool.h>
#include <stdio.h>

View File

@ -1,5 +1,5 @@
#include "timer/timer.h"
#include "core/platform.h"
#include "core/os.h"
#include <string.h>
static struct {

View File

@ -11,6 +11,7 @@
# CMAKE_DEPS: Assume libraries were built by CMake in the `build` folder.
# EXTRA_CFLAGS: Additional compiler flags (e.g. libraries, warnings).
# EXTRA_LDFLAGS: Additional linker flags.
# PLATFORM: The platform to compile for (win32, macos, linux, android, web, or blank to autodetect).
CONFIG_CC=clang
CONFIG_STRICT=y
CONFIG_DEBUG=y
@ -19,6 +20,7 @@ CONFIG_SANITIZE=n
CONFIG_CMAKE_DEPS=y
CONFIG_EXTRA_CFLAGS=
CONFIG_EXTRA_LDFLAGS=
CONFIG_PLATFORM=
## Modules
# The set of enabled Lua modules.