Notes:
- The CTHM1176...Test.cpp are Google Test test cases.
- THM1176TestUtilities.cpp is a small library of support functions.
- The following additional elements are required to be able to build the code:
  - ../include and ../../Common/<various include directories> must be added to the header
    search path.
  - NI-VISA (http://www.ni.com/en-us/support.html): 
    Required if using VISAInstrument. Install at least the run-time support library.
    On a Mac, add /Library/Frameworks to the Xcode Framework Search path. Add the include directory 
    to the header search path (not needed on a Mac, since the headers are found in the Framework).
	For supported Linux systems (Red Hat Enterprise Linux 6/7, OpenSUSE LEAP 42.1/42.2, CentOS 7), 
	install NI-VISA as described here: http://www.ni.com/product-documentation/54754/en/.
  - libusb (https://libusb.info):
    Required if using USBTMCInstrument. 
    NOTE: For Windows, a special binary download is available. For other systems, libusb can be installed
		via a package download, and may in fact already be installed. Remember to fix the include and library paths.
	NOTE: Beware of the version; early releases of libusb-1.0 do not compile, because they do not define,
		for example, LIBUSB_OPTION_LOG_LEVEL and LIBUSB_LOG_LEVEL_WARNING.
	NOTE: Also note that versions anterior to 1.022 don't work with macOS versions starting with El Capitan –
		see https://github.com/libusb/libusb/commit/871eb299b989bc0714391804a9d2fdb145a32ff5.
		For this reason, one should build libusb from scratch; at this time, the MacPorts version appears
		to be out of date.
  - Google Test (https://github.com/google/googletest): download, extract and use CMake to  
    install at ../../Common/gtest. Add the resulting project as a sub-project in the test project, 
    to build a statically-linked library that the tests will link against. Include both libgtest.a
    and libgtest_main.a in the link step. Add the include directory to the header search path.
    NOTE: On certain systems, Google Test is available as an installable package. However, sometimes
    	(e.g. Ubuntu 18.04), this does not include the compiled libraries. Remember to fix the include and 
    	library paths.
	NOTE: MS Visual Studio 2017 includes support for Google Test, so this installation is not needed.
		However, the Windows pathname-length limitation may cause problems, especially since Perforce
		creates long pathnames by default.
  - Eigen (http://eigen.tuxfamily.org/index.php?title=Main_Page): download, extract and use 
    CMake to install at ../../Common/eigen. Open the resulting project and use the "install"
    target to install it. On *nix systems, it installs in /usr/local/include/eigen3; since this is
    a protected directory, you have to do this with administrator rights. Add the include directory 
    to the header search path. Eigen is a pure template library, and needs no further installation –
    it all happens in the .h files.
    NOTE: also available as a package on certain systems. Remember to fix the include and 
       	library paths.
- The following directories are used to build the code on the different platforms:
   - THM1176Test.xcodeproj is the Xcode project to compile and run the tests. Xcode is Apple's 
     IDE. This is a Macintosh package; i.e. it is actually a folder with sub-folders and files,
     which becomes apparent on a "foreign" platform.
   - THM1176Test.vs contains the Visual Studio solution, with two projects: THM1176 API.vcxproj which compiles
     the THM1176 library, and Test/Test.vcxproj which is the Google Test project. Note that Google Test shoould
     be automatically restored into the sub-directory packages; if not, an error message will point to possible 
     solutions.
   - THM1176Test.eclipse contains a standard GNU Makefile, which can be imported to make an Eclipse project.
     The root of this project should be the THM1176-host-C++ root directory, i.e. the Perforce workspace directory.
     The THM1176Test subdirectory contains the Eclipse project, which has to be copied to your Eclipse workspace folder.
- To run the tests:
  - The standard command-line argument for Google Test is:
	--gtest_filter=*.*-CTHM1176MiscUtilitiesTest.SwitchToDFUMode:CTHM1176TimeoutHandlingTest.AbortRead
    This tests everything except SwitchToDFUMode, which renders the THM inoperable, and
    AbortRead, which doesn't work with version 3.x of the firmware.
  - THM1176MeasureImmediateTiming.cpp is a separate program that, as the name implies, measures
    measurement times in Immediate trigger mode. As parameterized, this program takes several hours
    to run.
  - THM1176MeasureImmediateTiming.txt is the output of THM1176MeasureImmediateTiming.cpp.  This was run
    with a THM1176-MF with F/W version 3.1. All THM1176 models should have the same performance, but the
    results vary significantly with the F/W version.
  - THM1176MeasureImmediateTiming.xlsx is an Excel sheet with the data analysis. These results
    underly the values of THM1176_IMMEDIATE_TIME_PER_ACQ and  THM1176_IMMEDIATE_TIME_PER_MEAS, in
    THM1176.cpp.
    NOTE: On Linux systems, USB devices are usually write-protected for everyone but root. To provide access 
    	to USBTMC devices for standard users, NI-VISA installs a rule file, /etc/udev/rules.d/nivisa_usbtmc.rules 
    	(actually a link to /usr/lib/x86_64-linux-gnu/ni-visa/usb/nivisa_usbtmc.rules). If you have not installed NI-VISA, 
    	create a file "Metrolab.rules" in the /etc/udev/rules.d/ directory, containing the lines:
    		SUBSYSTEM=="usb", ATTRS{idVendor}=="1bfa", MODE="0666"
			SUBSYSTEM=="usb_device", ATTRS{idVendor}=="1bfa", MODE="0666"
		Reboot the system for the rule to take effect.
	NOTE: On Windows, you need to switch drivers to be able to run the tests with VISAInstrument or with
		USBTMCInstrument. To enable the VISA driver:
		- Start the Device Manager
		- Select the THM1176 (if currently using WinUSB driver, under "Universal Serail Bus Devices")
		- Right-click and "Update driver"
		- Select "Browse my computer for driver software", then "Let me pick from a list of available drivers on my computer"
		- Select "USB Test and Measurement Device (IVI)", and "Next"
		To enable the WinUSB driver:
		- Download and run the "Zadig" utility (https://zadig.akeo.ie)
		- Under "Options", select "List all devices"
		- Select the THM1176 from the pull-down menu
		- Select the libusbK or libusb-win32 driver and click "Replace Driver"
- Note for building EZMag3D under Ubuntu: to fix error, "cannot find -lGL" (cannot find OpenGL library):
    sudo apt install libgl1-mesa-dev
