Skip to content

Commit 46fab84

Browse files
committed
Progress towards making everything build on Windows.
1 parent b0290f8 commit 46fab84

File tree

8 files changed

+89
-18
lines changed

8 files changed

+89
-18
lines changed

.github/workflows/ccpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
wsl --import fedora fedora install.tar.gz
9191
wsl --set-default fedora
9292
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'
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'
9494
9595
- name: fix line endings
9696
run: |

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@
2626
[submodule "dep/lunasvg"]
2727
path = dep/lunasvg
2828
url = https://github.com/sammycage/lunasvg.git
29+
[submodule "dep/file"]
30+
path = dep/file
31+
url = https://github.com/file/file
32+
[submodule "dep/md4c"]
33+
path = dep/md4c
34+
url = https://github.com/mity/md4c
35+
[submodule "dep/nlohmann_json"]
36+
path = dep/nlohmann_json
37+
url = https://github.com/nlohmann/json
38+
[submodule "dep/cli11"]
39+
path = dep/cli11
40+
url = https://github.com/CLIUtils/CLI11

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ ifeq ($(BUILDTYPE),windows)
1313
CC = $(MINGW)gcc
1414
CXX = $(MINGW)g++
1515
CFLAGS += -g -O3 \
16-
-Wno-unknown-warning-option \
1716
-ffunction-sections \
18-
-fdata-sections
17+
-fdata-sections \
18+
-Wno-attributes
1919
CXXFLAGS += \
2020
-std=c++23 \
2121
-fext-numeric-literals \
2222
-Wno-deprecated-enum-float-conversion \
23-
-Wno-deprecated-enum-enum-conversion
23+
-Wno-deprecated-enum-enum-conversion \
24+
-U__GXX_TYPEINFO_EQUALITY_INLINE \
25+
-D__GXX_TYPEINFO_EQUALITY_INLINE
2426
LDFLAGS += -static -Wl,--gc-sections
2527
AR = $(MINGW)ar
2628
PKG_CONFIG = $(MINGW)pkg-config -static

dep/cli11

Submodule cli11 added at 89dc726

dep/file

Submodule file added at 7ed3feb

dep/md4c

Submodule md4c added at 481fbfb

dep/nlohmann_json

Submodule nlohmann_json added at 44bee1b

src/gui2/build.py

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from build.c import cxxprogram, cxxlibrary, simplerule, clibrary
2-
from build.ab import targetof, Rule, Target
2+
from build.ab import simplerule
33
from build.pkg import package
4-
from build.utils import filenamesmatchingof
54
from glob import glob
65
from functools import reduce
76
import operator
@@ -12,7 +11,7 @@
1211
'-DIMHEX_PROJECT_NAME=\\"fluxengine\\"',
1312
"-DIMHEX_STATIC_LINK_PLUGINS",
1413
'-DIMHEX_VERSION=\\"0.0.0\\"',
15-
'-DLUNASVG_BUILD_STATIC',
14+
"-DLUNASVG_BUILD_STATIC",
1615
# "-DDEBUG",
1716
]
1817
if config.osx:
@@ -22,12 +21,24 @@
2221
else:
2322
cflags = cflags + ["-DOS_LINUX"]
2423

25-
package(name="freetype2_lib", package="freetype2")
26-
package(name="libcurl_lib", package="libcurl")
27-
package(name="glfw3_lib", package="glfw3")
28-
package(name="md4c_lib", package="md4c")
29-
package(name="magic_lib", package="libmagic")
30-
package(name="nlohmannjson_lib", package="nlohmann_json")
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]
3142

3243

3344
def headers_from(path):
@@ -43,6 +54,32 @@ def sources_from(path, except_for=[]):
4354
return srcs
4455

4556

