Skip to content

Commit 46d6a92

Browse files
Merge remote-tracking branch 'origin/master' into github_modules
2 parents 2480f19 + 90ab329 commit 46d6a92

13 files changed

Lines changed: 176 additions & 35 deletions

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ cmake_policy(SET CMP0091 NEW)
66

77
project(ORE CXX)
88

9-
option(BUILD_DOC "Build documentation" ON)
9+
option(ORE_BUILD_DOC "Build documentation" ON)
10+
option(ORE_BUILD_EXAMPLES "Build examples" ON)
11+
option(ORE_BUILD_TESTS "Build test suite" ON)
12+
option(ORE_BUILD_APP "Build app" ON)
13+
option(ORE_USE_ZLIB "Use compression for boost::iostreams" ON)
1014

1115
include(CTest)
1216

@@ -18,7 +22,11 @@ add_subdirectory("QuantLib")
1822
add_subdirectory("QuantExt")
1923
add_subdirectory("OREData")
2024
add_subdirectory("OREAnalytics")
21-
add_subdirectory("App")
25+
if (ORE_BUILD_APP)
26+
add_subdirectory("App")
27+
endif()
2228

2329
# add examples testsuite
30+
if (ORE_BUILD_EXAMPLES AND ORE_BUILD_TESTS)
2431
add_test(NAME examples WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Examples COMMAND nosetests run_examples_testsuite.py)
32+
endif()

Docker/CMakeLists_ORE.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.15)
22

33
project(ORE CXX)
44

5+
option(ORE_BUILD_DOC "Build documentation" ON)
6+
option(ORE_BUILD_EXAMPLES "Build examples" ON)
7+
option(ORE_BUILD_TESTS "Build test suite" ON)
8+
option(ORE_BUILD_APP "Build app" ON)
9+
option(ORE_USE_ZLIB "Use compression for boost::iostreams" ON)
10+
511
include(CTest)
612

713
include("cmake/commonSettings.cmake")
@@ -12,9 +18,3 @@ add_subdirectory("QuantExt")
1218
add_subdirectory("OREData")
1319
add_subdirectory("OREAnalytics")
1420
add_subdirectory("App")
15-
16-
# add integration tests
17-
add_test(NAME integrationtest_bootstrap COMMAND nosetests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/IntegrationTests/Bootstrap)
18-
19-
# add regression tests
20-
add_test(NAME regressiontest_pricer WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/RegressionTests/Pricer COMMAND nosetests regression.py)

Docker/Dockerfile-ORE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN cd /ore \
2424
&& find -regex ".*\.\(sh\|in\|ac\|am\)" -exec dos2unix {} ';' \
2525
&& cp Docker/CMakeLists_ORE.txt CMakeLists.txt \
2626
&& mkdir -p build.ore && cd build.ore \
27-
&& cmake .. -DBUILD_DOC=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-mavx2" -DORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER=ON
27+
&& cmake .. -DORE_BUILD_DOC=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-mavx2" -DORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER=ON
2828

2929
WORKDIR /ore/build.ore
3030
RUN --mount=type=cache,target=/ccache/ make -j ${num_cores} \

Docker/Dockerfile-ORE-Debug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN cd /lib_src \
2323
&& find -regex ".*\.\(sh\|in\|ac\|am\)" -exec dos2unix {} ';' \
2424
&& cp Docker/CMakeLists_ORE.txt CMakeLists.txt \
2525
&& mkdir -p build.ore && cd build.ore \
26-
&& cmake .. -DBUILD_DOC=OFF -DCMAKE_BUILD_TYPE=Debug \
26+
&& cmake .. -DORE_BUILD_DOC=OFF -DCMAKE_BUILD_TYPE=Debug \
2727
&& make -j ${num_cores} \
2828
&& make install \
2929
&& cd / \

OREAnalytics/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ if(MSVC)
1616
add_compile_definitions(BOOST_IOSTREAMS_NO_LIB)
1717
endif()
1818

19-
find_package(ZLIB REQUIRED)
19+
if(ORE_USE_ZLIB)
20+
find_package(ZLIB REQUIRED)
21+
endif()
2022

