Loading...
Home / Reply To: Getting started

Home Forums General Getting started Reply To: Getting started

#7173
forde
Participant

For those on macOS, a few tips for installation in case they are of use. I use a bash script to install including the below. Let me know if you find a better way.

1. For problems finding boost:
`bash
export BOOST_LIB=$(brew –prefix boost)/lib
export BOOST_INC=$(brew –prefix boost)/include
`

2. For errors and warnings that stop the build…I find that
`bash
cmake -DBOOST_ROOT=$BOOST_INC -DBOOST_LIBRARYDIR=$BOOST_LIB -DCMAKE_CXX_FLAGS=”-Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-unused-private-field -Wno-unused-but-set-variable” ..
`
..will not work, so I add the following to the CMakeLists.txt at ./, ./OREData, /Quantlib, ./QuantExt, ./OREAnalytics

`bash
add_compile_options(
“-Wno-error=unused-variable”
“-Wno-error=unused-but-set-variable”
“-Wno-unused-private-field”
“-Wno-unused-but-set-variable”
)
`
..before a target is set.

e.g.
`bash
# Define the directories
dirs=(“<path_to_ore>/” “<path_to_ore>/OREData” “<path_to_ore>/Quantlib” “<path_to_ore>/QuantExt” “<path_to_ore>/OREAnalytics”)

# Define the string to be inserted
insert_str=$’add_compile_options(\n “-Wno-error=unused-variable”\n “-Wno-error=unused-but-set-variable”\n “-Wno-unused-private-field”\n “-Wno-unused-but-set-variable”\n)\n’

# For each directory
for dir in “${dirs[@]}”; do
# Define the CMakeLists.txt file path
file=”${dir}/CMakeLists.txt”

# If the file exists
if [[ -f “$file” ]]; then
# Create a backup of the original file
cp “$file” “$file.bak”

# Create a temporary file
temp_file=$(mktemp)

# Read the file line by line
awk -v insert_str=”$insert_str” ‘NR==1{print; print insert_str; next} 1’ “$file” > “$temp_file” && mv “$temp_file” “$file”
else
echo “File $file does not exist”
fi
done
`

3. Amend the cmake commonSettings.cmake to allow for parallel unit test runner

`bash
# Define the path to the file
FILE=”<path_to_ore>/cmake/commonSettings.cmake”

# Use sed to find and replace the text
sed -i ” ‘s/option(ORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER “Enable the parallel unit test runner” OFF)/option(ORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER “Enable the parallel unit test runner” ON)/g’ $FILE
`

4. To remove errors each build (just an annoyance), update Doxygen files

`bash
# An array of directories containing Doxyfiles that need to be updated
directories=(
“<path_to_ore>/OREData/doc”
“<path_to_ore>/QuantExt/doc”
“<path_to_ore>/OREAnalytics/doc”
)

# Loop over the directories
for dir in “${directories[@]}”
do
# Navigate to the directory
cd “$dir”

# Update the Doxyfile
doxygen -u Doxyfile
done
`

5. Update .doxy file to fix DOT_GRAPH_MAX_NODES too low error:

`bash
# Specify files
FILES=(
“<path_to_ore>/OREAnalytics/doc/orea.doxy”
“<path_to_ore>/OREData/doc/ored.doxy”
“<path_to_ore>/QuantExt/doc/quantext.doxy”
“<path_to_ore>/QuantLib/Docs/quantlib.doxy”
)

# Loop over files and update each one
for file in ${FILES[@]}; do
if [ -f “$file” ]; then
# Backup original file
cp “$file” “$file.bak”

# Update DOT_GRAPH_MAX_NODES value
sed -i ” ‘s/DOT_GRAPH_MAX_NODES = [0-9]\+/DOT_GRAPH_MAX_NODES = 100/g’ “$file”
echo “Updated $file”
else
echo “File not found: $file”
fi
done
`


Sign up to hear about the latest ORE developments