Skip to content

Commit

Permalink
improve .dll and add .lib for mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
zefie committed Nov 1, 2021
1 parent 03c70c2 commit 75acae9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions minibae/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CXX := i686-w64-mingw32-g++-win32
LD := $(CC)
AR := i686-w64-mingw32-gcc-ar-win32
STRIP := i686-w64-mingw32-strip

DLLTOOL := i686-w64-mingw32-dlltool
OPTI := -O2
CFLAGS := $(ARCH) $(OPTI) $(INC_PATH) -D_THREAD_SAFE -Wno-unused-value

Expand Down Expand Up @@ -51,7 +51,12 @@ $(TARGET_LIB).a: $(OBJ)

$(TARGET_LIB).dll: ${OBJ}
@mkdir -p $(TARGET_OUT)
${CC} -shared $(LDFLAGS) ${OBJ} -Wl,--subsystem,windows ${LIBS} -o $(TARGET_OUT)${TARGET_LIB}.dll
@$(DLLTOOL) --export-all --export-all-symbols -e $(OBJ_DIR)exports.o -z $(OBJ_DIR)$(TARGET_LIB).def2 $(OBJ)
@echo "EXPORTS" > $(OBJ_DIR)$(TARGET_LIB).def
@cat $(OBJ_DIR)$(TARGET_LIB).def2 | grep "BAE" >> $(OBJ_DIR)$(TARGET_LIB).def
@rm -f $(OBJ_DIR)$(TARGET_LIB).def2 $(OBJ_DIR)exports.o
@$(DLLTOOL) -e $(OBJ_DIR)exports.o -d $(OBJ_DIR)$(TARGET_LIB).def -l $(TARGET_OUT)$(TARGET_LIB).lib $(OBJ)
${CC} -shared $(LDFLAGS) ${OBJ} $(OBJ_DIR)exports.o -Wl,--subsystem,windows ${LIBS} -o $(TARGET_OUT)${TARGET_LIB}.dll

$(TARGET_BIN): ${OBJ_BIN}
@mkdir -p $(TARGET_OUT)
Expand Down
3 changes: 2 additions & 1 deletion minibae/build_gh_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ runcmd make -f Makefile.clang clean
echo "Building MingW32..."
runcmd make -f Makefile.mingw clean all pack
install_file "${BDIR}/playbae.exe.gz" "${ODIR}/playbae.exe.gz"
runcmd zip -u "${ODIR}/libMiniBAE_win_DLL.zip" "${BDIR}/"*.dll
runcmd cd "${BDIR}" && runcmd zip -u "${ODIR}/libMiniBAE_win.zip" *.dll *.lib
runcmd cd "${RDIR}"
runcmd make -f Makefile.mingw clean

echo "Building Enscripten WASM32..."
Expand Down

0 comments on commit 75acae9

Please sign in to comment.