Merge pull request #4 from ianrrees/20171210-improve-build

20171210 improve build
This commit is contained in:
Mark 2018-01-08 11:24:14 -08:00 committed by GitHub
commit efb8f9a82a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -1,7 +1,8 @@
# Python 3 script to build the analyzer
import os, glob, 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:
@ -45,6 +46,12 @@ link_dependencies = [ "-lAnalyzer" ] #refers to libAnalyzer.dylib or libAnalyzer
debug_compile_flags = "-O0 -w -c -fpic -g"
release_compile_flags = "-O3 -w -c -fpic"
def run_command(cmd):
"Display cmd, then run it in a subshell, raise if there's an error"
print(cmd)
if os.system(cmd):
raise Exception("Shell execution returned nonzero status")
#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:
@ -66,10 +73,8 @@ for cpp_file in cpp_files:
debug_command += "\"" + "source/" + cpp_file + "\"" #the cpp file to compile
#run the commands from the command line
print(release_command)
os.system( release_command )
print(debug_command)
os.system( debug_command )
run_command(release_command)
run_command(debug_command)
#lastly, link
#g++
@ -111,9 +116,5 @@ for cpp_file in cpp_files:
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 )
run_command(release_command)
run_command(debug_command)

View File

@ -8,7 +8,7 @@ This repository should be used to create new analyzers for the Saleae software.
First, fork, clone or download this repository. Forking is recommended if you plan to use version control or share your custom analyzer publicly.
Note - This repository contains a submodule. Be sure to include submodules when cloning. If you download the repository from Github, the submodules are not included. In that case you will also need to download the AnalyzerSDK repository linked above and place the AnalyzerSDK folder inside of the SampleAnalyzer folder.
Note - This repository contains a submodule. Be sure to include submodules when cloning, for example `git clone --recursive https://github.com/saleae/SampleAnalyzer.git`. If you download the repository from Github, the submodules are not included. In that case you will also need to download the AnalyzerSDK repository linked above and place the AnalyzerSDK folder inside of the SampleAnalyzer folder.
Once downloaded, first run the script rename_analyzer.py. This script is used to rename the sample analyzer automatically. Specifically, it changes the class names in the source code, it changes the text name that will be displayed once the custom analyzer has been loaded into the Saleae Logic software, and it updates the visual studio project.