Closed asivitz closed 2 years ago
The current version does not build for me on MacOS (m1, GHC 8.10.7). I'm using the GLFW flag, but I suspect I might get other failures even with different flags.
022-08-23 13:59:47.286836: [info] dear-imgui > [ 2 of 17] Compiling DearImGui.GLFW 2022-08-23 13:59:47.636796: [warn] dear-imgui > 2022-08-23 13:59:47.637035: [warn] dear-imgui > /private/var/folders/f6/yyydf8_149gg2pc9pm3wvgcw0000gn/T/stack-5c40579330f2d8c1/dear-imgui-2.1.0/In file included from /var/folders/f 6/yyydf8_149gg2pc9pm3wvgcw0000gn/T/ghc7845_0/ghc_16.cpp:2:0: error: 2022-08-23 13:59:47.637096: [warn] dear-imgui > 2022-08-23 13:59:47.637128: [warn] dear-imgui > 2022-08-23 13:59:47.637319: [warn] dear-imgui > /private/var/folders/f6/yyydf8_149gg2pc9pm3wvgcw0000gn/T/stack-5c40579330f2d8c1/dear-imgui-2.1.0/imgui/imgui.h:252:5: error: 2022-08-23 13:59:47.637363: [warn] dear-imgui > error: unknown type name 'constexpr' 2022-08-23 13:59:47.637384: [warn] dear-imgui > constexpr ImVec2() : x(0.0f), y(0.0f) { } 2022-08-23 13:59:47.637402: [warn] dear-imgui > ^ 2022-08-23 13:59:47.637417: [warn] dear-imgui > | 2022-08-23 13:59:47.637433: [warn] dear-imgui > 252 | constexpr ImVec2() : x(0.0f), y(0.0f) { } 2022-08-23 13:59:47.637450: [warn] dear-imgui > | ^ 2022-08-23 13:59:47.637496: [warn] dear-imgui >
As far as I understand, DearImGui.GLFW has this inline-c call:
C.include "imgui.h" -- I think it's from this line? Not sure.
and we should be using a c++ compiler with -std=c++11. But we're not (only on MacOS I assume).
-std=c++11
The cabal library has
cxx-options: -std=c++11
but that doesn't seem to be enough.
I am actually able to fix the issue by adding
ghc-options: -optcxx-std=c++11 -optcxx-Wall
as I did in this commit: https://github.com/haskell-game/dear-imgui.hs/commit/e6c40ff93da1bf748aa08af47f5bcb1b8601cb76
I got this idea from https://github.com/fpco/inline-c/blob/master/inline-c-cpp/inline-c-cpp.cabal#L46
But I'm not sure exactly what the fix should look like for this package.
Would be happy to make this a PR if it seems like a reasonable solution. (Side note: do we support GHC < 8.10?)
Please do. The only missing thing is a os flag:
if os(darwin) ghc-options: -optcxx-std=c++11 -optcxx-Wall
The current version does not build for me on MacOS (m1, GHC 8.10.7). I'm using the GLFW flag, but I suspect I might get other failures even with different flags.
As far as I understand, DearImGui.GLFW has this inline-c call:
and we should be using a c++ compiler with
-std=c++11
. But we're not (only on MacOS I assume).The cabal library has
but that doesn't seem to be enough.
I am actually able to fix the issue by adding
as I did in this commit: https://github.com/haskell-game/dear-imgui.hs/commit/e6c40ff93da1bf748aa08af47f5bcb1b8601cb76
I got this idea from https://github.com/fpco/inline-c/blob/master/inline-c-cpp/inline-c-cpp.cabal#L46
But I'm not sure exactly what the fix should look like for this package.
Would be happy to make this a PR if it seems like a reasonable solution. (Side note: do we support GHC < 8.10?)