Skip to content

Commit 5443aa6

Browse files
committed
Some work towards making things build on Windows.
1 parent 902bf32 commit 5443aa6

File tree

5 files changed

+86
-81
lines changed

5 files changed

+86
-81
lines changed

.github/workflows/ccpp.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,38 +78,35 @@ jobs:
7878
7979
build-windows:
8080
runs-on: windows-latest
81+
defaults:
82+
run:
83+
shell: msys2 {0}
8184

8285
steps:
83-
- name: setup WSL
84-
run: |
85-
curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/41.0.0/Fedora-Remix-for-WSL-SL_41.0.0.0_x64_arm64.msixbundle -o fedora.msixbundle
86-
unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix
87-
unzip Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix install.tar.gz
88-
wsl --update
89-
wsl --set-default-version 1
90-
wsl --import fedora fedora install.tar.gz
91-
wsl --set-default fedora
92-
wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm'
93-
wsl sh -c 'dnf -y install gcc gcc-c++ protobuf-c-compiler protobuf-devel fmt-devel systemd-devel sqlite-devel wxGTK-devel mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-protobuf-static mingw32-sqlite-static mingw32-wxWidgets3-static mingw32-libpng-static mingw32-libjpeg-static mingw32-libtiff-static mingw32-nsis png2ico ninja-build mingw32-freetype mingw32-curl-static mingw32-boost-static'
94-
95-
- name: fix line endings
96-
run: |
97-
git config --global core.autocrlf false
98-
git config --global core.eol lf
99-
10086
- uses: actions/checkout@v4
10187
with:
10288
repository: 'davidgiven/fluxengine'
10389
path: 'fluxengine'
90+
submodules: 'true'
10491

10592
- uses: actions/checkout@v4
10693
with:
10794
repository: 'davidgiven/fluxengine-testdata'
10895
path: 'fluxengine-testdata'
10996

97+
- uses: msys2/setup-msys2@v2
98+
with:
99+
msystem: mingw64
100+
101+
- name: dependencies
102+
run: |
103+
set -x
104+
pacman -S --needed --noconfirm pactoys
105+
pacboy -S --needed --noconfirm protobuf:p pkg-config:p curl-winssl:p file:p glfw:p gcc:p mbedtls:p
106+
110107
- name: run
111108
run: |
112-
wsl sh -c 'make -C fluxengine BUILDTYPE=windows -j$(nproc)'
109+
wsl sh -c 'make -C fluxengine BUILDTYPE=windows'
113110
114111
- name: nsis
115112
run: |

Makefile

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif
99
export BUILDTYPE
1010

1111
ifeq ($(BUILDTYPE),windows)
12-
MINGW = i686-w64-mingw32-
12+
MINGW = x86_64-w64-mingw32-
1313
CC = $(MINGW)gcc
1414
CXX = $(MINGW)g++
1515
CFLAGS += -g -O3 \
@@ -23,12 +23,15 @@ ifeq ($(BUILDTYPE),windows)
2323
-Wno-deprecated-enum-enum-conversion \
2424
-U__GXX_TYPEINFO_EQUALITY_INLINE \
2525
-D__GXX_TYPEINFO_EQUALITY_INLINE
26-
LDFLAGS += -static -Wl,--gc-sections
27-
AR = $(MINGW)ar
28-
PKG_CONFIG = $(MINGW)pkg-config -static
26+
#LDFLAGS += -Wl,--gc-sections
27+
AR = $(MINGW)gcc-ar
28+
PKG_CONFIG = $(MINGW)pkg-config --static
2929
WINDRES = $(MINGW)windres
3030
WX_CONFIG = /usr/i686-w64-mingw32/sys-root/mingw/bin/wx-config-3.0 --static=yes
31+
PROTOC_SEPARATOR = ;
3132
EXT = .exe
33+
34+
AB_NO_SANDBOX = yes
3235
else
3336
CC = clang
3437
CXX = clang++
@@ -64,24 +67,24 @@ BINDIR ?= $(PREFIX)/bin
6467

6568
# Special Windows settings.
6669

67-
ifeq ($(OS), Windows_NT)
68-
EXT ?= .exe
69-
MINGWBIN = /mingw32/bin
70-
CCPREFIX = $(MINGWBIN)/
71-
PKG_CONFIG = $(MINGWBIN)/pkg-config
72-
WX_CONFIG = /usr/bin/sh $(MINGWBIN)/wx-config --static=yes
73-
PROTOC = $(MINGWBIN)/protoc
74-
WINDRES = windres
75-
LDFLAGS += \
76-
-static
77-
CXXFLAGS += \
78-
-fext-numeric-literals \
79-
-Wno-deprecated-enum-float-conversion \
80-
-Wno-deprecated-enum-enum-conversion
81-
82-
# Required to get the gcc run - time libraries on the path.
83-
export PATH := $(PATH):$(MINGWBIN)
84-
endif
70+
#ifeq ($(OS), Windows_NT)
71+
# EXT ?= .exe
72+
# MINGWBIN = /mingw32/bin
73+
# CCPREFIX = $(MINGWBIN)/
74+
# PKG_CONFIG = $(MINGWBIN)/pkg-config
75+
# WX_CONFIG = /usr/bin/sh $(MINGWBIN)/wx-config --static=yes
76+
# PROTOC = $(MINGWBIN)/protoc
77+
# WINDRES = windres
78+
# LDFLAGS += \
79+
# -static
80+
# CXXFLAGS += \
81+
# -fext-numeric-literals \
82+
# -Wno-deprecated-enum-float-conversion \
83+
# -Wno-deprecated-enum-enum-conversion
84+
#
85+
# # Required to get the gcc run - time libraries on the path.
86+
# export PATH := $(PATH):$(MINGWBIN)
87+
#endif
8588

