-
Notifications
You must be signed in to change notification settings - Fork 1
/
BuildInstructions.txt
112 lines (91 loc) · 6.4 KB
/
BuildInstructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
The following document is a brief summary of the development environment for the SoftwareInteroperability solution and projects. It summarises the major external dependencies: those packages that need to be installed and also the compiler and linker dependencies. This document also covers running the tests. This document can be used as a 'quick start' for those who feel comfortable with the required development tools and environment.
External Dependencies
- Boost version 1.81 - (Edit the file "D:\Libraries\boost_1_81_0\tools\build\src\user-config.jam" to build the appropriate version(s) of the python libraries).
- Python 3.9*
- Excel (Office365)
- CodeBlocks 20.03
- MinGW
- Rtools4.3
*Note for the author. Currently we have two versions of Python installed.
Python 3.10 - C:\Users\<user>\AppData\Local\Programs\Python\Python310. This was installed from the python.org redistributable and is what we get when executing 'py' from a terminal.
Python 3.9 - C:\Users\<user>\anaconda3. This was installed from Anaconda. This is the version we use for running the python test scripts for the 3 python components (StatsPythonRaw, StatsPythonBoost and StatsPythonPyBind). This is a convenience since we run the tests using VSCode which we launch from Anaconda. This will 'install' the conda env (and the path to where the site-packages are located etc) as part of its startup.
e.g.
PS D:\Development\Projects\C++\SoftwareInteroperability\StatsPython> C:/Users/adam_/anaconda3/Scripts/activate
PS D:\Development\Projects\C++\SoftwareInteroperability\StatsPython> conda activate base
PS D:\Development\Projects\C++\SoftwareInteroperability\StatsPython> & 'C:\Users\adam_\anaconda3\python.exe' 'c:\Users\adam_\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '57217' '--' 'D:\Development\Projects\C++\SoftwareInteroperability\StatsPython\DescriptiveStatistics.py'
Visual Studio Community Edition 2022 projects
1. Download SoftwareInteroperability.zip to a temporary location (Downloads)
2. Unzip the contents to a development directory - the root directory is SoftwareInteroperability
3. Double-click the SoftwareInteroperability.sln (located in the root directory).
4. In Visual Studio, select Solution Configurations = Debug, and Solutions Platforms = x64 (screenshot)
5. Press Ctrl+Shift+B (Rebuild All). The expected result: ========== Build: 13 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
6. Repeat this for Release x64 build. The expected result: ========== Build: 13 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Additional include directories are configurable under the Project settings, Configuration Properties node:
> C/C++
Additional Include Directories:
C:\Users\<user>\Anaconda3\include;
$(BOOST_ROOT);
> Linker
Additional Library Directories:
C:\Users\<user>\Anaconda3\libs;
D:\Libraries\boost_1_81_0\stage\lib;
This assumes the following dependencies are configured:
Boost
Include: $(BOOST_ROOT)
Library: D:\Libraries\boost_1_81_0\stage\lib;
Python (all StatsPython... projects)
Include: C:\Users\<user>\Anaconda3\include (or wherever your Python.h distribution is located)
Library: C:\Users\<user>\Anaconda3\libs;
Excel (for running StatsExcel and StatsATLCOM)
Excel location: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
Optional
Visual Leak Detector (VLD)
Library: D:\Program Files (x86)\Visual Leak Detector\lib\Win64;
The COM component requires registration.
If you see the message:
"error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions."
There are various solutions to this issue: https://social.msdn.microsoft.com/Forums/en-US/8094f7a4-0146-41a5-b1b9-1d27ddce9e0f/error-msb8011-failed-to-register-output-please-try-enabling-peruser-redirection-or-register-the?forum=vcgeneral
We use the following:
In the project's Linker > General property page, set the "Per-User Redirection property" to "Yes".
This will cause your COM server to be registered in HKCU instead of HKLM.
Non-Visual Studio projects
StatsLibCB
1. Open CodeBlocks and load the StatsLibCB project.
2. Check the toolchain Setings > Compiler (we depend on a MinGW installation)
The toolchain is at (for example):
D:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
3. Check dependency on Boost (as above). Configure the Search Directories (Compiler) with: <boost>\boost_1_76_0
4. Build the CodeBlocks project in debug and release.
StatsR
1. Double click the StatsR.Rproj project file. This will open RStudio and the project.
2. Under the menu Build > Configure Build Tools ...
3. The StatsR package depends on Rtools4.3.
Check environment variable and path: RTOOLS43_HOME=D:\rtools43
4. Check Rcpp is installed as a package.
5. Edit Makevars.win with your root directory to the SoftwareInteroperability project:
PKG_LIBS=<root>/SoftwareInteroperability/StatsLibCB/bin/Debug/libStatsLib.a
6. Build > Clean and rebuild.
7. Source testthat.R. This will run the test suite.
Testing (from Visual Studio Community Edition IDE, set each as the startup project and press F5; launch in debug mode):
1. Run StatsLibTest.
2. Run StatsConsole.
3. Run StatsViewer.
4. Run StatsCLR.UnitTests.
5. Run StatsClient.
6. Run StatsATLCOM - use the test spreadsheet: StatsATLCOMTest.xlsm. This contains VBA code (Alt-F11) in a Module that wraps up calls to the ATLCOM component.
7. Run StatsExcel - use the test spreadsheet: StatsCLRTest.xlsx.
NOTE that using Office365 the {} array syntax is no longer neeeded and we can take advantage of dynamic arrays.
Testing for the Python related projects using Visual Studio Code.
Start VSCode from an Anaconda session. This will inject the correct calls to the environment variables.
8. In VSCode, open the folder /SoftwareInteroperability/StatsPython. There are various scripts that can be used to check the functionality of the three components: StatsPythonRaw, StatsPythonBoost, and StatsPythonPyBind.
StatsPythonRaw
a) Run DescriptiveStatistics.py
b) Run LinearRegression.py
c) Run HypothesisTests.py
StatsPythonBoost and StatsPythonPyBind
a) Run StatsPython.py
Change the #import as required:
#import StatsPythonPyBind as Stats
import StatsPythonBoost as Stats
b) Run PerformanceTest.py
c) Run StatsService.py. This runs a local webserver service on port 5000. Enter http://localhost:5000/ in the titlebar to initiate the form that collects the t-test data and press submit.