21-
find_package (Boost REQUIRED COMPONENTS unit_test_framework regex date_time thread serialization system filesystem timer iostreams OPTIONAL_COMPONENTS chrono)
23+
if (ORE_BUILD_TESTS)
24+
SET(COMPONENTS_CONDITIONAL "unit_test_framework")
25+
else()
26+
SET(COMPONENTS_CONDITIONAL "")
27+
endif()
28+
find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} regex date_time thread serialization system filesystem timer iostreams OPTIONAL_COMPONENTS chrono)
2229
if (ORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER AND UNIX AND NOT APPLE)
2330
find_library(RT_LIBRARY rt REQUIRED)
2431
endif()
@@ -39,5 +46,9 @@ add_link_directory_if_exists("${CMAKE_BINARY_DIR}/QuantExt/qle")
3946
add_link_directory_if_exists("${CMAKE_BINARY_DIR}/OREData/ored")
4047

4148
add_subdirectory("orea")
42-
add_subdirectory("doc")
43-
add_subdirectory("test")
49+
if (ORE_BUILD_DOC)
50+
add_subdirectory("doc")
51+
endif()
52+
if (ORE_BUILD_TESTS)
53+
add_subdirectory("test")
54+
endif()

OREAnalytics/doc/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# first we can indicate the documentation build as an option and set it to ON by default
2-
#option(BUILD_DOC "Build documentation" ON)
2+
#option(ORE_BUILD_DOC "Build documentation" ON)
33

44
# check if Doxygen is installed
55
find_package(Doxygen)
6-
if (DOXYGEN_FOUND AND BUILD_DOC)
6+
if (DOXYGEN_FOUND AND ORE_BUILD_DOC)
77
# set input and output files
88
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/orea.doxy)
99
set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
@@ -18,6 +18,6 @@ if (DOXYGEN_FOUND AND BUILD_DOC)
1818
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
1919
COMMENT "Generating API documentation with Doxygen"
2020
VERBATIM )
21-
else (DOXYGEN_FOUND AND BUILD_DOC)
21+
else (DOXYGEN_FOUND AND ORE_BUILD_DOC)
2222
message("Doxygen need to be installed to generate the doxygen documentation")
23-
endif (DOXYGEN_FOUND AND BUILD_DOC)
23+
endif (DOXYGEN_FOUND AND ORE_BUILD_DOC)

OREAnalytics/orea/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ target_link_libraries(${OREA_LIB_NAME} ${QL_LIB_NAME})
175175
target_link_libraries(${OREA_LIB_NAME} ${QLE_LIB_NAME})
176176
target_link_libraries(${OREA_LIB_NAME} ${ORED_LIB_NAME})
177177
target_link_libraries(${OREA_LIB_NAME} ${Boost_LIBRARIES})
178-
target_link_libraries(${OREA_LIB_NAME} ZLIB::ZLIB)
178+
if(ZLIB_FOUND)
179+
target_link_libraries(${OREA_LIB_NAME} ZLIB::ZLIB)
180+
add_definitions(-DORE_USE_ZLIB)
181+
endif()
179182

