Skip to content

Commit

Permalink
Correct Windows build processes
Browse files Browse the repository at this point in the history
This fixes an issue where the CI-built Windows DLL required the MSYS
`libwinpthread-1.dll` library as a dependency, which it should not have.
  • Loading branch information
Fayti1703 committed Aug 25, 2023
2 parents bd58003 + 8dff6bf commit 1323263
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
run: |
cd NativeComponents/
make
- name: Dump Result Dependencies
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
dumpbin /DEPENDENTS NativeComponents\ImGuizmo-Bridge.dll
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
21 changes: 18 additions & 3 deletions NativeComponents/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ else
os_target := libImGuizmo-Bridge.so
endif

ifndef write_file
$(info Using shell auto-detection to determine the correct commands / args for your shell.)
$(info (Supply `write_file` and `echo_empty` if generating the license fails))
ifeq ($(shell echo %COMSPEC%), %COMSPEC%)
$(info Detected POSIX-compatible shell.)
write_file := cat
Expand All @@ -34,6 +31,14 @@ echo_empty := echo
define ensure_dir
@mkdir -p $(1)
endef

ifndef STATIC_LIBWINPTHREAD
ifneq (,$(findstring MSYS_NT,$(shell uname -s)))
$(info Detected MSYS2 build environment.)
STATIC_LIBWINPTHREAD=y
endif
endif

else
$(info Detected Windows cmd.exe.)
write_file := type
Expand All @@ -42,10 +47,20 @@ echo_empty := echo.
define ensure_dir
@if not exist "$(1)" ( mkdir "$(1)" )
endef

ifndef STATIC_LIBWINPTHREAD
$(info Assuming MSYS2 build environment.)
$(info Specify STATIC_LIBWINPTHREAD=n if you receive errors regarding 'winpthread'.)
STATIC_LIBWINPTHREAD=y
endif

endif

ifeq ($(STATIC_LIBWINPTHREAD),y)
override CXXLDFLAGS += -Wl,--push-state -Wl,-Bstatic -Wl,--whole-archive -Wl,-lwinpthread -Wl,--pop-state
endif


.PHONY: clean build

IMGUI_OBJS := $(addprefix ImGui/obj/, imgui.o imgui_tables.o imgui_widgets.o imgui_draw.o)
Expand Down

0 comments on commit 1323263

Please sign in to comment.