wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
10.24k stars 691 forks source link

macOS compilation shananigans. #918

Closed mcourteaux closed 3 weeks ago

mcourteaux commented 3 weeks ago

I spent quite a while trying to compile the server. Observations:

mcourteaux commented 3 weeks ago

I'm currently sitting on this patch:

diff --git a/cmake/config.cmake b/cmake/config.cmake
index 1367f9a5..4517b5a7 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -40,9 +40,11 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT EMSCRIPTEN)
 endif()

 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT EMSCRIPTEN)
-    find_program(MOLD_LINKER mold)
-    if(MOLD_LINKER)
-        set(CMAKE_LINKER_TYPE "MOLD")
+    if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+        find_program(MOLD_LINKER mold)
+        if(MOLD_LINKER)
+            set(CMAKE_LINKER_TYPE "MOLD")
+        endif()
     endif()
     if (CMAKE_BUILD_TYPE STREQUAL "Debug")
         add_compile_options(-fno-eliminate-unused-debug-types)
@@ -51,4 +53,4 @@ endif()

 file(GENERATE OUTPUT .gitignore CONTENT "*")

-set(CMAKE_COLOR_DIAGNOSTICS ON)
\ No newline at end of file
+set(CMAKE_COLOR_DIAGNOSTICS ON)
diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake
index a2a9dedf..8d9a7464 100644
--- a/cmake/vendor.cmake
+++ b/cmake/vendor.cmake
@@ -47,6 +47,7 @@ else()
             "CAPSTONE_RISCV_SUPPORT OFF"
             "CAPSTONE_SH_SUPPORT OFF"
             "CAPSTONE_XTENSA_SUPPORT OFF"
+            "CAPSTONE_BUILD_MACOS_THIN ON"
         EXCLUDE_FROM_ALL TRUE
     )
     add_library(TracyCapstone INTERFACE)

but I'm not sure what to do if you already have capstone installed instead of doing it through CPM. I hope it doesn't import the fat-compiling settings into Tracy in that case.

wolfpld commented 3 weeks ago

Fixed by caa61de5406951 and ee06542f1f543.