mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Make it easier to compile for BearSSL
This commit is contained in:
parent
acd8cb0d50
commit
d48a14f9c9
3 changed files with 55 additions and 37 deletions
20
Makefile
20
Makefile
|
@ -5,7 +5,7 @@ C_OBJECTS = $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
|
|||
|
||||
OBJECTS = $(C_OBJECTS)
|
||||
ENAME = ClassiCube
|
||||
CFLAGS = -g -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=maybe-uninitialized
|
||||
CFLAGS = -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=maybe-uninitialized
|
||||
LDFLAGS = -g -rdynamic
|
||||
|
||||
ifndef RM
|
||||
|
@ -97,7 +97,7 @@ endif
|
|||
|
||||
ifeq ($(PLAT),haiku)
|
||||
OBJECTS += $(BUILD_DIR)/Platform_BeOS.o $(BUILD_DIR)/Window_BeOS.o
|
||||
CFLAGS = -g -pipe -fno-math-errno
|
||||
CFLAGS = -pipe -fno-math-errno
|
||||
LDFLAGS = -g
|
||||
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
|
||||
BUILD_DIR = build-haiku
|
||||
|
@ -105,7 +105,7 @@ endif
|
|||
|
||||
ifeq ($(PLAT),beos)
|
||||
OBJECTS += $(BUILD_DIR)/Platform_BeOS.o $(BUILD_DIR)/Window_BeOS.o
|
||||
CFLAGS = -g -pipe
|
||||
CFLAGS = -pipe
|
||||
LDFLAGS = -g
|
||||
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
|
||||
BUILD_DIR = build-beos
|
||||
|
@ -132,13 +132,22 @@ ifdef SDL3
|
|||
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3
|
||||
LIBS += -lSDL3
|
||||
endif
|
||||
|
||||
ifdef TERMINAL
|
||||
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_TERMINAL -DCC_GFX_BACKEND=CC_GFX_BACKEND_SOFTGPU
|
||||
LIBS := $(subst mwindows,mconsole,$(LIBS))
|
||||
endif
|
||||
|
||||
ifdef BEARSSL
|
||||
BEARSSL_SOURCES = $(wildcard third_party/bearssl/src/*.c)
|
||||
BEARSSL_OBJECTS = $(patsubst third_party/bearssl/src/%.c, $(BUILD_DIR)/%.o, $(BEARSSL_SOURCES))
|
||||
OBJECTS += $(BEARSSL_OBJECTS)
|
||||
CFLAGS += -Ithird_party/bearssl/inc -DCC_SSL_BACKEND=CC_SSL_BACKEND_BEARSSL -DCC_NET_BACKEND=CC_NET_BACKEND_BUILTIN
|
||||
endif
|
||||
|
||||
ifdef RELEASE
|
||||
CFLAGS += -O1
|
||||
else
|
||||
CFLAGS += -g
|
||||
endif
|
||||
|
||||
default: $(PLAT)
|
||||
|
@ -255,6 +264,9 @@ $(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.m
|
|||
|
||||
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
|
||||
|
||||
# EXTRA_CFLAGS and EXTRA_LIBS are not defined in the makefile intentionally -
|
||||
# define them on the command line as a simple way of adding CFLAGS/LIBS
|
||||
|
|
68
src/Core.h
68
src/Core.h
|
@ -145,6 +145,9 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_SSL_BACKEND_BEARSSL 2
|
||||
#define CC_SSL_BACKEND_SCHANNEL 3
|
||||
|
||||
#define CC_NET_BACKEND_BUILTIN 1
|
||||
#define CC_NET_BACKEND_LIBCURL 2
|
||||
|
||||
#define CC_AUD_BACKEND_OPENAL 1
|
||||
#define CC_AUD_BACKEND_WINMM 2
|
||||
#define CC_AUD_BACKEND_OPENSLES 3
|
||||
|
@ -169,8 +172,8 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_NOSOUNDS
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#elif defined XENON
|
||||
/* libxenon also defines __linux__ (yes, really) */
|
||||
|
@ -179,13 +182,13 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_NOSOUNDS
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#elif defined _WIN32
|
||||
#define CC_BUILD_WIN
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_WINMM
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_SCHANNEL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_WINMM
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_D3D9
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_WIN32
|
||||
#elif defined __ANDROID__
|
||||
|
@ -202,7 +205,7 @@ typedef cc_uint8 cc_bool;
|
|||
#elif defined __serenity__
|
||||
#define CC_BUILD_SERENITY
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_SDL2
|
||||
|
@ -210,7 +213,7 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LINUX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
#if defined CC_BUILD_RPI
|
||||
|
@ -231,10 +234,10 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_CFNETWORK
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL2
|
||||
#else
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_COCOA
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define CC_BUILD_MACOS
|
||||
#define CC_BUILD_CURL
|
||||
#endif
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined Macintosh
|
||||
|
@ -251,7 +254,7 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_SOLARIS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
|
@ -260,7 +263,7 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
|
@ -269,7 +272,7 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
|
@ -278,15 +281,15 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_BSD
|
||||
#define CC_BUILD_XINPUT2
|
||||
#define CC_BUILD_CURL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
#elif defined __HAIKU__
|
||||
#define CC_BUILD_HAIKU
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_BEOS
|
||||
|
@ -294,16 +297,16 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_BEOS
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_GL11
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BACKTRACE_BUILTIN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_BEOS
|
||||
#elif defined __sgi
|
||||
#define CC_BUILD_IRIX
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BIG_ENDIAN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL1
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_X11
|
||||
|
@ -324,16 +327,16 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_COOPTHREADED
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined __3DS__
|
||||
#define CC_BUILD_3DS
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_DUALSCREEN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#elif defined GEKKO
|
||||
#define CC_BUILD_GCWII
|
||||
|
@ -342,32 +345,32 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LOWMEM
|
||||
#endif
|
||||
#define CC_BUILD_COOPTHREADED
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#elif defined __vita__
|
||||
#define CC_BUILD_PSVITA
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_TOUCH
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined _arch_dreamcast
|
||||
#define CC_BUILD_DREAMCAST
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define CC_BUILD_SMALLSTACK
|
||||
#undef CC_BUILD_RESOURCES
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#elif defined PLAT_PS3
|
||||
#define CC_BUILD_PS3
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined N64
|
||||
#define CC_BIG_ENDIAN
|
||||
#define CC_BUILD_N64
|
||||
|
@ -385,10 +388,10 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_COOPTHREADED
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined PLAT_NDS
|
||||
#define CC_BUILD_NDS
|
||||
#define CC_BUILD_CONSOLE
|
||||
|
@ -396,29 +399,29 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_COOPTHREADED
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_NOSOUNDS
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_SMALLSTACK
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#elif defined __WIIU__
|
||||
#define CC_BUILD_WIIU
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_COOPTHREADED
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_SPLITSCREEN
|
||||
#define CC_BUILD_TOUCH
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_OPENAL
|
||||
#elif defined __SWITCH__
|
||||
#define CC_BUILD_SWITCH
|
||||
#define CC_BUILD_CONSOLE
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL2
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_SSL_BACKEND CC_SSL_BACKEND_BEARSSL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_GL2
|
||||
#elif defined PLAT_PS1
|
||||
#define CC_BUILD_PS1
|
||||
#define CC_BUILD_CONSOLE
|
||||
|
@ -436,8 +439,8 @@ typedef cc_uint8 cc_bool;
|
|||
#elif defined OS2
|
||||
#define CC_BUILD_OS2
|
||||
#define CC_BUILD_POSIX
|
||||
#define CC_BUILD_CURL
|
||||
#define CC_BUILD_FREETYPE
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_LIBCURL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_SOFTGPU
|
||||
#define DEFAULT_WIN_BACKEND CC_WIN_BACKEND_SDL2
|
||||
#elif defined PLAT_SATURN
|
||||
|
@ -469,6 +472,9 @@ typedef cc_uint8 cc_bool;
|
|||
#if defined DEFAULT_SSL_BACKEND && !defined CC_SSL_BACKEND
|
||||
#define CC_SSL_BACKEND DEFAULT_SSL_BACKEND
|
||||
#endif
|
||||
#if defined DEFAULT_NET_BACKEND && !defined CC_NET_BACKEND
|
||||
#define CC_NET_BACKEND DEFAULT_NET_BACKEND
|
||||
#endif
|
||||
#if defined DEFAULT_AUD_BACKEND && !defined CC_AUD_BACKEND
|
||||
#define CC_AUD_BACKEND DEFAULT_AUD_BACKEND
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,7 @@ static cc_string* Http_GetUserAgent_UNSAFE(void) {
|
|||
}
|
||||
|
||||
|
||||
#if defined CC_BUILD_CURL
|
||||
#if CC_NET_BACKEND == CC_NET_BACKEND_LIBCURL
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------libcurl backend-----------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
|
@ -355,7 +355,7 @@ static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* url) {
|
|||
_curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, NULL);
|
||||
return res;
|
||||
}
|
||||
#elif defined CC_BUILD_HTTPCLIENT
|
||||
#elif CC_NET_BACKEND == CC_NET_BACKEND_BUILTIN
|
||||
#include "Errors.h"
|
||||
#include "PackedCol.h"
|
||||
#include "SSL.h"
|
||||
|
|
Loading…
Reference in a new issue