8689
# Special OSX settings.
8790

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
name="all",
105105
items={
106106
"fluxengine$(EXT)": "src+fluxengine",
107-
"fluxengine-gui$(EXT)": "src/gui",
107+
# "fluxengine-gui$(EXT)": "src/gui",
108108
"gui2$(EXT)": "src/gui2",
109109
"brother120tool$(EXT)": "tools+brother120tool",
110110
"brother240tool$(EXT)": "tools+brother240tool",

src/gui2/build.py

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"-DIMHEX_STATIC_LINK_PLUGINS",
1313
'-DIMHEX_VERSION=\\"0.0.0\\"',
1414
"-DLUNASVG_BUILD_STATIC",
15+
"-DPLUTOVG_BUILD_STATIC",
16+
"-DUNICODE",
1517
# "-DDEBUG",
1618
]
1719
if config.osx:
@@ -21,57 +23,35 @@
2123
else:
2224
cflags = cflags + ["-DOS_LINUX"]
2325

24-
r = simplerule(
25-
name="glfw-windows-fallback",
26-
ins=[],
27-
outs=[
28-
"=glfw-3.4.bin.WIN32/include/GLFW/glfw3.h",
29-
"=glfw-3.4.bin.WIN32/include/GLFW/glfw3native.h",
30-
"=glfw-3.4.bin.WIN32/lib-mingw-w64/libglfw3.a",
31-
],
32-
commands=[
33-
"curl -Ls https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN32.zip -o $[dir]/glfw.zip",
34-
"cd $[dir] && unzip -DD -o -q glfw.zip",
35-
],
36-
label="CURLLIBRARY",
37-
traits={"clibrary", "cheaders"},
38-
)
39-
r.args["caller_cflags"] = [f"-I{r.dir}/glfw-3.4.bin.WIN32/include"]
40-
r.args["cheader_files"] = [r]
41-
r.args["cheader_deps"] = [r]
42-
4326

4427
def headers_from(path):
45-
hdrs = {k: f"{path}/{k}" for k in glob("**/*.h*", root_dir=path, recursive=True)}
28+
hdrs = {
29+
k: f"{path}/{k}" for k in glob("**/*.h*", root_dir=path, recursive=True)
30+
}
4631
assert hdrs, f"path {path} contained no headers"
4732
return hdrs
4833

4934

5035
def sources_from(path, except_for=[]):
51-
srcs = [join(path, f) for f in glob("**/*.[ch]*", root_dir=path, recursive=True)]
36+
srcs = [
37+
join(path, f) for f in glob("**/*.[ch]*", root_dir=path, recursive=True)
38+
]
5239
srcs = [f for f in srcs if f not in except_for]
5340
assert srcs, f"path {path} contained no sources"
5441
return srcs
5542

5643

5744
package(name="freetype2_lib", package="freetype2")
5845
package(name="libcurl_lib", package="libcurl")
59-
package(name="glfw3_lib", package="glfw3", fallback=".+glfw-windows-fallback")
46+
package(name="glfw3_lib", package="glfw3")
47+
package(name="magic_lib", package="libmagic")
6048

6149
cxxlibrary(
6250
name="nlohmannjson_lib",
6351
srcs=[],
6452
hdrs=headers_from("dep/nlohmann_json/single_include"),
6553
)
6654

67-
clibrary(
68-
name="magic_lib",
69-
srcs=sources_from(
70-
"dep/file/src", except_for=["dep/file/src/file.c", "dep/file/src/seccomp.c"]
71-
),
72-
hdrs={"magic.h": "dep/file/src/magic.h.in"},
73-
)
74-
7555
clibrary(
7656
name="md4c_lib",
7757
srcs=sources_from("dep/md4c/src"),
@@ -114,13 +94,15 @@ def sources_from(path, except_for=[]):
11494
name="plutovg",
11595
srcs=sources_from("dep/lunasvg/plutovg/source"),
11696
hdrs=headers_from("dep/lunasvg/plutovg/include"),
97+
cflags=cflags,
11798
)
11899

119100
cxxlibrary(
120101
name="lunasvg",
121102
srcs=sources_from("dep/lunasvg/source"),
122103
hdrs=headers_from("dep/lunasvg/include"),
123104
deps=[".+plutovg", "+fmt_lib"],
105+
cflags=cflags,
124106
)
125107

126108
cxxlibrary(
@@ -189,7 +171,15 @@ def sources_from(path, except_for=[]):
189171
cflags=cflags,
190172
)
191173

