Skip to content

Commit

Permalink
Install filters correctly
Browse files Browse the repository at this point in the history
Changes motivated by packaging the library for Anaconda
  • Loading branch information
robertodr committed Dec 3, 2019
1 parent dc2ec19 commit 2dd3995
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ venv
*.includes

.direnv/
.ccls-cache/
2 changes: 1 addition & 1 deletion cmake/MRCPPConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ check_required_components(${PN})
if(NOT TARGET ${PN}::mrcpp)
get_filename_component(_fext ${${PN}_LIBRARY} EXT)
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")

find_package(Eigen3 3.3 CONFIG REQUIRED)
if(TARGET Eigen3::Eigen)
message(STATUS "Using Eigen3: ${EIGEN3_ROOT_DIR} (version ${Eigen3_VERSION})")
Expand Down
4 changes: 2 additions & 2 deletions cmake/custom/mw_filters.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(MW_FILTER_SOURCE_DIR "${PROJECT_SOURCE_DIR}/share/mwfilters" CACHE STRING "Path to MW filters and cross-correlation coefs")
set(MW_FILTER_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/mwfilters)
install(
DIRECTORY ${MW_FILTER_DIR}
DESTINATION share/${PROJECT_NAME}/mwfilters
DIRECTORY share/mwfilters
DESTINATION share/${PROJECT_NAME}
)
8 changes: 5 additions & 3 deletions src/core/CrossCorrelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ CrossCorrelation::CrossCorrelation(int k, int t)
MSG_ERROR("Unknown filter type: " << this->type);
}

for (auto n : filter_lib_locations) {
if (details::directory_exists(n)) setCCCPaths(n);
break;
for (auto n : {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR}) {
if (details::directory_exists(n)) {
setCCCPaths(n);
break;
}
}

readCCCBin();
Expand Down
1 change: 0 additions & 1 deletion src/core/CrossCorrelation.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class CrossCorrelation final {

std::string L_path;
std::string R_path;
std::vector<std::string> filter_lib_locations = {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR};
};

} // namespace mrcpp
8 changes: 5 additions & 3 deletions src/core/MWFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ MWFilter::MWFilter(int k, int t)
MSG_ERROR("Unknown filter type: " << this->type);
}

for (auto n : filter_lib_locations) {
if (details::directory_exists(n)) setFilterPaths(n);
break;
for (auto n : {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR}) {
if (details::directory_exists(n)) {
setFilterPaths(n);
break;
}
}

generateBlocks();
Expand Down
1 change: 0 additions & 1 deletion src/core/MWFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class MWFilter final {

std::string H_path;
std::string G_path;
std::vector<std::string> filter_lib_locations = {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR};
};

} // namespace mrcpp
6 changes: 4 additions & 2 deletions src/treebuilders/BSCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ void BSCalculator::readSMatrix(const ScalingBasis &basis, char n) {
std::string file;
std::string path;
for (auto l : {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR}) {
if (details::directory_exists(l)) path = l;
break;
if (details::directory_exists(l)) {
path = l;
break;
}
}

if (basis.getScalingType() == Legendre) file = path + "/L_b-spline-deriv" + n + ".txt";
Expand Down
6 changes: 4 additions & 2 deletions src/treebuilders/PHCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ void PHCalculator::readSMatrix(const ScalingBasis &basis, char n) {
std::string file;
std::string path;
for (auto l : {MW_FILTER_SOURCE_DIR, MW_FILTER_INSTALL_DIR}) {
if (details::directory_exists(l)) path = l;
break;
if (details::directory_exists(l)) {
path = l;
break;
}
}
if (basis.getScalingType() == Legendre) file = path + "/L_ph_deriv_" + n + ".txt";
if (basis.getScalingType() == Interpol) file = path + "/I_ph_deriv_" + n + ".txt";
Expand Down

0 comments on commit 2dd3995

Please sign in to comment.