Browse Source

CMake: Build PStats port for macOS

rdb 2 years ago
parent
commit
10110cbfff

+ 1 - 0
pandatool/CMakeLists.txt

@@ -28,6 +28,7 @@ add_subdirectory(src/imageprogs)
 add_subdirectory(src/lwo)
 add_subdirectory(src/lwoegg)
 add_subdirectory(src/lwoprogs)
+add_subdirectory(src/mac-stats)
 add_subdirectory(src/miscprogs)
 add_subdirectory(src/objegg)
 add_subdirectory(src/objprogs)

+ 1 - 1
pandatool/src/gtk-stats/CMakeLists.txt

@@ -34,7 +34,7 @@ target_link_libraries(gtk-stats p3progbase p3pstatserver PKG::GTK3)
 
 # This program is NOT actually called gtk-stats. It's pstats-gtk on Win32 and
 # pstats everywhere else (as the Win32 GUI is not built).
-if(WIN32)
+if(WIN32 OR APPLE)
   set_target_properties(gtk-stats PROPERTIES OUTPUT_NAME "pstats-gtk")
 else()
   set_target_properties(gtk-stats PROPERTIES OUTPUT_NAME "pstats")

+ 53 - 0
pandatool/src/mac-stats/CMakeLists.txt

@@ -0,0 +1,53 @@
+if(NOT APPLE OR NOT HAVE_NET)
+  return()
+endif()
+
+set(MACSTATS_HEADERS
+  macStats.h
+  macStatsAppDelegate.h
+  macStatsChartMenu.h
+  macStatsChartMenuDelegate.h
+  macStatsFlameGraph.h
+  macStatsGraph.h
+  macStatsGraphView.h
+  macStatsGraphViewController.h
+  macStatsLabel.h
+  macStatsLabelStack.h
+  macStatsMonitor.h
+  macStatsPianoRoll.h
+  macStatsScaleArea.h
+  macStatsServer.h
+  macStatsStripChart.h
+  macStatsTimeline.h
+)
+
+set(MACSTATS_SOURCES
+  macStats.mm
+  macStatsAppDelegate.mm
+  macStatsChartMenu.mm
+  macStatsChartMenuDelegate.mm
+  macStatsFlameGraph.mm
+  macStatsGraph.mm
+  macStatsGraphView.mm
+  macStatsGraphViewController.mm
+  macStatsLabel.mm
+  macStatsLabelStack.mm
+  macStatsMonitor.mm
+  macStatsPianoRoll.mm
+  macStatsScaleArea.mm
+  macStatsServer.mm
+  macStatsStripChart.mm
+  macStatsTimeline.mm
+)
+
+composite_sources(mac-stats MACSTATS_SOURCES)
+add_executable(mac-stats ${MACSTATS_HEADERS} ${MACSTATS_SOURCES})
+target_link_libraries(mac-stats p3progbase p3pstatserver)
+target_link_libraries(mac-stats "-framework Cocoa")
+target_link_libraries(mac-stats "-framework Carbon")
+target_link_libraries(mac-stats "-framework Quartz")
+
+# This program is NOT actually called win-stats. It's just pstats
+set_target_properties(mac-stats PROPERTIES OUTPUT_NAME "pstats")
+
+install(TARGETS mac-stats EXPORT Tools COMPONENT Tools DESTINATION ${CMAKE_INSTALL_BINDIR})