diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a116c1b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +name: Build + +on: + push: + branches: [master] + tags: + - '*' + pull_request: + branches: [master] + +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: | + cmake -B ${{github.workspace}}/build -A x64 + cmake --build ${{github.workspace}}/build --config Release + - name: Upload windows build + uses: actions/upload-artifact@v2 + with: + name: windows + path: ${{github.workspace}}/build/Analyzers/Release/*.dll + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release + cmake --build ${{github.workspace}}/build + - name: Upload MacOS build + uses: actions/upload-artifact@v2 + with: + name: macos + path: ${{github.workspace}}/build/Analyzers/*.so + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release + cmake --build ${{github.workspace}}/build + - name: Upload Linux build + uses: actions/upload-artifact@v2 + with: + name: linux + path: ${{github.workspace}}/build/Analyzers/*.so + publish: + needs: [windows, macos, linux] + runs-on: ubuntu-latest + steps: + - name: download individual builds + uses: actions/download-artifact@v2 + with: + path: ${{github.workspace}}/artifacts + - name: zip + run: | + cd ${{github.workspace}}/artifacts + zip -r ${{github.workspace}}/analyzer.zip . + - uses: actions/upload-artifact@v2 + with: + name: all-platforms + path: ${{github.workspace}}/artifacts/** + - name: create release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ${{github.workspace}}/analyzer.zip \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a01bb89..4be3d8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.11) project(mdio_analyzer) - +add_definitions( -DLOGIC2 ) # enable generation of compile_commands.json, helpful for IDEs to locate include files. set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/README.md b/README.md index 10ca088..5e58f58 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,19 @@ Saleae Management Data Input/Output (MDIO) Analyzer ## Getting Started +The following documentation describes getting this analyzer building locally. For more detailed information about the Analyzer SDK, debugging, CI build, and more, checkout the readme from the Sample Analyzer repository: + +https://github.com/saleae/SampleAnalyzer + ### MacOS Dependencies: + - XCode with command line tools -- CMake 3.11+ +- CMake 3.13+ Installing command line tools after XCode is installed: + ``` xcode-select --install ``` @@ -22,12 +28,15 @@ Installing CMake on MacOS: 1. Download the binary distribution for MacOS, `cmake-*-Darwin-x86_64.dmg` 2. Install the usual way by dragging into applications. 3. Open a terminal and run the following: + ``` /Applications/CMake.app/Contents/bin/cmake-gui --install ``` -*Note: Errors may occur if older versions of CMake are installed.* + +_Note: Errors may occur if older versions of CMake are installed._ Building the analyzer: + ``` mkdir build cd build @@ -35,10 +44,11 @@ cmake .. cmake --build . ``` -### Ubuntu 16.04 +### Ubuntu 18.04+ Dependencies: -- CMake 3.11+ + +- CMake 3.13+ - gcc 4.8+ Misc dependencies: @@ -48,6 +58,7 @@ sudo apt-get install build-essential ``` Building the analyzer: + ``` mkdir build cd build @@ -58,15 +69,17 @@ cmake --build . ### Windows Dependencies: -- Visual Studio 2015 Update 3 -- CMake 3.11+ -**Visual Studio 2015** +- Visual Studio 2019 +- CMake 3.13+ -*Note - newer versions of Visual Studio should be fine.* +**Visual Studio 2019** + +_Note - newer and older versions of Visual Studio are likely to work._ Setup options: -- Programming Languages > Visual C++ > select all sub-components. + +- Workloads > Desktop & Mobile > "Desktop development with C++" Note - if CMake has any problems with the MSVC compiler, it's likely a component is missing. @@ -76,10 +89,20 @@ Download and install the latest CMake release here. https://cmake.org/download/ Building the analyzer: + ``` mkdir build cd build -cmake .. +cmake .. -A x64 ``` Then, open the newly created solution file located here: `build\mdio_analyzer.sln` + +The built analyzer DLLs will be located here: + +`build\Analyzers\Debug` + +`build\Analyzers\Release` + +For debug and release builds, respectively. + diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 3c74c5d..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Configuration for automated CI building using Microsoft Azure Pipelines. -# https://azure.microsoft.com/en-us/services/devops/pipelines/ -# This will build this analyzer for all 3 target platforms. -# It will create github releases for tagged commits. - -# In order to publish releases to github, you must add a new GitHub service connection in your project settings, under Pipelines -> Service Connections. -# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#sep-github -# if you don't setup a github connection, but intend to use azure CI, then you will need to delete the GithubRelease@0 task at the bottom of this file. -# store the name of your service connection in GITHUB_CONNECTION. -variables: - GITHUB_CONNECTION: 'github.com_Marcus10110' - -# trigger: always build commits to master, all commits to open pull requests, and all tags. -trigger: - branches: - include: - - 'master' - tags: - include: - - '*' -pr: - - '*' - -# build for MacOS, Linux, and Windows. -jobs: - - job: build - pool: - vmImage: $(imageName) - strategy: - matrix: - windows: - imageName: 'vs2017-win2016' - CMAKE_ARGS: '-G "Visual Studio 15 Win64"' - BUILD_ARGS: '--config RelWithDebInfo' - linux: - imageName: 'ubuntu-16.04' - CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=RelWithDebInfo' - BUILD_ARGS: '' - mac: - imageName: 'macOS-10.15' - CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=RelWithDebInfo' - BUILD_ARGS: '' - displayName: 'Build and deploy graph-io' - - steps: - - script: | - mkdir build - cd build - cmake $(CMAKE_ARGS) .. - cmake --build . $(BUILD_ARGS) - displayName: 'Build' - - - script: | - cd build - install_name_tool -change @executable_path/libAnalyzer.dylib @rpath/libAnalyzer.dylib Analyzers/*.so - displayName: 'MacOS: fix install name' - condition: eq( variables['Agent.OS'], 'Darwin' ) - - # this publishes to azure pipelines, so that other CI agents can load these files, later in the pipeline - - publish: $(System.DefaultWorkingDirectory)/build/Analyzers/RelWithDebInfo - artifact: AnalyzerLibWin - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - displayName: 'Windows: Publish' - - publish: $(System.DefaultWorkingDirectory)/build/Analyzers - artifact: AnalyzerLibMac - condition: eq( variables['Agent.OS'], 'Darwin' ) - displayName: 'MacOS: Publish' - - publish: $(System.DefaultWorkingDirectory)/build/Analyzers - artifact: AnalyzerLibLinux - condition: eq( variables['Agent.OS'], 'Linux' ) - displayName: 'Linux: Publish' - - # This job downloads the analyzer library compiled from the three different platforms, and preps it for publishing. - - job: deploy - dependsOn: - - build - displayName: 'deploy' - pool: - vmImage: 'ubuntu-16.04' - steps: - - download: current - artifact: AnalyzerLibLinux - - download: current - artifact: AnalyzerLibWin - patterns: | - *.dll - *.pdb - - download: current - artifact: AnalyzerLibMac - - script: | - export REPO_NAME=$(echo $(Build.Repository.Name) | sed 's|.*/||') - echo $REPO_NAME - pushd $(Build.ArtifactStagingDirectory) - mkdir win osx linux - popd - cp $(Pipeline.Workspace)/AnalyzerLibWin/* $(Build.ArtifactStagingDirectory)/win - cp $(Pipeline.Workspace)/AnalyzerLibMac/* $(Build.ArtifactStagingDirectory)/osx - cp $(Pipeline.Workspace)/AnalyzerLibLinux/* $(Build.ArtifactStagingDirectory)/linux - cd $(Build.ArtifactStagingDirectory) - zip -r ${REPO_NAME}-bin.zip . - unzip -l ${REPO_NAME}-bin.zip - # This creates (or replaces) a github release for tagged commits only. The release name will be the tag name. - # Note, if you do not want to setup a github service connection, but want to use CI, you will need to delete this task. - - task: GithubRelease@0 - displayName: 'Create GitHub Release' - inputs: - gitHubConnection: $(GITHUB_CONNECTION) - repositoryName: $(Build.Repository.Name) - assets: $(Build.ArtifactStagingDirectory)/*.zip \ No newline at end of file