diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35bb01eae..201e563db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: echo CABAL_FLAGS=--enable-tests --test-show-details=direct --flags=nofib >> $GITHUB_ENV else if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then - sudo apt-get -y install pkg-config libcapstone-dev libfreetype-dev libglfw3-dev libgtk-3-dev libtbb-dev + sudo apt-get -y install cmake pkg-config libfreetype-dev libglfw3-dev libgtk-3-dev libtbb-dev elif [ ${{ matrix.os }} == 'macOS-latest' ]; then - brew install pkg-config capstone freetype glfw + brew install cmake pkg-config freetype glfw fi echo CABAL_FLAGS=--enable-tests --test-show-details=direct --flags=nofib --flags=debug --ghc-options=\"-optc=-DTRACY_TIMER_FALLBACK\" --ghc-options=\"-optcxx=-DTRACY_TIMER_FALLBACK\" >> $GITHUB_ENV fi diff --git a/.gitmodules b/.gitmodules index 56d68671a..0961c0de5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -# This is on a fork only for the following commit: -# https://github.com/wolfpld/tracy/commit/1a971d867d6fa5bf6dc57d705dcbbc6020031e7a -# which fixes a dumb compile error. -# When tracy publishes something > v0.10, please upgrade to that instead. [submodule "cbits/tracy"] path = cbits/tracy - url = https://github.com/tomsmeding/tracy.git + url = https://github.com/wolfpld/tracy.git diff --git a/Setup.hs b/Setup.hs index f0f06bfb3..5c995a959 100755 --- a/Setup.hs +++ b/Setup.hs @@ -43,7 +43,7 @@ preConfHook args config_flags = do then rawSystemExit verbosity "git" ["submodule", "update", "--init", "--recursive"] else do -- XXX: This must be kept up to date with the git submodule revision - let archive = "v0.9.1.tar.gz" + let archive = "v0.11.1.tar.gz" createDirectoryIfMissing True "cbits/tracy" rawSystemExit verbosity "curl" ["-LO", "https://github.com/wolfpld/tracy/archive/refs/tags/" ++ archive] rawSystemExit verbosity "tar" ["-xzf", archive, "-C", "cbits/tracy", "--strip-components", "1"] @@ -59,61 +59,32 @@ postBuildHook args build_flags pkg_desc lbi = do Platform _ os = hostPlatform lbi verbosity = fromFlagOrDefault normal $ buildVerbosity build_flags debugging = fromMaybe False $ lookupFlagAssignment (mkFlagName "debug") (configConfigurationsFlags config_flags) - targets = [ ("tracy-capture", "capture", "capture-release") - , ("tracy", "profiler", "Tracy-release") ] + targets = [ ("tracy-capture", "capture", "tracy-capture") + , ("tracy", "profiler", "tracy-profiler") ] when debugging $ do case os of Windows -> return () -- XXX TODO: Windows users get the dummy executable that just throws an error _ -> forM_ targets $ \(hs_exe, c_dir, c_exe) -> do - let c_builddir = "cbits/tracy" c_dir "build/unix" + let c_projdir = "cbits/tracy" c_dir hs_builddir = buildDir lbi hs_exe - c_tmpdir = c_builddir "obj" hs_tmpdir = hs_builddir hs_exe ++ "-tmp" - setupMessage verbosity (printf "Building executable '%s' for" hs_exe) (package pkg_desc) + setupMessage verbosity (printf "Building executable '%s' from Tracy C++ sources for" hs_exe) (package pkg_desc) - -- Symlink the C build directory into the HS build directories. - -- We need to take care here: the symlink might already exist but point - -- to a nonexistent path, in which case doesDirectoryExist returns False - -- but it is still a symlink. - whenM (pathIsSymbolicLinkSafe c_tmpdir) $ removeFile c_tmpdir - objExists <- doesPathExist c_tmpdir - objExistsDir <- doesDirectoryExist c_tmpdir - createdObjSymlink <- - if | objExists && not objExistsDir -> - dieNoVerbosity $ c_tmpdir ++ " is a file; remove this to continue compiling accelerate." - | objExistsDir -> - return False - | otherwise -> do - -- Make the symlink (relative from c_builddir, hence the 5x ..) - createDirectoryLink ("../../../../.." hs_tmpdir) c_tmpdir - -- Create that temp directory if necessary. This is required if the accelerate - -- package is built as a dependency from another cabal project, because then only - -- the library is built, and not the executables such as tracy-capture. - createDirectoryIfMissing True hs_tmpdir - return True + -- TODO: This creates a separate build directory for each tracy + -- executable (of which we build two, at the time of writing). This + -- means that some duplicate work is done (building capstone twice). + -- Could we share a build directory between the two? - -- prevent having to re-link every time we build the library - executable <- doesFileExist (hs_builddir hs_exe) - when executable $ renameFile (hs_builddir hs_exe) (c_builddir c_exe) + rawSystemExit verbosity "cmake" ["-B", hs_tmpdir, "-S", c_projdir, "-DCMAKE_BUILD_TYPE=Release"] - -- build - rawSystemExit verbosity "make" ["-C", c_builddir] + -- Build in parallel with 2 jobs because likely, accelerate is one of + -- the last dependencies in a build, so we aren't stealing CPU time + -- from other packages, and tracy takes way too long to build + rawSystemExit verbosity "cmake" ["--build", hs_tmpdir, "--config", "Release", "-j", "2"] - -- move executable to the final destination - renameFile (c_builddir c_exe) (hs_builddir hs_exe) - - -- clean up after ourselves - when createdObjSymlink $ removeDirectoryLink c_tmpdir + renameFile (hs_tmpdir c_exe) (hs_builddir hs_exe) postBuild simpleUserHooks args build_flags pkg_desc lbi - --- | Returns True if there is a symbolic link at the given path, False otherwise. -pathIsSymbolicLinkSafe :: FilePath -> IO Bool -pathIsSymbolicLinkSafe fp = - handleDoesNotExist False $ pathIsSymbolicLink fp - -whenM :: IO Bool -> IO () -> IO () -whenM mcond action = mcond >>= \cond -> when cond action diff --git a/accelerate.cabal b/accelerate.cabal index 6a3c5e403..7b0099ed9 100644 --- a/accelerate.cabal +++ b/accelerate.cabal @@ -154,19 +154,14 @@ extra-source-files: cbits/tracy/public/client/*.hpp cbits/tracy/public/client/*.cpp -- These are used to build Tracy's client tools in Setup.hs - cbits/tracy/capture/build/unix/Makefile - cbits/tracy/capture/build/unix/*.mk - cbits/tracy/profiler/build/unix/Makefile - cbits/tracy/profiler/build/unix/*.mk - cbits/tracy/common/*.mk - -- The Makefiles fetch the source files from these Visual Studio project files - cbits/tracy/capture/build/win32/capture.vcxproj - cbits/tracy/capture/build/win32/capture.vcxproj.filters - cbits/tracy/profiler/build/win32/Tracy.vcxproj - cbits/tracy/profiler/build/win32/Tracy.vcxproj.filters + cbits/tracy/cmake/*.cmake + cbits/tracy/capture/CMakeLists.txt + cbits/tracy/profiler/CMakeLists.txt -- Used by the Tracy's client tools cbits/tracy/capture/src/*.cpp cbits/tracy/dtl/*.hpp + cbits/tracy/getopt/*.c + cbits/tracy/getopt/*.h cbits/tracy/imgui/*.cpp cbits/tracy/imgui/*.h cbits/tracy/imgui/misc/freetype/*.cpp @@ -181,8 +176,9 @@ extra-source-files: cbits/tracy/profiler/src/font/*.hpp cbits/tracy/profiler/src/imgui/*.cpp cbits/tracy/profiler/src/imgui/*.h - cbits/tracy/profiler/src/wayland/*.c - cbits/tracy/profiler/src/wayland/*.h + cbits/tracy/profiler/src/profiler/*.cpp + cbits/tracy/profiler/src/profiler/*.h + cbits/tracy/profiler/src/profiler/*.hpp cbits/tracy/public/libbacktrace/*.cpp cbits/tracy/public/libbacktrace/*.h cbits/tracy/public/libbacktrace/*.hpp @@ -194,7 +190,6 @@ extra-source-files: cbits/tracy/zstd/common/*.h cbits/tracy/zstd/compress/*.c cbits/tracy/zstd/compress/*.h - cbits/tracy/zstd/decompress/*.S cbits/tracy/zstd/decompress/*.c cbits/tracy/zstd/decompress/*.h cbits/tracy/zstd/dictBuilder/*.c @@ -221,9 +216,9 @@ flag debug built to collect and view profiling data from supported backends. This requires several external dependencies: . - * pkg-config + * camke . - * capstone + * pkg-config . * freetype2 . @@ -235,11 +230,11 @@ flag debug . For example on Debian/Ubuntu you can install all of these via: . - > sudo apt install pkg-config libcapstone-dev libfreetype-dev libglfw3-dev libgtk-3-dev libtbb-dev + > sudo apt install cmake pkg-config libfreetype-dev libglfw3-dev libgtk-3-dev libtbb-dev . Or on macOS via: . - > brew install pkg-config capstone freetype glfw + > brew install cmake pkg-config freetype glfw . With debugging enabled, applications will read the following options from the environment variable @ACCELERATE_FLAGS@, and via the command-line as: diff --git a/cbits/tracy b/cbits/tracy index 821ef62c1..5d542dc09 160000 --- a/cbits/tracy +++ b/cbits/tracy @@ -1 +1 @@ -Subproject commit 821ef62c1db9a11231bf216a30b1ebfaedfe2244 +Subproject commit 5d542dc09f3d9378d005092a4ad446bd405f819a