diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e1d847..bfc6388 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,14 @@ jobs: os: macos-latest - name: Windows os: windows-latest + - name: Linux + os: ubuntu-latest steps: + - name: Install JUCE's Linux Deps + if: runner.os == 'Linux' + run: | + sudo apt-get update && sudo apt install libasound2-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev xvfb ninja-build - name: Checkout code uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3 diff --git a/README.md b/README.md index 1dfe35c..898bf72 100644 --- a/README.md +++ b/README.md @@ -257,7 +257,21 @@ Start your app and perform the actions you want traced. When you quit your app, a trace file will be dumped -**(Note: don't just terminate it via your IDE, the file will be only dumped on a graceful quit)**. +**(Note: don't just terminate it via your IDE, the file will *only* be written on a graceful quit)**. + +The files will be dumped to the following locations: + +* macOS: Your user's downloads folder +* Windows: Your desktop (sorry not sorry) +* Linux: Your user's documents folder + +The exact file and location will be logged to `cout` (via JUCE's `DBG`) and will look like so: + +``` +Wrote perfetto trace to: /Users/sudara/Downloads/perfetto-DEBUG-2023-09-10_1937.pftrace +``` + +(I'll happily accept a PR to make this configurable.) ### Step 5: Drag the trace into Perfetto @@ -324,7 +338,8 @@ Go wild! ## Assumptions / Caveats -* On Mac, the trace is dumped to your Downloads folder. On Windows, it's dumped to your Desktop (sorry not sorry). +* The location of the dump files are hardcoded at the moment! See [Step 4](#step-4-run-your-app) for locations. + * Traces are set to in memory, 80MB by default. ## Troubleshooting @@ -342,7 +357,9 @@ target_compile_options("${PROJECT_NAME}" PUBLIC /Zc:__cplusplus) ### I don't see a trace file -Did you quit your app gracefully, such as with cmd-Q? If you instead just hit STOP on your IDE, you won't get a trace file. +Did you quit your app gracefully such as with cmd-Q? + +If you instead just hit STOP on your IDE, you won't get a trace file. ### My traces appear empty diff --git a/melatonin_perfetto/melatonin_perfetto.h b/melatonin_perfetto/melatonin_perfetto.h index 01db9a7..f7f69cc 100644 --- a/melatonin_perfetto/melatonin_perfetto.h +++ b/melatonin_perfetto/melatonin_perfetto.h @@ -81,11 +81,23 @@ class MelatoninPerfetto static juce::File getDumpFileDirectory() { + + juce::File directory; + #if JUCE_WINDOWS - return juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDesktopDirectory); + directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDesktopDirectory); + #elif JUCE_LINUX + directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDocumentsDirectory); #else - return juce::File::getSpecialLocation (juce::File::SpecialLocationType::userHomeDirectory).getChildFile ("Downloads"); + directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userHomeDirectory).getChildFile ("Downloads"); #endif + + // File an issue if this ever asserts + // https://github.com/sudara/melatonin_perfetto/issues/new + jassert(directory.isDirectory()); + + return directory; + } private: diff --git a/tests/AddSubdirectory/CMakeLists.txt b/tests/AddSubdirectory/CMakeLists.txt index 5876f21..03b4c2e 100644 --- a/tests/AddSubdirectory/CMakeLists.txt +++ b/tests/AddSubdirectory/CMakeLists.txt @@ -22,7 +22,14 @@ FetchContent_MakeAvailable (JUCE) add_subdirectory ("${MELATONIN_PERFETTO_ROOT}" "${CMAKE_CURRENT_BINARY_DIR}/melatonin_perfetto") -juce_add_console_app (test VERSION 1.0.0) +juce_add_console_app (test VERSION 1.0.0 NEEDS_CURL FALSE NEEDS_WEB_BROWSER FALSE) + +# Reduce dependencies needed in CI +target_compile_definitions(test + JUCE_WEB_BROWSER=0 + JUCE_USE_CURL=0 + JUCE_VST3_CAN_REPLACE_VST2=0 +) target_sources (test PRIVATE main.cpp) diff --git a/tests/FindPackage/CMakeLists.txt b/tests/FindPackage/CMakeLists.txt index 2c1dfa1..6c31418 100644 --- a/tests/FindPackage/CMakeLists.txt +++ b/tests/FindPackage/CMakeLists.txt @@ -12,13 +12,20 @@ FetchContent_Declare (JUCE GIT_TAG origin/master GIT_SHALLOW TRUE GIT_PROGRESS TRUE - FIND_PACKAGE_ARGS 7.0.3) + FIND_PACKAGE_ARGS 7.0.6) FetchContent_MakeAvailable (JUCE) find_package (MelatoninPerfetto REQUIRED) -juce_add_console_app (test VERSION 1.0.0) +juce_add_console_app (test VERSION 1.0.0 NEEDS_CURL FALSE NEEDS_WEB_BROWSER FALSE) + +# Reduce dependencies needed in CI +target_compile_definitions(test + JUCE_WEB_BROWSER=0 + JUCE_USE_CURL=0 + JUCE_VST3_CAN_REPLACE_VST2=0 +) target_sources (test PRIVATE main.cpp)