Browse Source

Allow custom DGL build for wine, adjust code where needed

tags/v2.1-alpha1-winvst
falkTX 6 years ago
parent
commit
5c5d87d0ae
5 changed files with 33 additions and 5 deletions
  1. +2
    -0
      source/Makefile.mk
  2. +0
    -2
      source/jackbridge/Makefile
  3. +24
    -2
      source/modules/dgl/Makefile
  4. +3
    -1
      source/modules/dgl/src/Window.cpp
  5. +4
    -0
      source/modules/dgl/src/pugl/pugl_win.cpp

+ 2
- 0
source/Makefile.mk View File

@@ -11,6 +11,8 @@ AR ?= ar
CC ?= gcc
CXX ?= g++

WINECC ?= winegcc

# ---------------------------------------------------------------------------------------------------------------------
# Auto-detect OS if not defined



+ 0
- 2
source/jackbridge/Makefile View File

@@ -10,8 +10,6 @@ include ../modules/Makefile.mk

# ----------------------------------------------------------------------------------------------------------------------------

WINECC ?= winegcc

BUILD_CXX_FLAGS += $(JACKBRIDGE_FLAGS)
LINK_FLAGS += $(JACKBRIDGE_LIBS)



+ 24
- 2
source/modules/dgl/Makefile View File

@@ -29,14 +29,24 @@ else
OBJS += $(OBJDIR)/Window.cpp.o
endif

OBJS_wine = \
$(OBJDIR)/Application.cpp-wine.o \
$(OBJDIR)/Color.cpp-wine.o \
$(OBJDIR)/Geometry.cpp-wine.o \
$(OBJDIR)/Image.cpp-wine.o \
$(OBJDIR)/ImageWidgets.cpp-wine.o \
$(OBJDIR)/Widget.cpp-wine.o \
$(OBJDIR)/Window.cpp-wine.o

# ----------------------------------------------------------------------------------------------------------------------------

all: $(MODULEDIR)/$(MODULENAME).a
all: $(MODULEDIR)/$(MODULENAME).a
wine: $(MODULEDIR)/$(MODULENAME).wine.a

# ----------------------------------------------------------------------------------------------------------------------------

clean:
rm -f $(OBJDIR)/*.o $(MODULEDIR)/$(MODULENAME)*.a
rm -f $(OBJDIR)/*.o $(MODULEDIR)/$(MODULENAME)*.a $(MODULEDIR)/$(MODULENAME).wine.a

debug:
$(MAKE) DEBUG=true
@@ -49,6 +59,12 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS)
@rm -f $@
@$(AR) crs $@ $^

$(MODULEDIR)/$(MODULENAME).wine.a: $(OBJS_wine)
-@mkdir -p $(MODULEDIR)
@echo "Creating $(MODULENAME).wine.a"
@rm -f $@
@$(AR) crs $@ $^

# ----------------------------------------------------------------------------------------------------------------------------

$(OBJDIR)/%.cpp.o: src/%.cpp
@@ -56,11 +72,17 @@ $(OBJDIR)/%.cpp.o: src/%.cpp
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

$(OBJDIR)/%.cpp-wine.o: src/%.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling $< (Wine)"
@$(WINECC) $< $(BUILD_CXX_FLAGS) -c -o $@

$(OBJDIR)/Window.mm.o: src/Window.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@

-include $(OBJS:%.o=%.d)
-include $(OBJS_wine:%.o=%.d)

# ----------------------------------------------------------------------------------------------------------------------------

+ 3
- 1
source/modules/dgl/src/Window.cpp View File

@@ -32,6 +32,8 @@

#if defined(DISTRHO_OS_WINDOWS)
# include "pugl/pugl_win.cpp"
# undef max
# undef min
#elif defined(DISTRHO_OS_MAC)
# define PuglWindow DISTRHO_JOIN_MACRO(PuglWindow, DGL_NAMESPACE)
# define PuglOpenGLView DISTRHO_JOIN_MACRO(PuglOpenGLView, DGL_NAMESPACE)
@@ -573,7 +575,7 @@ struct Window::PrivateData {

#if defined(DISTRHO_OS_WINDOWS)
const int winFlags = WS_POPUPWINDOW | WS_CAPTION | (fResizable ? WS_SIZEBOX : 0x0);
RECT wr = { 0, 0, static_cast<long>(width), static_cast<long>(height) };
RECT wr = { 0, 0, static_cast<LONG>(width), static_cast<LONG>(height) };
AdjustWindowRectEx(&wr, fUsingEmbed ? WS_CHILD : winFlags, FALSE, WS_EX_TOPMOST);

SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top,


+ 4
- 0
source/modules/dgl/src/pugl/pugl_win.cpp View File

@@ -111,7 +111,11 @@ puglCreateWindow(PuglView* view, const char* title)
static int wc_count = 0;
char classNameBuf[256];
std::srand((std::time(NULL)));
#ifdef __WINE__
std::snprintf(classNameBuf, sizeof(classNameBuf), "%s_%d-%d", title, std::rand(), ++wc_count);
#else
_snprintf(classNameBuf, sizeof(classNameBuf), "%s_%d-%d", title, std::rand(), ++wc_count);
#endif
classNameBuf[sizeof(classNameBuf)-1] = '\0';

impl->wc.style = CS_OWNDC;


Loading…
Cancel
Save