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

View File

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

View File

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

View File

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

View File

@ -2,3 +2,4 @@
EXESUFFIX = EXESUFFIX =
LIBSUFFIX = .so 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 = EXESUFFIX =
LIBSUFFIX = .so LIBSUFFIX = .so
OSHSUFFIX = .h

View File

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