192-
wolv_modules = ["types", "io", "utils", "containers", "hash", "math_eval", "net"]
174+
wolv_modules = [
175+
"types",
176+
"io",
177+
"utils",
178+
"containers",
179+
"hash",
180+
"math_eval",
181+
"net",
182+
]
193183
cxxlibrary(
194184
name="libwolv",
195185
srcs=(
@@ -211,13 +201,17 @@ def sources_from(path, except_for=[]):
211201
operator.ior,
212202
[headers_from(f"dep/libwolv/libs/{d}/include") for d in wolv_modules],
213203
)
214-
| {"types/uintwide_t.h": "dep/libwolv/libs/types/include/wolv/types/uintwide_t.h"},
204+
| {
205+
"types/uintwide_t.h": "dep/libwolv/libs/types/include/wolv/types/uintwide_t.h"
206+
},
215207
deps=[".+libwolv-io-fs"],
216208
cflags=cflags,
217209
)
218210

219211
cxxlibrary(
220-
name="libthrowingptr", srcs=[], hdrs=headers_from("dep/throwing_ptr/include")
212+
name="libthrowingptr",
213+
srcs=[],
214+
hdrs=headers_from("dep/throwing_ptr/include"),
221215
)
222216

223217
cxxlibrary(
@@ -238,7 +232,9 @@ def sources_from(path, except_for=[]):
238232
],
239233
)
240234

241-
cxxlibrary(name="hacks", srcs=[], hdrs={"jthread.hpp": "./imhex_overrides/jthread.hpp"})
235+
cxxlibrary(
236+
name="hacks", srcs=[], hdrs={"jthread.hpp": "./imhex_overrides/jthread.hpp"}
237+
)
242238

243239
clibrary(
244240
name="libmicrotar",
@@ -273,7 +269,9 @@ def sources_from(path, except_for=[]):
273269
sources_from("dep/imhex/lib/libimhex/source/ui")
274270
+ sources_from(
275271
"dep/imhex/lib/libimhex/source/api",
276-
except_for=["dep/imhex/lib/libimhex/source/api/achievement_manager.cpp"],
272+
except_for=[
273+
"dep/imhex/lib/libimhex/source/api/achievement_manager.cpp"
274+
],
277275
)
278276
+ sources_from("dep/imhex/lib/libimhex/source/data_processor")
279277
+ sources_from("dep/imhex/lib/libimhex/source/providers")
@@ -426,7 +424,9 @@ def plugin(name, id, srcs, hdrs, romfsdir, deps):
426424
"dep/imhex/plugins/builtin/source/content/views/view_tutorials.cpp",
427425
"dep/imhex/plugins/builtin/source/content/data_processor_nodes.cpp",
428426
]
429-
+ glob("dep/imhex/plugins/builtin/source/content/data_processor_nodes/*")
427+
+ glob(
428+
"dep/imhex/plugins/builtin/source/content/data_processor_nodes/*"
429+
)
430430
+ glob("dep/imhex/plugins/builtin/source/content/tutorials/*"),
431431
)
432432
+ [
@@ -471,7 +471,10 @@ def plugin(name, id, srcs, hdrs, romfsdir, deps):
471471
]
472472
if config.osx
473473
else (
474-
["dep/imhex/main/gui/source/window/platform/windows.cpp"]
474+
[
475+
"dep/imhex/main/gui/source/window/platform/windows.cpp",
476+
"dep/imhex/main/gui/source/messaging/windows.cpp",
477+
]
475478
if config.windows
476479
else [
477480
"dep/imhex/main/gui/source/window/platform/linux.cpp",
@@ -541,7 +544,9 @@ def plugin(name, id, srcs, hdrs, romfsdir, deps):
541544
"./main.cc",
542545
],
543546
cflags=cflags,
544-
ldflags=["-ldl", "-lmbedcrypto"],
547+
ldflags=["-lmbedcrypto"]
548+
+ (["-ldl"] if config.unix else [])
549+
+ (["-ldwmapi", "-lnetapi32"] if config.windows else []),
545550
deps=[
546551
".+libpl",
547552
"+fmt_lib",

src/gui2/datastore.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void Datastore::writeImage(const std::fs::path& path)
565565
Datastore::runOnWorkerThread(
566566
[=]
567567
{
568-
globalConfig().setImageWriter(path);
568+
globalConfig().setImageWriter(path.string());
569569
ImageWriter::create(globalConfig())
570570
->writeImage(*Datastore::getDiskFlux()->image);
571571
});
@@ -581,7 +581,7 @@ void Datastore::writeFluxFile(const std::fs::path& path)
581581
{
582582
rebuildConfiguration();
583583
};
584-
globalConfig().setFluxSink(path);
584+
globalConfig().setFluxSink(path.string());
585585
auto fluxSource = FluxSource::createMemoryFluxSource(*diskFlux);
586586
auto fluxSink = FluxSink::create(globalConfig());
587587
writeRawDiskCommand(*fluxSource, *fluxSink);

0 commit comments

Comments
 (0)