|
| 1 | +.. _DevelopmentSetup: |
| 2 | + |
| 3 | +Environment: Visual Studio |
| 4 | +########################## |
| 5 | + |
| 6 | +In the Visual Studio environment option for setting up FLINT.example, the options to run, develop and debug the repository code is available. |
| 7 | +Also make sure you have the following prerequisites setup - |
| 8 | + |
| 9 | +Prerequisites |
| 10 | +------------- |
| 11 | +* `Cmake <../prerequisites/cmake.html>`_ |
| 12 | +* `Visual Studio <../prerequisites/visual_studio.html>`_ |
| 13 | +* `Docker <../prerequisites/docker.html>`_ |
| 14 | + |
| 15 | +Now that you have all the necessary prerequisites, you can proceed with the Installation. |
| 16 | + |
| 17 | +Using vcpkg to install required libraries |
| 18 | +----------------------------------------- |
| 19 | + |
| 20 | +Start a command shell in the Vcpkg repository folder (that you had cloned earlier) and use the following commands: |
| 21 | + |
| 22 | +:: |
| 23 | + |
| 24 | + # bootstrap |
| 25 | + bootstrap-vcpkg.bat |
| 26 | + |
| 27 | + # install packages |
| 28 | + vcpkg.exe install boost-test:x64-windows boost-program-options:x64-windows boost-log:x64-windows turtle:x64-windows zipper:x64-windows poco:x64-windows libpq:x64-windows gdal:x64-windows sqlite3:x64-windows boost-ublas:x64-windows |
| 29 | + |
| 30 | +Building the project |
| 31 | +-------------------- |
| 32 | + |
| 33 | +Launch the Windows Powershell and run the following commands: |
| 34 | + |
| 35 | +:: |
| 36 | + |
| 37 | + # Create a build folder under the Source folder |
| 38 | + mkdir -p Source\build |
| 39 | + cd Source\build |
| 40 | + |
| 41 | +Now depending on which type of simulation you want to execute, you may run one of the following generate commands: |
| 42 | + |
| 43 | +Commands to run cmake for the point simulations: |
| 44 | + |
| 45 | +:: |
| 46 | + |
| 47 | + # Point simulations |
| 48 | + # Generate the project files |
| 49 | + cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=C:\Development\Software\moja -DVCPKG_TARGET_TRIPLET=x64-windows -DOPENSSL_ROOT_DIR=c:\Development\moja-global\vcpkg\installed\x64-windows -DENABLE_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=c:\Development\moja-global\vcpkg\scripts\buildsystems\vcpkg.cmake .. |
| 50 | + |
| 51 | +Commands to run cmake for the spatial simulations: |
| 52 | + |
| 53 | +:: |
| 54 | + |
| 55 | + # Spatial simulations |
| 56 | + # if your planning to run spatial chapman richards example you also need to enable the gdal module |
| 57 | + # Generate the project files |
| 58 | + cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=C:\Development\Software\moja -DVCPKG_TARGET_TRIPLET=x64-windows -DOPENSSL_ROOT_DIR=c:\Development\moja-global\vcpkg\installed\x64-windows -DENABLE_TESTS=OFF -DENABLE_MOJA.MODULES.GDAL=ON -DCMAKE_TOOLCHAIN_FILE=c:\Development\moja-global\vcpkg\scripts\buildsystems\vcpkg.cmake .. |
| 59 | + |
| 60 | + |
| 61 | +Running the project |
| 62 | +------------------- |
| 63 | + |
| 64 | +Running in the IDE and debugging is a little tricky. This could more than likely be resolved with better cmake setups. But for now there is some setup that can make running and debugging work. |
| 65 | + |
| 66 | +The issue is we want to run with the ``moja.cli.exe`` from the moja.FLINT project, but debug in our current IDE (FLINT.example). |
| 67 | + |
| 68 | +The solution is to use properties to setup a Debug run in the IDE, making the command run ``moja.cli.exe``. |
| 69 | + |
| 70 | +**NOTE** : All paths used below with ``C:\Development\moja-global`` will need to be modified to match your system build location of the moja project. |
| 71 | + |
| 72 | +Test Module Example |
| 73 | +=================== |
| 74 | +The settings required in VS2019 are: |
| 75 | + |
| 76 | +:: |
| 77 | + |
| 78 | + # Command |
| 79 | + C:\Development\moja-global\FLINT\Source\build\bin\$(Configuration)\moja.cli.exe |
| 80 | + |
| 81 | + # Command Args |
| 82 | + --config config\point_example.json --config config\$(Configuration)\libs.base.win.json --logging_config logging.debug_on.conf |
| 83 | + |
| 84 | + # Working Directory |
| 85 | + $(SolutionDir)\..\..\Run_Env |
| 86 | + |
| 87 | + # Environment Debug |
| 88 | + PATH=C:\Development\moja-global\vcpkg\installed\x64-windows\debug\bin;C:\Development\moja-global\FLINT\Source\build\bin\$(Configuration);%PATH% |
| 89 | + LOCAL_LIBS=$(OutDir) |
| 90 | + MOJA_LIBS=C:\Development\moja-global\FLINT\Source\build\bin\$(Configuration) |
| 91 | + |
| 92 | + # Environment Release |
| 93 | + PATH=C:\Development\moja-global\vcpkg\installed\x64-windows\bin;C:\Development\moja-global\FLINT\Source\build\bin\$(Configuration);%PATH% |
| 94 | + LOCAL_LIBS=$(OutDir) |
| 95 | + MOJA_LIBS=C:\Development\moja-global\FLINT\Source\build\bin\$(Configuration) |
| 96 | + |
| 97 | +**With Envs**: ``PATH`` for various libraries built in the Moja stage and ``LOCAL_LIBS`` so we can modify the explicit path for our example config to load libraries from this vs build (the default is the same location as the EXE). |
| 98 | + |
| 99 | +To match this, the example point config uses an environment variable in the library path: |
| 100 | + |
| 101 | +:: |
| 102 | + |
| 103 | + { |
| 104 | + "Libraries": { |
| 105 | + "moja.flint.example.base": { |
| 106 | + "library": "moja.flint.example.based.dll", |
| 107 | + "path": "%LOCAL_LIBS%", |
| 108 | + "type": "external" |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | +RothC example |
| 114 | +============= |
| 115 | +We also have a RothC example for point level simulations. Inorder to run this example, you may modify the following arguments in the above test settings command arguments. |
| 116 | +These arguments will point at the right configuration files for RothC. |
| 117 | + |
| 118 | +:: |
| 119 | + |
| 120 | + # Command Args |
| 121 | + --config config/point_rothc_example.json --config config/$(Configuration)/libs.base_rothc.win.json --logging_config logging.debug_on.conf |
| 122 | + |
| 123 | +Chapman Richards example |
| 124 | +======================== |
| 125 | +Based on the moja global repository `Chapman Richards <https://github.com/moja-global/FLINT.chapman_richards>`_ , this sample can be run on both point and spatial versions (over Dominica). |
| 126 | +Inorder to run this example, you may modify the following arguments in the above test settings command arguments. |
| 127 | +These arguments will point at the right configuration files for Chapman Richards. |
| 128 | + |
| 129 | +:: |
| 130 | + |
| 131 | + |
| 132 | + # Command Args |
| 133 | + # Point |
| 134 | + --config config/point_forest_config.json --config config/$(Configuration)/libs.gdal.chaprich.win.json |
| 135 | + # Spatial |
| 136 | + --config config/forest_config.json --config config/$(Configuration)/libs.gdal.chaprich.win.json --config_provider config/forest_provider.json |
0 commit comments