From 9e65c977e045bd85b6dd0ed14881b796c663317c Mon Sep 17 00:00:00 2001 From: Marcus10110 Date: Wed, 23 Mar 2022 15:42:50 -0700 Subject: [PATCH 1/4] updated to use new build system and support CI builds --- .gitignore | 3 +- CMakeLists.txt | 28 ++ build_analyzer.py | 126 --------- cmake/ExternalAnalyzerSDK.cmake | 57 ++++ vs2008/.gitignore | 5 - vs2008/SDMMCAnalyzer.sln | 20 -- vs2008/SDMMCAnalyzer.vcproj | 223 --------------- xcode4/.gitignore | 3 - .../SDMMCAnalyzer.xcodeproj/project.pbxproj | 260 ------------------ 9 files changed, 86 insertions(+), 639 deletions(-) create mode 100644 CMakeLists.txt delete mode 100755 build_analyzer.py create mode 100644 cmake/ExternalAnalyzerSDK.cmake delete mode 100644 vs2008/.gitignore delete mode 100755 vs2008/SDMMCAnalyzer.sln delete mode 100755 vs2008/SDMMCAnalyzer.vcproj delete mode 100644 xcode4/.gitignore delete mode 100644 xcode4/SDMMCAnalyzer.xcodeproj/project.pbxproj diff --git a/.gitignore b/.gitignore index 216b9eb..75ec165 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .* !.gitignore -debug/ -release/ +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3cf2890 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required (VERSION 3.13) + +project(SDMMCAnalyzer) + +add_definitions( -DLOGIC2 ) + +# enable generation of compile_commands.json, helpful for IDEs to locate include files. +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# custom CMake Modules are located in the cmake directory. +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +include(ExternalAnalyzerSDK) + +set(SOURCES +src/SDMMCAnalyzer.cpp +src/SDMMCAnalyzerResults.cpp +src/SDMMCAnalyzerSettings.cpp +src/SDMMCHelpers.cpp +src/SDMMCSimulationDataGenerator.cpp +src/SDMMCAnalyzer.h +src/SDMMCAnalyzerResults.h +src/SDMMCAnalyzerSettings.h +src/SDMMCHelpers.h +src/SDMMCSimulationDataGenerator.h +) + +add_analyzer_plugin(${PROJECT_NAME} SOURCES ${SOURCES}) diff --git a/build_analyzer.py b/build_analyzer.py deleted file mode 100755 index f3ab60e..0000000 --- a/build_analyzer.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python2 -import os -import glob -import platform - -# find out if we're running on mac or linux and set the dynamic library extension -dylib_ext = "" -if platform.system().lower() == "darwin": - dylib_ext = ".dylib" -else: - dylib_ext = ".so" - -print "Running on " + platform.system() - -# make sure the release folder exists, and clean out any .o/.so file if there are any -if not os.path.exists("release"): - os.makedirs("release") - -os.chdir("release") -o_files = glob.glob("*.o") -o_files.extend(glob.glob("*" + dylib_ext)) -for o_file in o_files: - os.remove(o_file) -os.chdir("..") - - -# make sure the debug folder exists, and clean out any .o/.so files if there are any -if not os.path.exists("debug"): - os.makedirs("debug") - -os.chdir("debug") -o_files = glob.glob("*.o") -o_files.extend(glob.glob("*" + dylib_ext)) -for o_file in o_files: - os.remove(o_file) -os.chdir("..") - -# find all the cpp files in /src. We'll compile all of them -os.chdir("src") -cpp_files = glob.glob("*.cpp") -os.chdir("..") - -# specify the search paths/dependencies/options for gcc -include_paths = ["../SaleaeAnalyzerSdk-1.1.32/include"] -link_paths = ["../SaleaeAnalyzerSdk-1.1.32/lib"] -# refers to libAnalyzer.dylib or libAnalyzer.so -link_dependencies = ["-lAnalyzer64"] - -debug_compile_flags = "-O0 -w -c -fpic -g3" -release_compile_flags = "-O3 -w -c -fpic" - -# loop through all the cpp files, build up the gcc command line, and attempt to -# compile each cpp file -for cpp_file in cpp_files: - - # g++ - command = "g++ " - - # include paths - for path in include_paths: - command += "-I\"" + path + "\" " - - release_command = command - release_command += release_compile_flags - # the output file - release_command += " -o\"release/" + cpp_file.replace(".cpp", ".o") + "\" " - # the cpp file to compile - release_command += "\"" + "src/" + cpp_file + "\"" - - debug_command = command - debug_command += debug_compile_flags - # the output file - debug_command += " -o\"debug/" + cpp_file.replace(".cpp", ".o") + "\" " - # the cpp file to compile - debug_command += "\"" + "src/" + cpp_file + "\"" - - # run the commands from the command line - print release_command - os.system(release_command) - print debug_command - os.system(debug_command) - -# lastly, link -# g++ -command = "g++ " - -# add the library search paths -for link_path in link_paths: - command += "-L\"" + link_path + "\" " - -# add libraries to link against -for link_dependency in link_dependencies: - command += link_dependency + " " - -# make a dynamic (shared) library (.so/.dylib) - -if dylib_ext == ".dylib": - command += "-dynamiclib " -else: - command += "-shared " - -# figure out what the name of this analyzer is -analyzer_name = "" -for cpp_file in cpp_files: - if cpp_file.endswith("Analyzer.cpp"): - analyzer_name = cpp_file.replace("Analyzer.cpp", "") - break - -# the files to create (.so/.dylib files) -if dylib_ext == ".dylib": - release_command = command + "-o release/lib" + analyzer_name + "Analyzer.dylib " - debug_command = command + "-o debug/lib" + analyzer_name + "Analyzer.dylib " -else: - release_command = command + "-o\"release/lib" + analyzer_name + "Analyzer.so\" " - debug_command = command + "-o\"debug/lib" + analyzer_name + "Analyzer.so\" " - -# add all the object files to link -for cpp_file in cpp_files: - release_command += "release/" + cpp_file.replace(".cpp", ".o") + " " - debug_command += "debug/" + cpp_file.replace(".cpp", ".o") + " " - -# run the commands from the command line -print release_command -os.system(release_command) -print debug_command -os.system(debug_command) diff --git a/cmake/ExternalAnalyzerSDK.cmake b/cmake/ExternalAnalyzerSDK.cmake new file mode 100644 index 0000000..094d544 --- /dev/null +++ b/cmake/ExternalAnalyzerSDK.cmake @@ -0,0 +1,57 @@ +include(FetchContent) + +# Use the C++11 standard +set(CMAKE_CXX_STANDARD 11) + +set(CMAKE_CXX_STANDARD_REQUIRED YES) + +if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY OR NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/) +endif() + +# Fetch the Analyzer SDK if the target does not already exist. +if(NOT TARGET Saleae::AnalyzerSDK) + FetchContent_Declare( + analyzersdk + GIT_REPOSITORY https://github.com/saleae/AnalyzerSDK.git + GIT_TAG master + GIT_SHALLOW True + GIT_PROGRESS True + ) + + FetchContent_GetProperties(analyzersdk) + + if(NOT analyzersdk_POPULATED) + FetchContent_Populate(analyzersdk) + include(${analyzersdk_SOURCE_DIR}/AnalyzerSDKConfig.cmake) + + if(APPLE OR WIN32) + get_target_property(analyzersdk_lib_location Saleae::AnalyzerSDK IMPORTED_LOCATION) + if(CMAKE_LIBRARY_OUTPUT_DIRECTORY) + file(COPY ${analyzersdk_lib_location} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + else() + message(WARNING "Please define CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_LIBRARY_OUTPUT_DIRECTORY if you want unit tests to locate ${analyzersdk_lib_location}") + endif() + endif() + + endif() +endif() + +function(add_analyzer_plugin TARGET) + set(options ) + set(single_value_args ) + set(multi_value_args SOURCES) + cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} ) + + + add_library(${TARGET} MODULE ${_p_SOURCES}) + target_link_libraries(${TARGET} PRIVATE Saleae::AnalyzerSDK) + + set(ANALYZER_DESTINATION "Analyzers") + install(TARGETS ${TARGET} RUNTIME DESTINATION ${ANALYZER_DESTINATION} + LIBRARY DESTINATION ${ANALYZER_DESTINATION}) + + set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION}) +endfunction() \ No newline at end of file diff --git a/vs2008/.gitignore b/vs2008/.gitignore deleted file mode 100644 index 41b799a..0000000 --- a/vs2008/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -Debug -Release -*.ncb -*.suo -*.vcproj.*.user diff --git a/vs2008/SDMMCAnalyzer.sln b/vs2008/SDMMCAnalyzer.sln deleted file mode 100755 index 8c4d151..0000000 --- a/vs2008/SDMMCAnalyzer.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDMMCAnalyzer", "SDMMCAnalyzer.vcproj", "{D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|Win32.ActiveCfg = Debug|Win32 - {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Debug|Win32.Build.0 = Debug|Win32 - {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|Win32.ActiveCfg = Release|Win32 - {D7556E7E-A6BF-4BCE-BDC8-E66D2874C301}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs2008/SDMMCAnalyzer.vcproj b/vs2008/SDMMCAnalyzer.vcproj deleted file mode 100755 index 9fcab90..0000000 --- a/vs2008/SDMMCAnalyzer.vcproj +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xcode4/.gitignore b/xcode4/.gitignore deleted file mode 100644 index 17554b1..0000000 --- a/xcode4/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -SDMMCAnalyzer.xcodeproj/project.xcworkspace -SDMMCAnalyzer.xcodeproj/xcuserdata -build diff --git a/xcode4/SDMMCAnalyzer.xcodeproj/project.pbxproj b/xcode4/SDMMCAnalyzer.xcodeproj/project.pbxproj deleted file mode 100644 index 8a7ebe2..0000000 --- a/xcode4/SDMMCAnalyzer.xcodeproj/project.pbxproj +++ /dev/null @@ -1,260 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 21052B1F13EC832F00B5A7C5 /* SDMMCAnalyzer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21052B1D13EC832F00B5A7C5 /* SDMMCAnalyzer.cpp */; }; - 21052B2013EC832F00B5A7C5 /* SDMMCAnalyzer.h in Headers */ = {isa = PBXBuildFile; fileRef = 21052B1E13EC832F00B5A7C5 /* SDMMCAnalyzer.h */; }; - 21052B2313EC84B200B5A7C5 /* libAnalyzer.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 21052B2213EC84B200B5A7C5 /* libAnalyzer.dylib */; }; - 213D832213EC959600B01739 /* SDMMCAnalyzerSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 213D832013EC959600B01739 /* SDMMCAnalyzerSettings.cpp */; }; - 213D832313EC959600B01739 /* SDMMCAnalyzerSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 213D832113EC959600B01739 /* SDMMCAnalyzerSettings.h */; }; - 213D832613ECA1E700B01739 /* SDMMCSimulationDataGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 213D832413ECA1E700B01739 /* SDMMCSimulationDataGenerator.cpp */; }; - 213D832713ECA1E700B01739 /* SDMMCSimulationDataGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 213D832513ECA1E700B01739 /* SDMMCSimulationDataGenerator.h */; }; - 213D832C13EEF53600B01739 /* SDMMCAnalyzerResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 213D832A13EEF53500B01739 /* SDMMCAnalyzerResults.cpp */; }; - 213D832D13EEF53600B01739 /* SDMMCAnalyzerResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 213D832B13EEF53500B01739 /* SDMMCAnalyzerResults.h */; }; - 213EA45F13EF3D2000D3CDF0 /* SDMMCHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 213EA45D13EF3D2000D3CDF0 /* SDMMCHelpers.cpp */; }; - 213EA46013EF3D2000D3CDF0 /* SDMMCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 213EA45E13EF3D2000D3CDF0 /* SDMMCHelpers.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 21052B1D13EC832F00B5A7C5 /* SDMMCAnalyzer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDMMCAnalyzer.cpp; path = ../src/SDMMCAnalyzer.cpp; sourceTree = ""; }; - 21052B1E13EC832F00B5A7C5 /* SDMMCAnalyzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDMMCAnalyzer.h; path = ../src/SDMMCAnalyzer.h; sourceTree = ""; }; - 21052B2213EC84B200B5A7C5 /* libAnalyzer.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libAnalyzer.dylib; path = "../../SaleaeAnalyzerSdk-1.1.9/lib/libAnalyzer.dylib"; sourceTree = ""; }; - 213D832013EC959600B01739 /* SDMMCAnalyzerSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDMMCAnalyzerSettings.cpp; path = ../src/SDMMCAnalyzerSettings.cpp; sourceTree = ""; }; - 213D832113EC959600B01739 /* SDMMCAnalyzerSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDMMCAnalyzerSettings.h; path = ../src/SDMMCAnalyzerSettings.h; sourceTree = ""; }; - 213D832413ECA1E700B01739 /* SDMMCSimulationDataGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDMMCSimulationDataGenerator.cpp; path = ../src/SDMMCSimulationDataGenerator.cpp; sourceTree = ""; }; - 213D832513ECA1E700B01739 /* SDMMCSimulationDataGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDMMCSimulationDataGenerator.h; path = ../src/SDMMCSimulationDataGenerator.h; sourceTree = ""; }; - 213D832A13EEF53500B01739 /* SDMMCAnalyzerResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDMMCAnalyzerResults.cpp; path = ../src/SDMMCAnalyzerResults.cpp; sourceTree = ""; }; - 213D832B13EEF53500B01739 /* SDMMCAnalyzerResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDMMCAnalyzerResults.h; path = ../src/SDMMCAnalyzerResults.h; sourceTree = ""; }; - 213EA45D13EF3D2000D3CDF0 /* SDMMCHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDMMCHelpers.cpp; path = ../src/SDMMCHelpers.cpp; sourceTree = ""; }; - 213EA45E13EF3D2000D3CDF0 /* SDMMCHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDMMCHelpers.h; path = ../src/SDMMCHelpers.h; sourceTree = ""; }; - 21BC295913EC826C00BA43C2 /* libSDMMCAnalyzer.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDMMCAnalyzer.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 21BC295613EC826C00BA43C2 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 21052B2313EC84B200B5A7C5 /* libAnalyzer.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 21052B2413EC84C000B5A7C5 /* Sources */ = { - isa = PBXGroup; - children = ( - 213D832013EC959600B01739 /* SDMMCAnalyzerSettings.cpp */, - 213D832113EC959600B01739 /* SDMMCAnalyzerSettings.h */, - 21052B1D13EC832F00B5A7C5 /* SDMMCAnalyzer.cpp */, - 21052B1E13EC832F00B5A7C5 /* SDMMCAnalyzer.h */, - 213D832A13EEF53500B01739 /* SDMMCAnalyzerResults.cpp */, - 213D832B13EEF53500B01739 /* SDMMCAnalyzerResults.h */, - 213EA45D13EF3D2000D3CDF0 /* SDMMCHelpers.cpp */, - 213EA45E13EF3D2000D3CDF0 /* SDMMCHelpers.h */, - 213D832413ECA1E700B01739 /* SDMMCSimulationDataGenerator.cpp */, - 213D832513ECA1E700B01739 /* SDMMCSimulationDataGenerator.h */, - ); - name = Sources; - sourceTree = ""; - }; - 21052B2513EC84D300B5A7C5 /* Libs */ = { - isa = PBXGroup; - children = ( - 21052B2213EC84B200B5A7C5 /* libAnalyzer.dylib */, - ); - name = Libs; - sourceTree = ""; - }; - 21BC294E13EC826B00BA43C2 = { - isa = PBXGroup; - children = ( - 21052B2513EC84D300B5A7C5 /* Libs */, - 21052B2413EC84C000B5A7C5 /* Sources */, - 21BC295A13EC826C00BA43C2 /* Products */, - ); - sourceTree = ""; - }; - 21BC295A13EC826C00BA43C2 /* Products */ = { - isa = PBXGroup; - children = ( - 21BC295913EC826C00BA43C2 /* libSDMMCAnalyzer.dylib */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 21BC295713EC826C00BA43C2 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 21052B2013EC832F00B5A7C5 /* SDMMCAnalyzer.h in Headers */, - 213D832313EC959600B01739 /* SDMMCAnalyzerSettings.h in Headers */, - 213D832713ECA1E700B01739 /* SDMMCSimulationDataGenerator.h in Headers */, - 213D832D13EEF53600B01739 /* SDMMCAnalyzerResults.h in Headers */, - 213EA46013EF3D2000D3CDF0 /* SDMMCHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 21BC295813EC826C00BA43C2 /* SDMMCAnalyzer */ = { - isa = PBXNativeTarget; - buildConfigurationList = 21BC295D13EC826C00BA43C2 /* Build configuration list for PBXNativeTarget "SDMMCAnalyzer" */; - buildPhases = ( - 21BC295513EC826C00BA43C2 /* Sources */, - 21BC295613EC826C00BA43C2 /* Frameworks */, - 21BC295713EC826C00BA43C2 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SDMMCAnalyzer; - productName = SDMMCAnalyzer; - productReference = 21BC295913EC826C00BA43C2 /* libSDMMCAnalyzer.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 21BC295013EC826B00BA43C2 /* Project object */ = { - isa = PBXProject; - attributes = { - ORGANIZATIONNAME = "DSP Group Inc."; - }; - buildConfigurationList = 21BC295313EC826C00BA43C2 /* Build configuration list for PBXProject "SDMMCAnalyzer" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 21BC294E13EC826B00BA43C2; - productRefGroup = 21BC295A13EC826C00BA43C2 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 21BC295813EC826C00BA43C2 /* SDMMCAnalyzer */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 21BC295513EC826C00BA43C2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 21052B1F13EC832F00B5A7C5 /* SDMMCAnalyzer.cpp in Sources */, - 213D832213EC959600B01739 /* SDMMCAnalyzerSettings.cpp in Sources */, - 213D832613ECA1E700B01739 /* SDMMCSimulationDataGenerator.cpp in Sources */, - 213D832C13EEF53600B01739 /* SDMMCAnalyzerResults.cpp in Sources */, - 213EA45F13EF3D2000D3CDF0 /* SDMMCHelpers.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 21BC295B13EC826C00BA43C2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../SaleaeAnalyzerSdk-1.1.9/include"; - MACOSX_DEPLOYMENT_TARGET = 10.6; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 21BC295C13EC826C00BA43C2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_VERSION = 4.2; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../SaleaeAnalyzerSdk-1.1.9/include"; - MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx; - }; - name = Release; - }; - 21BC295E13EC826C00BA43C2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - EXECUTABLE_PREFIX = lib; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../SaleaeAnalyzerSdk-1.1.9/lib\"", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 21BC295F13EC826C00BA43C2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - EXECUTABLE_PREFIX = lib; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/../../SaleaeAnalyzerSdk-1.1.9/lib\"", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 21BC295313EC826C00BA43C2 /* Build configuration list for PBXProject "SDMMCAnalyzer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 21BC295B13EC826C00BA43C2 /* Debug */, - 21BC295C13EC826C00BA43C2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 21BC295D13EC826C00BA43C2 /* Build configuration list for PBXNativeTarget "SDMMCAnalyzer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 21BC295E13EC826C00BA43C2 /* Debug */, - 21BC295F13EC826C00BA43C2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 21BC295013EC826B00BA43C2 /* Project object */; -} From 5310cb75a8af70f22185e75105954c1e51562861 Mon Sep 17 00:00:00 2001 From: Marcus10110 Date: Wed, 23 Mar 2022 15:44:38 -0700 Subject: [PATCH 2/4] readme update --- README.md | 113 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 7c4c624..b8899d5 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,102 @@ -SD/MMC Analyzer for Saleae Logic -================================ +# SD/MMC Analyzer for Saleae Logic ** this is a fork of the original project by dirker ** This implements an SD/MMC protocol analyzer for the Logic (http://www.saleae.com) software for Saleae logic analyzers. -Compiling ---------- +Documentation for the Saleae Logic Analyzer SDK can be found here: +https://github.com/saleae/SampleAnalyzer -In order to compile the code the Saleae Analyzer SDK is needed which can be -download via the Saleae Community pages (http://www.saleae.com/community/). The -code is tested against version 1.1.32 of the SDK. +That documentation includes: -Prior to compiling the SDK zip file should be unpacked into the directory -containing the cloned sdmmc-analyzer repository, e.g.: +- Detailed build instructions +- Debugging instructions +- Documentation for CI builds +- Details on creating your own custom analyzer plugin - +-rootdir/ - +-SaleaeAnalyzerSdk-1.1.32/ - +-sdmmc-analyzer/ +# Installation Instructions -### Mac OS X +To use this analyzer, simply download the latest release zip file from this github repository, unzip it, then install using the instructions found here: -Use the Xode project in xcode4/. +https://support.saleae.com/faq/technical-faq/setting-up-developer-directory -### Linux +# Publishing Releases + +This repository is setup with Github Actions to automatically build PRs and commits to the master branch. + +However, these artifacts automatically expire after a time limit. + +To create and publish cross-platform releases, simply push a commit tag. This will automatically trigger the creation of a release, which will include the Windows, Linux, and MacOS builds of the analyzer. + +# A note on downloading the MacOS Analyzer builds + +This section only applies to downloaded pre-built protocol analyzer binaries on MacOS. If you build the protocol analyzer locally, or acquire it in a different way, this section does not apply. + +Any time you download a binary from the internet on a Mac, wether it be an application or a shared library, MacOS will flag that binary for "quarantine". MacOS then requires any quarantined binary to be signed and notarized through the MacOS developer program before it will allow that binary to be executed. + +Because of this, when you download a pre-compiled protocol analyzer plugin from the internet and try to load it in the Saleae software, you will most likely see an error message like this: + +> "libSimpleSerialAnalyzer.so" cannot be opened because th developer cannot be verified. + +Signing and notarizing of open source software can be rare, because it requires an active paid subscription to the MacOS developer program, and the signing and notarization process frequently changes and becomes more restrictive, requiring frequent updates to the build process. + +The quickest solution to this is to simply remove the quarantine flag added by MacOS using a simple command line tool. -run ./build_analyzer.py +Note - the purpose of code signing and notarization is to help end users be sure that the binary they downloaded did indeed come from the original publisher and hasn't been modified. Saleae does not create, control, or review 3rd party analyzer plugins available on the internet, and thus you must trust the original author and the website where you are downloading the plugin. (This applies to all software you've ever downloaded, essentially.) + +To remove the quarantine flag on MacOS, you can simply open the terminal and navigate to the directory containing the downloaded shared library. + +This will show what flags are present on the binary: + +```sh +xattr libSimpleSerialAnalyzer.so +# example output: +# com.apple.macl +# com.apple.quarantine +``` + +This command will remove the quarantine flag: + +```sh +xattr -r -d com.apple.quarantine libSimpleSerialAnalyzer.so +``` + +To verify the flag was removed, run the first command again and verify the quarantine flag is no longer present. + +## Building your Analyzer + +CMake and a C++ compiler are required. Instructions for installing dependencies can be found here: +https://github.com/saleae/SampleAnalyzer + +The fastest way to use this analyzer is to download a release from github. Local building should only be needed for making your own changes to the analyzer source. ### Windows -Not yet supported +```bat +mkdir build +cd build +cmake .. -A x64 +cmake --build . +:: built analyzer will be located at SampleAnalyzer\build\Analyzers\Debug\SimpleSerialAnalyzer.dll +``` -Debugging ---------- +### MacOS -### Mac OS X +```bash +mkdir build +cd build +cmake .. +cmake --build . +# built analyzer will be located at SampleAnalyzer/build/Analyzers/libSimpleSerialAnalyzer.so +``` -* Configure Xcode to place build products in locations specified by targets - * Xcode -> Preferences -> Locations Tab -> Build Location -* Edit SDMMCAnalyzer Scheme to launch Logic upon debugging - * Product -> Edit Scheme -> Debug -> Info -> Executable - * Browse for Logic.app (e.g. /Applications/Logic.app) -* Configure Logic to look for the Analyzer Plugin - * Launch Logic manually - * Options -> Preferences - * Under [For Developers], "Search this path for Analyzer Plugins" - * Browse for the ../sdmmc-analyzer/xcode4/build/Debug directory - * Click "Save" and close Logic +### Linux +```bash +mkdir build +cd build +cmake .. +cmake --build . +# built analyzer will be located at SampleAnalyzer/build/Analyzers/libSimpleSerialAnalyzer.so +``` From 7f6db63a30e25f31d7e1ddc8d195f7a606bf6a1a Mon Sep 17 00:00:00 2001 From: Marcus10110 Date: Wed, 23 Mar 2022 15:46:51 -0700 Subject: [PATCH 3/4] fix from satirebird, https://github.com/Marcus10110/sdmmc-analyzer/pull/1 manually applied due to reset. --- src/SDMMCAnalyzer.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/SDMMCAnalyzer.cpp b/src/SDMMCAnalyzer.cpp index f702c21..f0b6eaf 100644 --- a/src/SDMMCAnalyzer.cpp +++ b/src/SDMMCAnalyzer.cpp @@ -28,14 +28,20 @@ void SDMMCAnalyzer::WorkerThread() { mClock = GetAnalyzerChannelData(mSettings.mClockChannel); mCommand = GetAnalyzerChannelData(mSettings.mCommandChannel); - mData0 = GetAnalyzerChannelData(mSettings.mDataChannel0); - mData1 = GetAnalyzerChannelData(mSettings.mDataChannel1); - mData2 = GetAnalyzerChannelData(mSettings.mDataChannel2); - mData3 = GetAnalyzerChannelData(mSettings.mDataChannel3); - mData4 = GetAnalyzerChannelData(mSettings.mDataChannel4); - mData5 = GetAnalyzerChannelData(mSettings.mDataChannel5); - mData6 = GetAnalyzerChannelData(mSettings.mDataChannel6); - mData7 = GetAnalyzerChannelData(mSettings.mDataChannel7); + if (mSettings.mBusWidth != BUS_WIDTH_0) + mData0 = GetAnalyzerChannelData(mSettings.mDataChannel0); + if (mSettings.mBusWidth == BUS_WIDTH_4 || + mSettings.mBusWidth == BUS_WIDTH_8) { + mData1 = GetAnalyzerChannelData(mSettings.mDataChannel1); + mData2 = GetAnalyzerChannelData(mSettings.mDataChannel2); + mData3 = GetAnalyzerChannelData(mSettings.mDataChannel3); + } + if (mSettings.mBusWidth == BUS_WIDTH_8) { + mData4 = GetAnalyzerChannelData(mSettings.mDataChannel4); + mData5 = GetAnalyzerChannelData(mSettings.mDataChannel5); + mData6 = GetAnalyzerChannelData(mSettings.mDataChannel6); + mData7 = GetAnalyzerChannelData(mSettings.mDataChannel7); + } while (true) { From 4cb12fbc6adf10d0c3d1ec0dd27280dc69c734b7 Mon Sep 17 00:00:00 2001 From: Marcus10110 Date: Wed, 23 Mar 2022 15:49:52 -0700 Subject: [PATCH 4/4] added github actions. --- .github/workflows/build.yml | 71 +++++++++++++++++++++++++++++++++++++ .gitignore | 5 ++- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml 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/.gitignore b/.gitignore index 75ec165..d56cb93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -.* -!.gitignore -build/ \ No newline at end of file +build/ +.DS_Store \ No newline at end of file