Skip to content

Commit d88b673

Browse files
committed
Make MinGW builds fully statically linked
Note the pthread usage is due to the Worker support, which is gated out on Windows so there should be no need to link with pthreads on MinGW.
1 parent 5573681 commit d88b673

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ jobs:
250250
- name: stats
251251
run: |
252252
make stats
253+
ldd build/qjs
253254
- name: test
254255
run: |
255256
make test

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ if(BUILD_QJS_LIBC)
132132
list(APPEND qjs_sources quickjs-libc.c)
133133
endif()
134134
list(APPEND qjs_defines _GNU_SOURCE)
135-
list(APPEND qjs_libs qjs m pthread)
135+
list(APPEND qjs_libs qjs m)
136136
if(NOT MINGW)
137-
list(APPEND qjs_libs dl)
137+
list(APPEND qjs_libs dl pthread)
138138
endif()
139139

140140
add_library(qjs ${qjs_sources})
@@ -180,7 +180,9 @@ set_target_properties(qjs_exe PROPERTIES
180180
)
181181
target_compile_definitions(qjs_exe PRIVATE ${qjs_defines})
182182
target_link_libraries(qjs_exe ${qjs_libs})
183-
if(NOT MINGW)
183+
if(MINGW)
184+
target_link_options(qjs_exe PRIVATE -static -static-libgcc)
185+
else()
184186
set_target_properties(qjs_exe PROPERTIES ENABLE_EXPORTS TRUE)
185187
endif()
186188

0 commit comments

Comments
 (0)