Added C++ to the build and started writing the actual Haiku code. I think this isg oing to have to require a GCC 4 hybrid...

This commit is contained in:
Pietro Gagliardi 2015-11-17 11:49:23 -05:00
parent e24bde16ba
commit c40e80d5a5
9 changed files with 75 additions and 5 deletions

View File

@ -2,6 +2,7 @@
OFILES = \
$(subst /,_,$(CFILES)) \
$(subst /,_,$(CXXFILES)) \
$(subst /,_,$(MFILES)) \
$(subst /,_,$(RCFILES))
@ -14,6 +15,13 @@ CFLAGS += \
-Wno-switch \
--std=c99
CXXFLAGS += \
-g \
-Wall -Wextra \
-Wno-unused-parameter \
-Wno-switch \
--std=c++03
LDFLAGS += \
-g
@ -27,8 +35,14 @@ endif
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
ifdef CXXFILES
reallinker = $(CXX)
else
reallinker = $(CC)
endif
$(OUT): $(OFILES) | $(OUTDIR)
@$(CC) -o $(OUT) $(OFILES) $(LDFLAGS)
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
@echo ====== Linked $(OUT)
.SECONDEXPANSION:
@ -37,6 +51,10 @@ $(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
@$(CC) -o $@ -c $< $(CFLAGS)
@echo ====== Compiled $<
$(OBJDIR)/%.cpp.o: $$(subst _,/,%).cpp $(HFILES) | $(OBJDIR)
@$(CXX) -o $@ -c $< $(CXXFLAGS)
@echo ====== Compiled $<
$(OBJDIR)/%.m.o: $$(subst _,/,%).m $(HFILES) | $(OBJDIR)
@$(CC) -o $@ -c $< $(CFLAGS)
@echo ====== Compiled $<

View File

@ -10,7 +10,7 @@ include $(OS)/GNUmakeinc.mk
HFILES += \
ui.h \
ui_$(OS).h
ui_$(OS)$(OSHSUFFIX)
NAME = libui

View File

@ -2,3 +2,4 @@
EXESUFFIX =
LIBSUFFIX = .dylib
OSHSUFFIX = .h

View File

@ -1,12 +1,13 @@
# 22 april 2015
CFILES += \
CXXFILES += \
haiku/main.cpp
HFILES += \
haiku/uipriv_haiku.h
haiku/uipriv_haiku.hpp
# thanks ebassi in irc.gimp.net/#gtk+
CFLAGS += \
CXXFLAGS += \
-D_UI_EXTERN='__attribute__((visibility("default"))) extern' \
-fvisibility=hidden \
-fPIC

View File

@ -2,3 +2,4 @@
EXESUFFIX =
LIBSUFFIX = .so
OSHSUFFIX = .hpp

41
haiku/main.cpp Normal file
View File

@ -0,0 +1,41 @@
// 17 november 2015
#include "uipriv_haiku.hpp"
static BApplication *app;
uiInitOptions options;
const char *uiInit(uiInitOptions *o)
{
status_t err;
options = *o;
// TODO properly set the MIME type
app = new BApplication("application/x-vnd.andlabs.libui", &err);
if (err != B_NO_ERROR) {
delete app;
// TODO
return "fail";
}
return NULL;
}
void uiUninit(void)
{
delete app;
}
void uiFreeInitError(const char *err)
{
// TODO
}
void uiMain(void)
{
app->Run();
}
void uiQuit(void)
{
app->Quit();
}

6
haiku/uipriv_haiku.hpp Normal file
View File

@ -0,0 +1,6 @@
// 17 november 2015
// TODO versioning macros?
#include <InterfaceKit.h>
#include "../ui.h"
#include "../ui_haiku.hpp"
#include "../common/uipriv.h"

View File

@ -2,3 +2,4 @@
EXESUFFIX =
LIBSUFFIX = .so
OSHSUFFIX = .h

View File

@ -2,6 +2,7 @@
EXESUFFIX = .exe
LIBSUFFIX = .dll
OSHSUFFIX = .h
# TODO only when cross-compiling?
ifeq ($(ARCH),amd64)