-
Notifications
You must be signed in to change notification settings - Fork 34
Build Windows
These instructions are for building SolTrace for Windows with Microsoft Visual Studio Community 2017 (VS 2017).
If you have a different version of Visual Studio installed on your computer, you can install and run VS 2017 side-by-side with the other version.
If you do not have VS 2017 installed on your computer, you can download it from https://www.visualstudio.com/downloads/. Using VS 2017 requires a free Microsoft account, which you will be prompted to create or enter when you first start the program.
SolarPILOT's user interface uses wxWidgets 3.1.0. You will need to download Windows source code (as either a ZIP or 7Z file) for Version 3.1.0 from https://www.wxwidgets.org/downloads/.
-
Start VS 2017.
-
Open the
build/msw/wx_vc14.sln
Visual Studio Solution file in the folder where you extracted the wxWidgets 3.1.0 files. There are project files for other versions of Visual Studio, so be sure to open thevc14
file. -
Build Debug and Release configurations for both 32-bit and 64-bit platforms: In the VS 2017 toolbar, choose the configuration and platform, and then either press the F7 key, or choose Build Solution from the Build menu.
Note. If you only plan to build SolarPILOT for one platform, and do not plan to use Visual Studio for debugging, then you can just build a single release version to save time, for example, the Release configuration and 64-bit platform.
If a build fails, you may need to "retarget" the solution by right-clicking the solution name in the Solution Explorer and choosing Retarget solution from the shortcut menu (or from the Project menu).
If the builds succeed, you should see one or all of the following folders in the wxWidgets-3.1.0/build/msw
folder, each containing several folders and a handful of .pch
files:
vc_mswu (release win32)
vc_mswud (debug win32)
vc_x64_mswu (release x64)
vc_x64_mswud (debug x64)
If you plan to contribute code to the repositories, use GitHub to clone the repositories to your computer. If you want to build your own versions of the software without contributing code, or just want to examine the source code, you can either clone the repositories using GitHub, or download zip files of the repositories and extract them instead.
The repositories required to build SolTrace are:
For these instructions, we put those repositories in separate folders named, lk
, and wex
, in a single parent folder called st_dev
. The build tools use the environment variables we set in the next step to find these folders, so you can organize them differently if you want. Be sure that you have both read and write permissions to the folders you use.
st_dev/lk
st_dev/wex
Environment variables store values for programs and processes on your computer. SolarPILOT's build tools use four environment variables to determine where the files it needs are stored on your computer. Before building the projects, you should set the following environment variables to point to each of the project folders you created in Step 2 and 3.
Name | Value (Folder Path) |
---|---|
WXMSW3 | wxWidgets 3.1.0 |
LKDIR | st_dev/lk |
WEXDIR | st_dev/wex |
CORETRACEDIR | st_dev/soltrace/coretrace |
-
If Visual Studio is running, close it.
-
Use Windows to search for "Environment Variables," and open the System Properties window.
-
On the Advanced tab, click Environment Variables. The Environment Variables window shows two lists, one for user variables and one for system variables.
-
Under the user variables list, click New, and type values for the variable name and value. For example, if you put the LK repository in
F:\st_dev\lk
, you would set the environment variable's name to "LKDIR" and its value to "F:\st_dev\lk" (you do not need to type the quotes).
If you build different branches of SAM on a regular basis, you can use a batch file to set environment variable values before you build each branch. For example, you could create a text file named set_env.bat
in the F:\SPT_dev
folder that contains:
REM wxWidgets-3.1.0 installation folder
setx WXMSW3 C:\wxWidgets-3.1.0
REM LK and WEX folders
setx LKDIR F:\st_dev\my_branch\lk\
setx WEXDIR F:\st_dev\my_branch\wex\
setx CORETRACEDIR F:\st_dev\my_branch\soltrace\
Then from a Command window, navigate to the F:\st_dev
folder, type set_env
and press Enter to automatically create the variables and set their values.
For each of the three projects, use VS 2017 to open the solution file (.sln) and build Debug and Release configurations for both 32-bit and 64-bit platforms (or for a single configuration and platform to save time) as you did for wxWidgets. Build the projects in the following order:
lk/build_vs2017/lk_vc14.sln
wex/build_vs2017/wex_vc14.sln
soltrace/coretrace/build_vs2017/coretracelib_vs2017.sln
The build order is important because of dependencies between the projects.
If you make changes to a project and are rebuilding it to compile your code, you can skip the preceding project if you did not change it. For example, if you build all three projects, and then make a modification to code in WEX, you only need to build WEX and SolTrace with your changes.
Note. If you get build errors about missing files, check the environment variables to makes sure they are correctly named and point to the correct folders. When building LK, WEX, SolTrace, or SolarPILOT, errors about missing wx/<filename>.h
files may indicate that wxWidgets has not been built for the combination of configuration and platform that you are trying to build. For example, if you are building a debug/win32 version of LK and see the messages, you need to first build a debug/win32 version of wxWidgets.
-
On the File menu, click Open, Project/Solution to open the
.sln
file for the LK project. -
In the toolbar at the top of the Window, choose Debug and Win32 to build the Debug configuration for the 32-bit platform. If you are building a single configuration and platform to save time, choose the Release configuation for your platform (Win32 or x64).
-
On the Build menu, click Build Solution, or press the F7 key.
-
The console at the bottom of the window shows you the status of the build. When the build finishes, you should see a message like "Build: 2 succeeded, 0 failed, 0 skipped." You can ignore warnings. Errors will prevent the build from succeeding.
-
When the build is complete, repeat Steps 2-4 to build Debug and Release configurations for the Win32 and x64 platforms, or skip this step if you are making a single build.
-
Close the solution, and open the next one (WEX, SolTrace), and repeat Steps 1-5 until you have built all four projects.
After you have built the four projects, test the build by starting SolTrace and running a sample file simulation.
-
In the SolTrace folder, go to
deploy\win32
ordeploy\x64
, and runSolTrace.exe
. -
After SolTrace starts, click the menu button and the Open Project list item. Navigate to
/path/to/st_dev/soltrace/app/deploy/samples/
and open a sample file. -
Go to the Trace page, enable sunshape and optical errors (and point focus, if the system is a tower or dish technology), and click Start Ray Trace.
-
Go to the Intersections page and enable all stages and elements, and confirm that you can view ray intersections. Go to the Flux maps page and select a flux map to view, ensuring that flux data is displayed.