MacOS Create and Debug Model using Xcode - openmpp/openmpp.github.io GitHub Wiki
- Download: latest binary files and source code
- Documentation:
- Tested on: latest MacOS, may work starting from Big Sur >= 11.1.
- Install Xcode and command line developer tools, if not installed already by Xcode:
xcode-select --install
. - Check if clang, make and sqlite3 are installed on your computer:
g++ --version
....
Apple clang version 11.0.0 (clang-1100.0.33.12)
make --version
....
GNU Make 3.81
sqlite3 --version
....
3.28.0 2019-04-15 14:49:49
- Download and unpack latest openM++ release using Safari or curl:
curl -L -o om.tar.gz https://github.com/openmpp/main/releases/download/v1.6.0/openmpp_mac_20200621.tar.gz
tar xzf om.tar.gz
Copy model Xcode project files into your new "MyModel" directory, for example:
cd ~/openmpp_mac_20200621
cp -pr Xcode/Model.* models/MyModel/
Start Xcode and open ~/openmpp_mac_20200621/models/MyModel/Model.xcworkspace
:
Rename model Project -> Targets -> click twice on target name -> and rename to MyModel
Rename model scheme using menu: Product -> Scheme -> Manage Schemes... -> click twice on "Model" scheme -> and rename to MyModel
Add your model source code from MyModel/code
folder:
Make sure your model scheme selected by using menu: Product -> Scheme -> MyModel:
Build your model:
(Optional) Build the model with multiple scenarios:
- edit
Xcode-src/Model.xcconfig
and to specify additional scenario names and input directories, separated by comma. For example: SCENARIO_NAME = Default,Other
OMC_SCENARIO_PARAM_DIR = $(SRCROOT)/parameters/Default,$(SRCROOT)/parameters/SomeOther
Start Xcode and open your model workspace, for example: ~/openmpp_mac_20200621/models/MyModel/Model.xcworkspace
Use menu to select your model scheme: Product -> Scheme -> MyModel:
Known issue: Xcode UI may not update check mark on selected scheme. To fix it go to Product -> Scheme -> Manage Schemes... and use mouse to drag any scheme to move it up or down.
(Optional) If you want to set breakpoints in any*.mpp or *.ompp files then tell to Xcode it is "C++ Source" file(s):
Run and debug your openM++ model:
To inspect model parameters go to Debug Area and Add Expression:
To start model UI after build completed please change Model.xcconfig
variable START_OMPP_UI
to "1" or "true" or "yes" (case-sensitive)