57+
package(name="freetype2_lib", package="freetype2")
58+
package(name="libcurl_lib", package="libcurl")
59+
package(name="glfw3_lib", package="glfw3", fallback=".+glfw-windows-fallback")
60+
61+
cxxlibrary(
62+
name="nlohmannjson_lib",
63+
srcs=[],
64+
hdrs=headers_from("dep/nlohmann_json/single_include"),
65+
)
66+
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+
75+
clibrary(
76+
name="md4c_lib",
77+
srcs=sources_from("dep/md4c/src"),
78+
hdrs={"md4c.h": "dep/md4c/src/md4c.h"},
79+
)
80+
81+
cxxlibrary(name="cli11_lib", srcs=[], hdrs=headers_from("dep/cli11/include"))
82+
4683
if config.osx:
4784
clibrary(
4885
name="libnfd",
@@ -83,7 +120,7 @@ def sources_from(path, except_for=[]):
83120
name="lunasvg",
84121
srcs=sources_from("dep/lunasvg/source"),
85122
hdrs=headers_from("dep/lunasvg/include"),
86-
deps=[".+plutovg"],
123+
deps=[".+plutovg", "+fmt_lib"],
87124
)
88125

89126
cxxlibrary(
@@ -111,7 +148,7 @@ def sources_from(path, except_for=[]):
111148
"imgui_freetype.h": "dep/imhex/lib/third_party/imgui/imgui/include/misc/freetype/imgui_freetype.h",
112149
"imconfig.h": "./imhex_overrides/imconfig.h",
113150
},
114-
deps=[".+freetype2_lib", ".+lunasvg"],
151+
deps=[".+freetype2_lib", ".+lunasvg", ".+glfw3_lib"],
115152
)
116153

117154
cxxlibrary(name="libxdgpp", srcs=[], hdrs={"xdg.hpp": "dep/xdgpp/xdg.hpp"})
@@ -138,7 +175,11 @@ def sources_from(path, except_for=[]):
138175
cxxlibrary(
139176
name="libwolv-io-fs",
140177
srcs=["dep/libwolv/libs/io/source/io/file_win.cpp"],
141-
hdrs=headers_from("dep/libwolv/libs/io/include"),
178+
hdrs=(
179+
headers_from("dep/libwolv/libs/io/include")
180+
| headers_from("dep/libwolv/libs/types/include")
181+
| headers_from("dep/libwolv/libs/utils/include")
182+
),
142183
cflags=cflags,
143184
)
144185
else:
@@ -154,13 +195,17 @@ def sources_from(path, except_for=[]):
154195
srcs=(
155196
[
156197
"dep/libwolv/libs/io/source/io/file.cpp",
157-
"dep/libwolv/libs/io/source/io/file_unix.cpp",
158198
"dep/libwolv/libs/io/source/io/fs.cpp",
159199
"dep/libwolv/libs/io/source/io/handle.cpp",
160200
"dep/libwolv/libs/math_eval/source/math_eval/math_evaluator.cpp",
161201
"dep/libwolv/libs/utils/source/utils/string.cpp",
162202
]
163203
+ sources_from("dep/libwolv/libs/net/source")
204+
+ (
205+
["dep/libwolv/libs/io/source/io/file_unix.cpp"]
206+
if config.osx or config.unix
207+
else []
208+
)
164209
),
165210
hdrs=reduce(
166211
operator.ior,
@@ -184,7 +229,13 @@ def sources_from(path, except_for=[]):
184229
| headers_from("dep/pattern-language/generators/include")
185230
| headers_from("dep/pattern-language/cli/include")
186231
),
187-
deps=[".+libthrowingptr", ".+libwolv"],
232+
deps=[
233+
".+libthrowingptr",
234+
".+libwolv",
235+
"+fmt_lib",
236+
".+cli11_lib",
237+
".+nlohmannjson_lib",
238+
],
188239
)
189240

190241
cxxlibrary(name="hacks", srcs=[], hdrs={"jthread.hpp": "./imhex_overrides/jthread.hpp"})
@@ -205,6 +256,8 @@ def sources_from(path, except_for=[]):
205256
hdrs=headers_from("dep/imhex/lib/libimhex/include"),
206257
cflags=cflags,
207258
)
259+
elif config.windows:
260+
cxxlibrary(name="libimhex-utils", srcs=[])
208261
elif config.unix:
209262
cxxlibrary(
210263
name="libimhex-utils",

0 commit comments

Comments
 (0)