From 67b4494b83bc8e96e4651ed04140024d6bc5c4e9 Mon Sep 17 00:00:00 2001 From: Panos Stergiotis
Date: Sun, 2 Jun 2024 13:13:03 -0700 Subject: [PATCH] fix: glfw build using cmake --- imgui_glfw/Makefile | 1 - imgui_glfw/build_ab_initio.sh | 11 +++++++++ imgui_glfw/build_cpp.sh | 13 +++++++--- imgui_glfw/build_flatbuffers.sh | 6 +++++ imgui_glfw/cmakelists.dhall | 15 ++++++++++++ imgui_glfw/common.dhall | 33 ++++++++++++++++++++++---- imgui_glfw/make.dhall | 25 ------------------- scripts/install_3rd_party_git_repos.sh | 1 + 8 files changed, 72 insertions(+), 33 deletions(-) delete mode 100644 imgui_glfw/Makefile create mode 100644 imgui_glfw/build_ab_initio.sh create mode 100644 imgui_glfw/build_flatbuffers.sh create mode 100644 imgui_glfw/cmakelists.dhall delete mode 100755 imgui_glfw/make.dhall diff --git a/imgui_glfw/Makefile b/imgui_glfw/Makefile deleted file mode 100644 index 1d30d8f..0000000 --- a/imgui_glfw/Makefile +++ /dev/null @@ -1 +0,0 @@ -include Makefile.out diff --git a/imgui_glfw/build_ab_initio.sh b/imgui_glfw/build_ab_initio.sh new file mode 100644 index 0000000..cdc3643 --- /dev/null +++ b/imgui_glfw/build_ab_initio.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -ev +here=$(dirname "$(readlink -f "$BASH_SOURCE")") +cd "$here" + +source /etc/os-release + +#../scripts/install.sh +#../scripts/install_nonportable.sh +./build_flatbuffers.sh +./build.sh diff --git a/imgui_glfw/build_cpp.sh b/imgui_glfw/build_cpp.sh index 02d31e6..a13d060 100755 --- a/imgui_glfw/build_cpp.sh +++ b/imgui_glfw/build_cpp.sh @@ -2,6 +2,13 @@ set -ev here=$(dirname "$(readlink -f "$BASH_SOURCE")") cd "$here" -./make.dhall -make clean -make -j +flatc="../../contrib/flatbuffers/flatc" +"$flatc" -o imgui --cpp imgui/vectorCmd.fbs + +./cmakelists.dhall + +mkdir -p build +cd build +cmake ../CMakeLists.txt +cmake --build . -j +mv *_exe .. diff --git a/imgui_glfw/build_flatbuffers.sh b/imgui_glfw/build_flatbuffers.sh new file mode 100644 index 0000000..7623a9e --- /dev/null +++ b/imgui_glfw/build_flatbuffers.sh @@ -0,0 +1,6 @@ +#!/bin/bash +here=$(dirname "$(readlink -f "$BASH_SOURCE")") +set -ev +cd ../../contrib/flatbuffers +cmake -G "Unix Makefiles" +make -j diff --git a/imgui_glfw/cmakelists.dhall b/imgui_glfw/cmakelists.dhall new file mode 100644 index 0000000..6c3dda8 --- /dev/null +++ b/imgui_glfw/cmakelists.dhall @@ -0,0 +1,15 @@ +#!/usr/bin/env -S dhall text --output CMakeLists.txt --file +let prelude = ../dhall/prelude.dhall +let lib = ../dhall/lib.dhall +let cmake = ../dhall/cmakelists.dhall +let sourceTreePartsRepo = ../dhall/sourceTreeParts.dhall +let common = ./common.dhall +in +cmake.cmakelistsToText cmake.cmakelists::{ + , cxx = common.cxx + , exe = "imgui_exe" + , projectName = "imgui_exe" + , cxxflags = ["-std=c++${Natural/show common.cppstd}" ] # common.cxxflags # common.stdlibFlags + , ldflags = common.ldflags # common.stdlibFlags + , sourceTreeParts = common.sourceTreeParts +} diff --git a/imgui_glfw/common.dhall b/imgui_glfw/common.dhall index d4f1954..af8841f 100644 --- a/imgui_glfw/common.dhall +++ b/imgui_glfw/common.dhall @@ -23,9 +23,34 @@ let sourceTreeParts = [ , mainPart ] let cxx = "clang++" -let cppstd = "c++20" +let cppstd = 20 +let cxxflagsDebug = [ + , "-g" + , "-gdwarf-4" + , "-Wall" + , "-Wformat" + , "-Wextra" + , "-O1" + , "-fsanitize=address" + , "-fno-omit-frame-pointer" + , "-DIMZERO_DEBUG_BUILD" + --, "-fno-optimize-sibling-calls" -- no tail calls for better stacktraces +] +let cxxflagsRelease = [ + , "-O3" +] +let ldflagsDebug = ["-fsanitize=address"] : List Text +let ldflagsRelease = ["-DNDEBUG"] : List Text +--let stdlibFlags = ["-stdlib=libc++"] : List Text +let stdlibFlags = [] : List Text +let debug = False in { - , sourceTreeParts - , cxx - , cppstd + , sourceTreeParts + , cxx + , cppstd + , cxxflags = if debug then cxxflagsDebug else cxxflagsRelease + , ldflags = if debug then ldflagsDebug else ldflagsRelease + , stdlibFlags + , debug } + diff --git a/imgui_glfw/make.dhall b/imgui_glfw/make.dhall deleted file mode 100755 index 7789b00..0000000 --- a/imgui_glfw/make.dhall +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env -S dhall text --output Makefile.out --file -let prelude = ../dhall/prelude.dhall -let lib = ../dhall/lib.dhall -let make = ../dhall/makefile.dhall -let common = ./common.dhall -let cxxflagsDebug = [ - , "-g" - , "-gdwarf-4" - , "-Wall" - , "-Wformat" - , "-Wextra" -] -let cxxflagsRelease = [ - , "-O3" -] -let ldflags = [] : List Text -let stdlibFlags = ["-stdlib=libc++"] : List Text - -in make.makefileToText make.makefile::{ - , cxx = common.cxx - , exe = "imgui_exe" - , cxxflags = [, "-std=" ++ common.cppstd , "\${CXXFLAGS}" ] # cxxflagsDebug # stdlibFlags - , ldflags = ldflags # stdlibFlags - , sourceTreeParts = common.sourceTreeParts -} diff --git a/scripts/install_3rd_party_git_repos.sh b/scripts/install_3rd_party_git_repos.sh index 115efca..005551b 100755 --- a/scripts/install_3rd_party_git_repos.sh +++ b/scripts/install_3rd_party_git_repos.sh @@ -50,4 +50,5 @@ getContribRepo "https://github.com/stergiotis/imgui_toggle.git" "imgui_toggle" " getContribRepo "https://github.com/dhall-lang/dhall-lang" "dhall-lang" "master" "v22.0.0" getContribRepo "https://github.com/google/flatbuffers.git" "flatbuffers" "master" "129ef422e8a4e89d87a7216a865602673a6d0bf3" getContribRepo "https://github.com/google/skia" "skia" "chrome/m123" "" +getContribRepo "https://github.com/wolfpld/tracy" "tracy" "master" "0d5bd53be393b590da9c7b29079d919d488412c1" getMyRepo "https://github.com/stergiotis/boxer.git" "boxer" "main" ""