diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 4cee79f3..6ba9ed2d 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -90,7 +90,7 @@ jobs: wsl --import fedora fedora install.tar.gz wsl --set-default fedora wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm' - 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' + 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' - name: fix line endings run: | diff --git a/.gitmodules b/.gitmodules index 498cb5fd..a6314255 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,15 @@ [submodule "dep/lunasvg"] path = dep/lunasvg url = https://github.com/sammycage/lunasvg.git +[submodule "dep/file"] + path = dep/file + url = https://github.com/file/file +[submodule "dep/md4c"] + path = dep/md4c + url = https://github.com/mity/md4c +[submodule "dep/nlohmann_json"] + path = dep/nlohmann_json + url = https://github.com/nlohmann/json +[submodule "dep/cli11"] + path = dep/cli11 + url = https://github.com/CLIUtils/CLI11 diff --git a/Makefile b/Makefile index e06e3bf6..16e9c8ed 100644 --- a/Makefile +++ b/Makefile @@ -13,14 +13,16 @@ ifeq ($(BUILDTYPE),windows) CC = $(MINGW)gcc CXX = $(MINGW)g++ CFLAGS += -g -O3 \ - -Wno-unknown-warning-option \ -ffunction-sections \ - -fdata-sections + -fdata-sections \ + -Wno-attributes CXXFLAGS += \ -std=c++23 \ -fext-numeric-literals \ -Wno-deprecated-enum-float-conversion \ - -Wno-deprecated-enum-enum-conversion + -Wno-deprecated-enum-enum-conversion \ + -U__GXX_TYPEINFO_EQUALITY_INLINE \ + -D__GXX_TYPEINFO_EQUALITY_INLINE LDFLAGS += -static -Wl,--gc-sections AR = $(MINGW)ar PKG_CONFIG = $(MINGW)pkg-config -static diff --git a/dep/cli11 b/dep/cli11 new file mode 160000 index 00000000..89dc7269 --- /dev/null +++ b/dep/cli11 @@ -0,0 +1 @@ +Subproject commit 89dc726939fda6d26f4229093575e16ccb350a3c diff --git a/dep/file b/dep/file new file mode 160000 index 00000000..7ed3febf --- /dev/null +++ b/dep/file @@ -0,0 +1 @@ +Subproject commit 7ed3febfcd616804a2ec6495b3e5f9ccb6fc5f8f diff --git a/dep/md4c b/dep/md4c new file mode 160000 index 00000000..481fbfbd --- /dev/null +++ b/dep/md4c @@ -0,0 +1 @@ +Subproject commit 481fbfbdf72daab2912380d62bb5f2187d438408 diff --git a/dep/nlohmann_json b/dep/nlohmann_json new file mode 160000 index 00000000..44bee1b1 --- /dev/null +++ b/dep/nlohmann_json @@ -0,0 +1 @@ +Subproject commit 44bee1b1389f35114c840320cd7633668db6fcd9 diff --git a/src/gui2/build.py b/src/gui2/build.py index 938e5c67..395d6d84 100644 --- a/src/gui2/build.py +++ b/src/gui2/build.py @@ -1,7 +1,6 @@ from build.c import cxxprogram, cxxlibrary, simplerule, clibrary -from build.ab import targetof, Rule, Target +from build.ab import simplerule from build.pkg import package -from build.utils import filenamesmatchingof from glob import glob from functools import reduce import operator @@ -12,7 +11,7 @@ cflags = [ '-DIMHEX_PROJECT_NAME=\\"fluxengine\\"', "-DIMHEX_STATIC_LINK_PLUGINS", '-DIMHEX_VERSION=\\"0.0.0\\"', - '-DLUNASVG_BUILD_STATIC', + "-DLUNASVG_BUILD_STATIC", # "-DDEBUG", ] if config.osx: @@ -22,12 +21,24 @@ elif config.windows: else: cflags = cflags + ["-DOS_LINUX"] -package(name="freetype2_lib", package="freetype2") -package(name="libcurl_lib", package="libcurl") -package(name="glfw3_lib", package="glfw3") -package(name="md4c_lib", package="md4c") -package(name="magic_lib", package="libmagic") -package(name="nlohmannjson_lib", package="nlohmann_json") +r = simplerule( + name="glfw-windows-fallback", + ins=[], + outs=[ + "=glfw-3.4.bin.WIN32/include/GLFW/glfw3.h", + "=glfw-3.4.bin.WIN32/include/GLFW/glfw3native.h", + "=glfw-3.4.bin.WIN32/lib-mingw-w64/libglfw3.a", + ], + commands=[ + "curl -Ls https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN32.zip -o $[dir]/glfw.zip", + "cd $[dir] && unzip -DD -o -q glfw.zip", + ], + label="CURLLIBRARY", + traits={"clibrary", "cheaders"}, +) +r.args["caller_cflags"] = [f"-I{r.dir}/glfw-3.4.bin.WIN32/include"] +r.args["cheader_files"] = [r] +r.args["cheader_deps"] = [r] def headers_from(path): @@ -43,6 +54,32 @@ def sources_from(path, except_for=[]): return srcs +package(name="freetype2_lib", package="freetype2") +package(name="libcurl_lib", package="libcurl") +package(name="glfw3_lib", package="glfw3", fallback=".+glfw-windows-fallback") + +cxxlibrary( + name="nlohmannjson_lib", + srcs=[], + hdrs=headers_from("dep/nlohmann_json/single_include"), +) + +clibrary( + name="magic_lib", + srcs=sources_from( + "dep/file/src", except_for=["dep/file/src/file.c", "dep/file/src/seccomp.c"] + ), + hdrs={"magic.h": "dep/file/src/magic.h.in"}, +) + +clibrary( + name="md4c_lib", + srcs=sources_from("dep/md4c/src"), + hdrs={"md4c.h": "dep/md4c/src/md4c.h"}, +) + +cxxlibrary(name="cli11_lib", srcs=[], hdrs=headers_from("dep/cli11/include")) + if config.osx: clibrary( name="libnfd", @@ -83,7 +120,7 @@ cxxlibrary( name="lunasvg", srcs=sources_from("dep/lunasvg/source"), hdrs=headers_from("dep/lunasvg/include"), - deps=[".+plutovg"], + deps=[".+plutovg", "+fmt_lib"], ) cxxlibrary( @@ -111,7 +148,7 @@ cxxlibrary( "imgui_freetype.h": "dep/imhex/lib/third_party/imgui/imgui/include/misc/freetype/imgui_freetype.h", "imconfig.h": "./imhex_overrides/imconfig.h", }, - deps=[".+freetype2_lib", ".+lunasvg"], + deps=[".+freetype2_lib", ".+lunasvg", ".+glfw3_lib"], ) cxxlibrary(name="libxdgpp", srcs=[], hdrs={"xdg.hpp": "dep/xdgpp/xdg.hpp"}) @@ -138,7 +175,11 @@ elif config.windows: cxxlibrary( name="libwolv-io-fs", srcs=["dep/libwolv/libs/io/source/io/file_win.cpp"], - hdrs=headers_from("dep/libwolv/libs/io/include"), + hdrs=( + headers_from("dep/libwolv/libs/io/include") + | headers_from("dep/libwolv/libs/types/include") + | headers_from("dep/libwolv/libs/utils/include") + ), cflags=cflags, ) else: @@ -154,13 +195,17 @@ cxxlibrary( srcs=( [ "dep/libwolv/libs/io/source/io/file.cpp", - "dep/libwolv/libs/io/source/io/file_unix.cpp", "dep/libwolv/libs/io/source/io/fs.cpp", "dep/libwolv/libs/io/source/io/handle.cpp", "dep/libwolv/libs/math_eval/source/math_eval/math_evaluator.cpp", "dep/libwolv/libs/utils/source/utils/string.cpp", ] + sources_from("dep/libwolv/libs/net/source") + + ( + ["dep/libwolv/libs/io/source/io/file_unix.cpp"] + if config.osx or config.unix + else [] + ) ), hdrs=reduce( operator.ior, @@ -184,7 +229,13 @@ cxxlibrary( | headers_from("dep/pattern-language/generators/include") | headers_from("dep/pattern-language/cli/include") ), - deps=[".+libthrowingptr", ".+libwolv"], + deps=[ + ".+libthrowingptr", + ".+libwolv", + "+fmt_lib", + ".+cli11_lib", + ".+nlohmannjson_lib", + ], ) cxxlibrary(name="hacks", srcs=[], hdrs={"jthread.hpp": "./imhex_overrides/jthread.hpp"}) @@ -205,6 +256,8 @@ if config.osx: hdrs=headers_from("dep/imhex/lib/libimhex/include"), cflags=cflags, ) +elif config.windows: + cxxlibrary(name="libimhex-utils", srcs=[]) elif config.unix: cxxlibrary( name="libimhex-utils",