-
Notifications
You must be signed in to change notification settings - Fork 34
Build OSX
These instructions were written and tested in August 2017 with macOS Sierra 10.12.6, Xcode 8.3.3 with Command Line Developer Tools FOR SAM, and have not been fully tested for SolTrace. They assume that you have at least installed Command Line Developer Tools on your Mac so that you can compile C++ projects from the command line in a terminal window. See this helpful blog for more about Xcode and Command Line Developer Tools. The builds are performed with OS X 10.9 support using the "-mmacosx-version-min=10.9" in both the CFLAGS and CXXFLAGS.
-
To install the Command Line Tools package in macOS Sierra, open a terminal window, and type the following command:
xcode-select --install
If Command Line Developer tools is not installed, you should see a message asking if you want to install them. Click Install: you do not need to get Xcode if you do not want the full Xcode package.
The SolTrace project depends on wxWidgets libraries, which you can build in any directory. You will create a symbolic link and change the PATH environment to tell the SolTrace makefiles where to find the libraries.
The source code for the LK, WEX, and SolTrace projects should go in a single parent directory. If you already have a directory for your projects, you can use it, or you can create a new one specifically for SAM. These instructions use the following directory structure as an example:
.../st_dev/wxWidgets-3.1.0
.../st_dev/lk
.../st_dev/wex
.../st_dev/SolTrace
The lk
, wex
, and SolTrace
directories should all be in one directory. The wxWidgets directory does not have to be in the same directory as those four.
-
Download the wxWidgets 3.1.0 source code for Linux, OS X, etc. from https://www.wxwidgets.org/downloads/. The code repository is available in several zip formats. These instructions explain how to unzip the following file:
wxWidgets-3.1.0.tar.bz2
-
Clone the SolTrace code repositories:
cd st_dev git clone https://github.com/nrel/lk git clone https://github.com/nrel/wex git clone https://github.com/nrel/SolTrace
The
git clone
command automatically creates a directory for the repository, so you do not need to create a directory before you clone it. For example if you clone thelk
repository into yourst_dev
directory, Git will create anlk
directory for the repository.Note. You can also download the repositories from GitHub as
.zip
files instead of cloning them. If you do that, be sure to extract them into directories namedlk
,wex
, andSolTrace
so that the makefiles can find them.
-
Create a wxWidgets-3.1.0 directory, and extract the compressed file and tarball into it:
bunzip2 –d wxWidgets-3.1.0.tar.bz2 tar xvf wxWidgets-3.1.0.tar
Note: You may be able to use
tar xvjf
without first runningbunzip2
according to this article on thegeekstuff.You should now have a directory named
wxWidgets-3.1.0
that contains several files and directories: -
Run the configure command from the wxWidgets installation directory:
./configure –prefix=$HOME/local/wx-3.1.0 --enable-stl=yes --enable-debug=no --enable-shared=no --with-cocoa --enable-macosx_arch=x86_64 --enable-unicode --enable-webview --with-cxx=11 --with-macosx-version-min=10.9 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --disable-qtkit --disable-mediactrl
Note: The
--disable-qtkit
and--disable-mediactrl
parameters are from the workarounds discussed in this wxWidgets issues ticket. -
Type the following
make
commands to install wxWidgets. The makefile will install wxWidgets in/Users/<user>/local/wx-3.1.0
:make make install
Note: You can use
-j
to increase the number of jobs and speed up the build, for examplemake -j2
ormake -j8
. See this discussion on Stackexchange.When the installation finishes, you should see the following message:
-
Create a symbolic link to the wxWidgets installation directory.
ln -s /Users/<USER>/local/wx-3.1.0/bin/wx-config /Users/<USER>/local/bin/wx-config-3
-
Change the PATH environment variable to include the
local/bin
directory. To add it permanently, edit the.profile
file in the home directory.export PATH=/Users/<USER>/local/bin:$PATH
-
Test the installation:
wx-config-3 --cflags
If the installation was successful, you should see:
-I/Users/<USER>/local/wx-3.1.0/lib/wx/include/osx_cocoa-unicode-static-3.1 -I/Users/<USER>/local/wx-3.1.0/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
-
Build each project. In the following order:
- LK
- WEX
- SolTrace 1. coretrace 2. app
The make file for each project is in the
/build_osx
directory.For example, from the
sam_dev
directory:cd lk/build_osx make cd ../../wex/build_osx make cd ../../SolTrace/coretrace/build_osx make cd ../../SolTrace/app/build_osx make
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\osx
and runSolTrace
. -
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.