From 7828ddb11127548a5e7785d093a3a3bed15b0d95 Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Thu, 21 Jul 2022 23:23:46 +0200 Subject: [PATCH] refactor sharedLib --- Setup.hs | 14 --------- dear-imgui.cabal | 78 ++++++++++++++++++++++-------------------------- imgui | 2 +- 3 files changed, 37 insertions(+), 57 deletions(-) delete mode 100644 Setup.hs diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 312e7e1..0000000 --- a/Setup.hs +++ /dev/null @@ -1,14 +0,0 @@ -import Distribution.Simple - -main :: IO () -main = defaultMainWithHooks simpleUserHooks - { postCopy = copyLib - } - -copyLib :: :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO () -copyExtLib _ flags pkg_descr lbi = do - let libPref = libdir . absoluteInstallDirs pkg_descr lbi - . fromFlag . copyDest - $ flags - let verbosity = fromFlag $ copyVerbosity flags - rawSystemExit verbosity "cp" ["libHSdear-imgui-2.0.0-inplace-ghc8.10.7.so", libPref] diff --git a/dear-imgui.cabal b/dear-imgui.cabal index 1fee808..980f251 100644 --- a/dear-imgui.cabal +++ b/dear-imgui.cabal @@ -13,11 +13,10 @@ description: Set package flags according to your needs. build-type: Simple -extra-source-files: - README.md, - ChangeLog.md extra-source-files: + README.md, + ChangeLog.md, imgui/*.h, imgui/backends/*.h, imgui/backends/*.mm, @@ -157,6 +156,7 @@ library import: common hs-source-dirs: src + generator exposed-modules: DearImGui DearImGui.FontAtlas @@ -172,6 +172,13 @@ library other-modules: DearImGui.Enums DearImGui.Structs + DearImGui.Generator + DearImGui.Generator.Parser + DearImGui.Generator.Tokeniser + DearImGui.Generator.Types + ghc-options: + -static -dynamic-too + -- create both libHSdear-imgui... .a and .so cxx-options: -std=c++11 cxx-sources: imgui/imgui.cpp @@ -189,20 +196,41 @@ library build-depends: system-cxx-std-lib else extra-libraries: stdc++ - extra-bundled-libraries: - HSdear-imgui-2.0.0-inplace include-dirs: imgui build-depends: - dear-imgui-generator - , containers + containers , managed , inline-c , inline-c-cpp , StateVar , unliftio , vector + -- for the generator: + , template-haskell + >= 2.15 && < 2.19 + , containers + ^>= 0.6.2.1 + , directory + >= 1.3 && < 1.4 + , filepath + >= 1.4 && < 1.5 + , inline-c + >= 0.9.0.0 && < 0.10 + , megaparsec + >= 9.0 && < 9.3 + , parser-combinators + >= 1.2.0 && < 1.4 + , scientific + >= 0.3.6.2 && < 0.3.8 , text + >= 1.2.4 && < 2.1 + , th-lift + >= 0.7 && < 0.9 + , transformers + >= 0.5.6 && < 0.6 + , unordered-containers + >= 0.2.11 && < 0.3 if os(darwin) ghc-options: @@ -306,40 +334,6 @@ library exposed-modules: DearImGui.GLFW.Vulkan -library dear-imgui-generator - import: common - hs-source-dirs: generator - exposed-modules: - DearImGui.Generator - , DearImGui.Generator.Parser - , DearImGui.Generator.Tokeniser - , DearImGui.Generator.Types - build-depends: - template-haskell - >= 2.15 && < 2.21 - , containers - ^>= 0.6.2.1 - , directory - >= 1.3 && < 1.4 - , filepath - >= 1.4 && < 1.5 - , inline-c - >= 0.9.0.0 && < 0.10 - , megaparsec - >= 9.0 && < 9.4 - , parser-combinators - >= 1.2.0 && < 1.4 - , scientific - >= 0.3.6.2 && < 0.3.8 - , text - >= 1.2.4 && < 2.1 - , th-lift - >= 0.7 && < 0.9 - , transformers - >= 0.5.6 && < 0.7 - , unordered-containers - >= 0.2.11 && < 0.3 - executable test import: common, exe-flags main-is: Main.hs @@ -354,7 +348,7 @@ executable glfw main-is: Main.hs hs-source-dirs: examples/glfw default-language: Haskell2010 - if (!flag(examples) || !flag(glfw) || !flag(opengl2)) + if (!flag(examples) || !flag(glfw) || !(flag(opengl3) || flag(opengl2))) buildable: False else build-depends: base, GLFW-b, gl, dear-imgui, managed, text diff --git a/imgui b/imgui index c6e0284..736b1a4 160000 --- a/imgui +++ b/imgui @@ -1 +1 @@ -Subproject commit c6e0284ac58b3f205c95365478888f7b53b077e2 +Subproject commit 736b1a4b1b8563fc1dd5e1415411f8c8266e9ed6