Skip to content

Commit

Permalink
Merge pull request #977.
Browse files Browse the repository at this point in the history
cmake - add header files to generated projects
  • Loading branch information
lballabio committed Jan 29, 2021
2 parents d0fc243 + 1cc9a65 commit a44b404
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 16 deletions.
5 changes: 2 additions & 3 deletions ql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2290,10 +2290,10 @@ if(WIN32)
# Windows needs to link static library (nothing is declared to export in QuantLib)
message(FATAL_ERROR "You should build QuantLib in STATIC mode as nothing is exported from the library. Use BUILD_SHARED_LIBS=OFF")
endif()
add_library(${QL_OUTPUT_NAME} ${QuantLib_SRC})
add_library(${QL_OUTPUT_NAME} ${QuantLib_SRC} ${QuantLib_HDR})
set_property(TARGET ${QL_OUTPUT_NAME} PROPERTY PROJECT_LABEL "QuantLib")
else()
add_library(${QL_OUTPUT_NAME} ${QuantLib_SRC})
add_library(${QL_OUTPUT_NAME} ${QuantLib_SRC} ${QuantLib_HDR})
endif()
set(QL_LINK_LIBRARY ${QL_OUTPUT_NAME} PARENT_SCOPE)

Expand All @@ -2307,4 +2307,3 @@ install(TARGETS ${QL_OUTPUT_NAME}
LIBRARY DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

197 changes: 191 additions & 6 deletions test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,196 @@ set(QuantLib-Test_SRC
zabr.cpp
)

set(BENCHMARK_FILES "main.cpp" "quantlibbenchmark.cpp" "americanoption.cpp" "asianoptions.cpp" "barrieroption.cpp"
"basketoption.cpp" "batesmodel.cpp" "convertiblebonds.cpp" "digitaloption.cpp" "dividendoption.cpp"
"europeanoption.cpp" "fdheston.cpp" "hestonmodel.cpp" "interpolations.cpp" "jumpdiffusion.cpp"
"marketmodel_smm.cpp" "marketmodel_cms.cpp" "lowdiscrepancysequences.cpp" "quantooption.cpp" "riskstats.cpp"
"shortratemodels.cpp" "utilities.cpp" "utilities.hpp" "swaptionvolstructuresutilities.hpp")
# hpp files, this list is maintained manually

set(QuantLib-Test_HDR
americanoption.hpp
amortizingbond.hpp
andreasenhugevolatilityinterpl.hpp
array.hpp
asianoptions.hpp
assetswap.hpp
autocovariances.hpp
barrieroption.hpp
basismodels.hpp
basketoption.hpp
batesmodel.hpp
bermudanswaption.hpp
binaryoption.hpp
blackdeltacalculator.hpp
blackformula.hpp
bonds.hpp
brownianbridge.hpp
businessdayconventions.hpp
calendars.hpp
callablebonds.hpp
capfloor.hpp
capflooredcoupon.hpp
cashflows.hpp
catbonds.hpp
cdo.hpp
cdsoption.hpp
chooseroption.hpp
cliquetoption.hpp
cms.hpp
cmsspread.hpp
commodityunitofmeasure.hpp
compiledboostversion.hpp
compoundoption.hpp
convertiblebonds.hpp
covariance.hpp
creditdefaultswap.hpp
creditriskplus.hpp
curvestates.hpp
dates.hpp
daycounters.hpp
defaultprobabilitycurves.hpp
digitalcoupon.hpp
digitaloption.hpp
distributions.hpp
dividendoption.hpp
doublebarrieroption.hpp
doublebinaryoption.hpp
europeanoption.hpp
everestoption.hpp
exchangerate.hpp
extendedtrees.hpp
extensibleoptions.hpp
fastfouriertransform.hpp
fdcev.hpp
fdcir.hpp
fdheston.hpp
fdmlinearop.hpp
fdsabr.hpp
fittedbonddiscountcurve.hpp
forwardoption.hpp
forwardrateagreement.hpp
functions.hpp
garch.hpp
gaussianquadratures.hpp
gjrgarchmodel.hpp
gsr.hpp
hestonmodel.hpp
hestonslvmodel.hpp
himalayaoption.hpp
hybridhestonhullwhiteprocess.hpp
indexes.hpp
inflation.hpp
inflationcapfloor.hpp
inflationcapflooredcoupon.hpp
inflationcpibond.hpp
inflationcpicapfloor.hpp
inflationcpiswap.hpp
inflationvolatility.hpp
instruments.hpp
integrals.hpp
interestrates.hpp
interpolations.hpp
jumpdiffusion.hpp
lazyobject.hpp
libormarketmodel.hpp
libormarketmodelprocess.hpp
linearleastsquaresregression.hpp
lookbackoptions.hpp
lowdiscrepancysequences.hpp
margrabeoption.hpp
marketmodel.hpp
marketmodel_cms.hpp
marketmodel_smm.hpp
marketmodel_smmcapletalphacalibration.hpp
marketmodel_smmcapletcalibration.hpp
marketmodel_smmcaplethomocalibration.hpp
markovfunctional.hpp
matrices.hpp
mclongstaffschwartzengine.hpp
mersennetwister.hpp
money.hpp
noarbsabr.hpp
normalclvmodel.hpp
nthorderderivativeop.hpp
nthtodefault.hpp
numericaldifferentiation.hpp
observable.hpp
ode.hpp
operators.hpp
optimizers.hpp
optionletstripper.hpp
overnightindexedswap.hpp
pagodaoption.hpp
paralleltestrunner.hpp
partialtimebarrieroption.hpp
pathgenerator.hpp
period.hpp
piecewiseyieldcurve.hpp
piecewisezerospreadedtermstructure.hpp
quantooption.hpp
quotes.hpp
rangeaccrual.hpp
riskneutraldensitycalculator.hpp
riskstats.hpp
rngtraits.hpp
rounding.hpp
sampledcurve.hpp
schedule.hpp
shortratemodels.hpp
sofrfutures.hpp
solvers.hpp
speedlevel.hpp
spreadoption.hpp
squarerootclvmodel.hpp
stats.hpp
swap.hpp
swapforwardmappings.hpp
swaption.hpp
swaptionvolatilitycube.hpp
swaptionvolatilitymatrix.hpp
swaptionvolstructuresutilities.hpp
swingoption.hpp
termstructures.hpp
timegrid.hpp
timeseries.hpp
tqreigendecomposition.hpp
tracing.hpp
transformedgrid.hpp
twoassetbarrieroption.hpp
twoassetcorrelationoption.hpp
ultimateforwardtermstructure.hpp
utilities.hpp
variancegamma.hpp
varianceoption.hpp
varianceswaps.hpp
volatilitymodels.hpp
vpp.hpp
zabr.hpp
)

set(BENCHMARK_FILES
main.cpp
quantlibbenchmark.cpp

americanoption.cpp americanoption.hpp
asianoptions.cpp asianoptions.hpp
barrieroption.cpp barrieroption.hpp
basketoption.cpp basketoption.hpp
batesmodel.cpp batesmodel.hpp
convertiblebonds.cpp convertiblebonds.hpp
digitaloption.cpp digitaloption.hpp
dividendoption.cpp dividendoption.hpp
europeanoption.cpp europeanoption.hpp
fdheston.cpp fdheston.hpp
hestonmodel.cpp hestonmodel.hpp
interpolations.cpp interpolations.hpp
jumpdiffusion.cpp jumpdiffusion.hpp
lowdiscrepancysequences.cpp lowdiscrepancysequences.hpp
marketmodel_cms.cpp marketmodel_cms.hpp
marketmodel_smm.cpp marketmodel_smm.hpp
quantooption.cpp quantooption.hpp
riskstats.cpp riskstats.hpp
shortratemodels.cpp shortratemodels.hpp

utilities.cpp utilities.hpp
swaptionvolstructuresutilities.hpp
)

if (USE_BOOST_DYNAMIC_LIBRARIES)
add_definitions(-DBOOST_TEST_DYN_LINK)
Expand All @@ -173,7 +358,7 @@ endif()
find_package (Boost REQUIRED COMPONENTS unit_test_framework timer system OPTIONAL_COMPONENTS chrono)

set (TEST quantlib-test-suite)
add_executable (${TEST} ${QuantLib-Test_SRC})
add_executable (${TEST} ${QuantLib-Test_SRC} ${QuantLib-Test_HDR})
target_link_libraries (${TEST} ${QL_LINK_LIBRARY} ${Boost_LIBRARIES})
set_property(TARGET ${TEST} PROPERTY PROJECT_LABEL "testsuite")

Expand Down
11 changes: 4 additions & 7 deletions tools/check_filelists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ find ql -name '*.[hc]pp' -or -name '*.[hc]' \
find test-suite -name '*.[hc]pp' \
| grep -v 'quantlibbenchmark' | grep -v '/main\.cpp' \
| sort > test-suite.ref.files
find test-suite -name '*.cpp' \
| grep -v 'quantlibbenchmark' \
| sort > test-suite-cpp.ref.files

# extract file names from VC++ projects and clean up so that they
# have the same format as the reference lists.
Expand All @@ -39,14 +36,14 @@ grep -o -E 'Include=".*\.[hc]p*"' test-suite/testsuite.vcxproj.filters \
grep -o -E '[a-zA-Z0-9_/\.]*\.[hc]p*' ql/CMakeLists.txt \
| sed -e 's|^|ql/|' | sort > ql.cmake.files

grep -o -E '[a-zA-Z0-9_/\.]*\.cpp' test-suite/CMakeLists.txt \
| grep -v 'quantlibbenchmark' \
grep -o -E '[a-zA-Z0-9_/\.]*\.[hc]pp' test-suite/CMakeLists.txt \
| grep -v 'quantlibbenchmark' | grep -v 'main\.cpp' \
| sed -e 's|^|test-suite/|' | sort -u > test-suite.cmake.files

# write out differences...

diff -b ql.cmake.files ql.ref.files > ql.cmake.diff
diff -b test-suite.cmake.files test-suite-cpp.ref.files > test-suite.cmake.diff
diff -b test-suite.cmake.files test-suite.ref.files > test-suite.cmake.diff

diff -b ql.vcx.files ql.ref.files > ql.vcx.diff
diff -b test-suite.vcx.files test-suite.ref.files > test-suite.vcx.diff
Expand All @@ -59,7 +56,7 @@ diff -b test-suite.vcx.filters.files test-suite.ref.files > test-suite.vcx.filte
result=$?

# ...and cleanup
rm -f ql.*.files test-suite.*.files test-suite-cpp.ref.files
rm -f ql.*.files test-suite.*.files
rm -f ql.*.diff test-suite.*.diff

exit $result

0 comments on commit a44b404

Please sign in to comment.