mirror of https://github.com/bjornbytes/lovr.git
platform -> os;
The function names are staying the same for now.
This commit is contained in:
parent
63dc8f6c9b
commit
e2d8f8c645
|
@ -296,7 +296,6 @@ set(LOVR_SRC
|
||||||
src/core/fs.c
|
src/core/fs.c
|
||||||
src/core/maf.c
|
src/core/maf.c
|
||||||
src/core/map.c
|
src/core/map.c
|
||||||
src/core/platform.c
|
|
||||||
src/core/ref.c
|
src/core/ref.c
|
||||||
src/core/utf.c
|
src/core/utf.c
|
||||||
src/core/util.c
|
src/core/util.c
|
||||||
|
@ -513,6 +512,7 @@ endif()
|
||||||
|
|
||||||
# Platforms
|
# Platforms
|
||||||
if(WIN32)
|
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 COMPILE_FLAGS "/wd4244 /MP")
|
||||||
set_target_properties(lovr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
set_target_properties(lovr PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||||
set_target_properties(lovr PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
|
set_target_properties(lovr PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
|
||||||
|
@ -541,6 +541,7 @@ if(WIN32)
|
||||||
move_dll(${LOVR_LEAP})
|
move_dll(${LOVR_LEAP})
|
||||||
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
target_sources(lovr PRIVATE src/core/os_macos.c)
|
||||||
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
||||||
if(LOVR_BUILD_BUNDLE)
|
if(LOVR_BUILD_BUNDLE)
|
||||||
function(move_lib)
|
function(move_lib)
|
||||||
|
@ -570,10 +571,13 @@ elseif(APPLE)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(EMSCRIPTEN)
|
elseif(EMSCRIPTEN)
|
||||||
|
target_sources(lovr PRIVATE src/core/os_web.c)
|
||||||
target_compile_definitions(lovr PRIVATE -DLOVR_WEBGL)
|
target_compile_definitions(lovr PRIVATE -DLOVR_WEBGL)
|
||||||
elseif(ANDROID)
|
elseif(ANDROID)
|
||||||
|
target_sources(lovr PRIVATE src/core/os_android.c)
|
||||||
target_link_libraries(lovr log EGL GLESv3)
|
target_link_libraries(lovr log EGL GLESv3)
|
||||||
target_compile_definitions(lovr PRIVATE -DLOVR_GLES)
|
target_compile_definitions(lovr PRIVATE -DLOVR_GLES)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
|
target_sources(lovr PRIVATE src/core/os_linux.c)
|
||||||
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
target_compile_definitions(lovr PRIVATE -DLOVR_GL)
|
||||||
endif()
|
endif()
|
||||||
|
|
2
Tupfile
2
Tupfile
|
@ -5,7 +5,7 @@ SRC += src/core/arr.c
|
||||||
SRC += src/core/fs.c
|
SRC += src/core/fs.c
|
||||||
SRC += src/core/maf.c
|
SRC += src/core/maf.c
|
||||||
SRC += src/core/map.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/ref.c
|
||||||
SRC += src/core/utf.c
|
SRC += src/core/utf.c
|
||||||
SRC += src/core/util.c
|
SRC += src/core/util.c
|
||||||
|
|
17
Tuprules.tup
17
Tuprules.tup
|
@ -41,14 +41,25 @@ CFLAGS_@(WEBVR) += LOVR_USE_WEBVR
|
||||||
CFLAGS_@(LEAP) += LOVR_USE_LEAP
|
CFLAGS_@(LEAP) += LOVR_USE_LEAP
|
||||||
|
|
||||||
## Platforms
|
## Platforms
|
||||||
# $(LDFLAGS_@(TUP_PLATFORM)) doesn't seem to work, oh well
|
# A little gnarly, but basically you can set CONFIG_PLATFORM to pick a specific one, otherwise
|
||||||
ifeq (@(TUP_PLATFORM),macosx)
|
# 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 += -lobjc
|
||||||
LDFLAGS += -pagezero_size 10000 -image_base 100000000
|
LDFLAGS += -pagezero_size 10000 -image_base 100000000
|
||||||
ORIGIN = @executable_path
|
ORIGIN = @executable_path
|
||||||
SO = dylib
|
SO = dylib
|
||||||
endif
|
endif
|
||||||
ifeq (@(TUP_PLATFORM),linux)
|
ifeq ($(PLATFORM),linux)
|
||||||
LDFLAGS += -lm -lpthread
|
LDFLAGS += -lm -lpthread
|
||||||
ORIGIN = \$ORIGIN
|
ORIGIN = \$ORIGIN
|
||||||
SO = so
|
SO = so
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
#include "core/os.h"
|
||||||
#include "core/ref.h"
|
#include "core/ref.h"
|
||||||
#include "core/platform.h"
|
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include "event/event.h"
|
#include "event/event.h"
|
||||||
#include "thread/thread.h"
|
#include "thread/thread.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/ref.h"
|
#include "core/ref.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "filesystem/filesystem.h"
|
#include "filesystem/filesystem.h"
|
||||||
#include "data/blob.h"
|
#include "data/blob.h"
|
||||||
#include "core/fs.h"
|
#include "core/fs.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/ref.h"
|
#include "core/ref.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
#include "core/os.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include "core/platform.h"
|
|
||||||
#include "lib/lua-cjson/lua_cjson.h"
|
#include "lib/lua-cjson/lua_cjson.h"
|
||||||
#include "lib/lua-enet/enet.h"
|
#include "lib/lua-enet/enet.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
// Include this in ONE translation unit
|
|
||||||
|
|
||||||
#define GLFW_INCLUDE_NONE
|
#define GLFW_INCLUDE_NONE
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#ifndef EMSCRIPTEN
|
#ifndef EMSCRIPTEN
|
|
@ -1,8 +1,8 @@
|
||||||
#include "platform.h"
|
#include "os.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "platform_glfw.c.h"
|
#include "os_glfw.h"
|
||||||
|
|
||||||
static uint64_t epoch;
|
static uint64_t epoch;
|
||||||
#define NS_PER_SEC 1000000000ULL
|
#define NS_PER_SEC 1000000000ULL
|
|
@ -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
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "resources/boot.lua.h"
|
#include "resources/boot.lua.h"
|
||||||
#include "api/api.h"
|
#include "api/api.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "event/event.h"
|
#include "event/event.h"
|
||||||
#include "core/arr.h"
|
#include "core/arr.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/ref.h"
|
#include "core/ref.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "graphics/font.h"
|
#include "graphics/font.h"
|
||||||
#include "data/modelData.h"
|
#include "data/modelData.h"
|
||||||
#include "core/maf.h"
|
#include "core/maf.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "headset/headset.h"
|
#include "headset/headset.h"
|
||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
#include "core/maf.h"
|
#include "core/maf.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "headset/headset.h"
|
#include "headset/headset.h"
|
||||||
#include "core/maf.h"
|
#include "core/maf.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/util.h"
|
#include "core/util.h"
|
||||||
#include "lib/tinycthread/tinycthread.h"
|
#include "lib/tinycthread/tinycthread.h"
|
||||||
#include <LeapC.h>
|
#include <LeapC.h>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "oculus_mobile_bridge.h"
|
#include "oculus_mobile_bridge.h"
|
||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
#include "graphics/canvas.h"
|
#include "graphics/canvas.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "lib/glad/glad.h"
|
#include "lib/glad/glad.h"
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
#include "graphics/canvas.h"
|
#include "graphics/canvas.h"
|
||||||
#include "core/maf.h"
|
#include "core/maf.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include "core/ref.h"
|
#include "core/ref.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "timer/timer.h"
|
#include "timer/timer.h"
|
||||||
#include "core/platform.h"
|
#include "core/os.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# CMAKE_DEPS: Assume libraries were built by CMake in the `build` folder.
|
# CMAKE_DEPS: Assume libraries were built by CMake in the `build` folder.
|
||||||
# EXTRA_CFLAGS: Additional compiler flags (e.g. libraries, warnings).
|
# EXTRA_CFLAGS: Additional compiler flags (e.g. libraries, warnings).
|
||||||
# EXTRA_LDFLAGS: Additional linker flags.
|
# EXTRA_LDFLAGS: Additional linker flags.
|
||||||
|
# PLATFORM: The platform to compile for (win32, macos, linux, android, web, or blank to autodetect).
|
||||||
CONFIG_CC=clang
|
CONFIG_CC=clang
|
||||||
CONFIG_STRICT=y
|
CONFIG_STRICT=y
|
||||||
CONFIG_DEBUG=y
|
CONFIG_DEBUG=y
|
||||||
|
@ -19,6 +20,7 @@ CONFIG_SANITIZE=n
|
||||||
CONFIG_CMAKE_DEPS=y
|
CONFIG_CMAKE_DEPS=y
|
||||||
CONFIG_EXTRA_CFLAGS=
|
CONFIG_EXTRA_CFLAGS=
|
||||||
CONFIG_EXTRA_LDFLAGS=
|
CONFIG_EXTRA_LDFLAGS=
|
||||||
|
CONFIG_PLATFORM=
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
# The set of enabled Lua modules.
|
# The set of enabled Lua modules.
|
||||||
|
|
Loading…
Reference in New Issue