180183
install(DIRECTORY . DESTINATION include/orea
181184
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")

OREAnalytics/orea/cube/cube_io.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
#include <boost/filesystem.hpp>
2525
#include <boost/iostreams/device/file_descriptor.hpp>
26+
#ifdef ORE_USE_ZLIB
2627
#include <boost/iostreams/filter/gzip.hpp>
28+
#endif
2729
#include <boost/iostreams/filtering_stream.hpp>
2830

2931
#include <iomanip>
@@ -34,11 +36,14 @@ namespace analytics {
3436
namespace {
3537

3638
bool use_compression(const std::string& filename) {
37-
39+
#ifdef ORE_USE_ZLIB
3840
// assume compression for all filenames that do not end with csv or txt
3941

4042
std::string extension = boost::filesystem::path(filename).extension().string();
4143
return extension != ".csv" && extension != ".txt";
44+
#else
45+
return false;
46+
#endif
4247
}
4348

4449
std::string getMetaData(const std::string& line, const std::string& tag) {
@@ -61,8 +66,10 @@ boost::shared_ptr<NPVCube> loadCube(const std::string& filename, const bool doub
6166
bool gzip = use_compression(filename);
6267
std::ifstream in1(filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
6368
boost::iostreams::filtering_stream<boost::iostreams::input> in;
69+
#ifdef ORE_USE_ZLIB
6470
if (gzip)
6571
in.push(boost::iostreams::gzip_decompressor());
72+
#endif
6673
in.push(in1);
6774

6875
// read meta data
@@ -142,8 +149,10 @@ void saveCube(const std::string& filename, const NPVCube& cube, const bool doubl
142149
bool gzip = use_compression(filename);
143150
std::ofstream out1(filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
144151
boost::iostreams::filtering_stream<boost::iostreams::output> out;
152+
#ifdef ORE_USE_ZLIB
145153
if (gzip)
146154
out.push(boost::iostreams::gzip_compressor(/*boost::iostreams::gzip_params(9)*/));
155+
#endif
147156
out.push(out1);
148157

149158
// write meta data (tag width is hardcoded and used in getMetaData())
@@ -195,8 +204,10 @@ boost::shared_ptr<AggregationScenarioData> loadAggregationScenarioData(const std
195204
bool gzip = use_compression(filename);
196205
std::ifstream in1(filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
197206
boost::iostreams::filtering_stream<boost::iostreams::input> in;
207+
#ifdef ORE_USE_ZLIB
198208
if (gzip)
199209
in.push(boost::iostreams::gzip_decompressor());
210+
#endif
200211
in.push(in1);
201212

202213
// read meta data
@@ -261,8 +272,10 @@ void saveAggregationScenarioData(const std::string& filename, const AggregationS
261272
bool gzip = use_compression(filename);
262273
std::ofstream out1(filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
263274
boost::iostreams::filtering_stream<boost::iostreams::output> out;
275+
#ifdef ORE_USE_ZLIB
264276
if (gzip)
265277
out.push(boost::iostreams::gzip_compressor(/*boost::iostreams::gzip_params(9)*/));
278+
#endif
266279
out.push(out1);
267280

268281
// write meta data (tag width is hardcoded and used in getMetaData())

OREData/CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ get_library_name("OREData" ORED_LIB_NAME)
1111
get_library_name("QuantExt" QLE_LIB_NAME)
1212
set_ql_library_name()
1313

14-
find_package (Boost REQUIRED COMPONENTS unit_test_framework regex system date_time serialization filesystem timer OPTIONAL_COMPONENTS chrono)
14+
if (ORE_BUILD_TESTS)
15+
SET(COMPONENTS_CONDITIONAL "unit_test_framework")
16+
else()
17+
SET(COMPONENTS_CONDITIONAL "")
18+
endif()
19+
find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} regex system date_time serialization filesystem timer OPTIONAL_COMPONENTS chrono)
1520

1621
include_directories(${Boost_INCLUDE_DIRS})
1722
include_directories(${QUANTLIB_SOURCE_DIR})
@@ -26,5 +31,9 @@ add_link_directory_if_exists("${CMAKE_BINARY_DIR}/QuantLib/ql")
2631
add_link_directory_if_exists("${CMAKE_BINARY_DIR}/QuantExt/qle")
2732

2833
add_subdirectory("ored")
29-
add_subdirectory("doc")
30-
add_subdirectory("test")
34+
if (ORE_BUILD_DOC)
35+
add_subdirectory("doc")
36+
endif()
37+
if (ORE_BUILD_TESTS)
38+
add_subdirectory("test")
39+
endif()

OREData/doc/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# first we can indicate the documentation build as an option and set it to ON by default
2-
# option(BUILD_DOC "Build documentation" ON)
2+
# option(ORE_BUILD_DOC "Build documentation" ON)
33

44
# check if Doxygen is installed
55
find_package(Doxygen)
6-
if (DOXYGEN_FOUND AND BUILD_DOC)
6+
if (DOXYGEN_FOUND AND ORE_BUILD_DOC)
77
# set input and output files
88
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/ored.doxy)
99
set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
@@ -18,6 +18,6 @@ if (DOXYGEN_FOUND AND BUILD_DOC)
1818
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
1919
COMMENT "Generating API documentation with Doxygen"
2020
VERBATIM )
21-
else (DOXYGEN_FOUND AND BUILD_DOC)
21+
else (DOXYGEN_FOUND AND ORE_BUILD_DOC)
2222
message("Doxygen need to be installed to generate the doxygen documentation")
23-
endif (DOXYGEN_FOUND AND BUILD_DOC)
23+
endif (DOXYGEN_FOUND AND ORE_BUILD_DOC)

0 commit comments

Comments
 (0)