Skip to content

Commit b2f0ba5

Browse files
committed
Modern builds with fewer build warnings
Build: "pipx run build"
1 parent fd08648 commit b2f0ba5

5 files changed

Lines changed: 68 additions & 83 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project(cCOSMO)
2-
cmake_minimum_required(VERSION 3.10)
2+
cmake_minimum_required(VERSION 3.17)
33

44
# Set the C++ standard to C++17
55
set (CMAKE_CXX_STANDARD 17)

include/COSMO_SAC/COSMO.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace COSMOSAC {
4343
CombinatorialConstants m_comb_consts;
4444
public:
4545
AbstractCOSMOModel(const ProfileDatabase &db, const std::vector<std::string> &identifiers) : datadb(db), m_fluids(build_fluids(identifiers)) {};
46+
virtual ~AbstractCOSMOModel() = default;
4647

4748
std::tuple<Eigen::Index, Eigen::Index> get_nonzero_bounds(){
4849
// Determine the range of entries in p(sigma) that are greater than zero, we
@@ -51,8 +52,8 @@ namespace COSMOSAC {
5152
for (auto i = 0; i < m_fluids.size(); ++i) {
5253
const EigenArray psigma = m_fluids[i].profiles.nhb.psigma(m_fluids[i].A_COSMO_A2);
5354
Eigen::Index ileft = 0, iright = psigma.size();
54-
for (auto ii = 0; ii < psigma.size(); ++ii) { if (std::abs(psigma(ii) > 1e-16)) { ileft = ii; break; } }
55-
for (auto ii = psigma.size() - 1; ii > ileft; --ii) { if (std::abs(psigma(ii) > 1e-16)) { iright = ii; break; } }
55+
for (auto ii = 0; ii < psigma.size(); ++ii) { if (std::abs(psigma(ii)) > 1e-16) { ileft = ii; break; } }
56+
for (auto ii = psigma.size() - 1; ii > ileft; --ii) { if (std::abs(psigma(ii)) > 1e-16) { iright = ii; break; } }
5657
if (ileft < min_ileft) { min_ileft = ileft; }
5758
if (iright > max_iright) { max_iright = iright; }
5859
}

include/COSMO_SAC/util.hpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,22 @@ static std::vector<std::string> str_split(const std::string &s,
7171
return o;
7272
}
7373

74-
/// The following code for the trim functions was taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
75-
// trim from start
76-
static std::string& strlstrip(std::string& s) {
77-
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isspace(c); }));
78-
return s;
74+
75+
76+
// From https://stackoverflow.com/a/20262860
77+
static std::string& strlstrip(std::string& str) {
78+
size_t start = str.find_first_not_of( " \n\r\t" );
79+
if ( start != std::string::npos )
80+
str = str.substr( start );
81+
return str;
7982
}
8083

81-
// trim from end
82-
static std::string& strrstrip(std::string& s) {
83-
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char c) { return !std::isspace(c); }).base(), s.end());
84-
return s;
84+
// From https://stackoverflow.com/a/20262860
85+
static std::string& strrstrip(std::string& str) {
86+
size_t end = str.find_last_not_of( " \n\r\t" );
87+
if ( end != std::string::npos )
88+
str.resize( end + 1 );
89+
return str;
8590
}
8691

8792
// trim from both ends

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[[tool.cibuildwheel.overrides]]
2+
select = "*-musllinux*"
3+
before-all = "apk add clang"
4+
environment = { CXX="clang++" }
5+
6+
[build-system]
7+
requires = ["scikit-build-core >=0.4.3", "pybind11 >=2.13", "typing_extensions"]
8+
build-backend = "scikit_build_core.build"
9+
10+
[project]
11+
name = "cCOSMO"
12+
version = "1.0.2"
13+
description = "C++ implementation of COSMO-SAC variants"
14+
readme = "README.md"
15+
requires-python = ">=3.8"
16+
authors = [
17+
{ name = "Ian Bell", email = "ian.bell@nist.gov" },
18+
]
19+
#classifiers = [
20+
# "License :: BSD",
21+
#]
22+
23+
[project.urls]
24+
Homepage = "https://github.com/usnistgov/COSMOSAC"
25+
26+
[tool.scikit-build]
27+
# Protect the configuration against future changes in scikit-build-core
28+
minimum-version = "0.10"
29+
30+
# Setuptools-style build caching in a local directory
31+
build-dir = "build/{wheel_tag}"
32+
33+
# The package to be built is that in the teqp folder
34+
# wheel.packages = ["teqp"]
35+
build.targets = ["cCOSMO"]
36+
37+
# Build stable ABI wheels for CPython 3.12+
38+
# wheel.py-api = "cp312"
39+
40+
wheel.license-files = ["LICENSE.md"]
41+
42+
43+
#### Additional options for debugging
44+
# cmake.verbose = true
45+
# cmake.build-type = "Debug"
46+
# cmake.args = ["-G Xcode", "-DXCODE_DEBUG_PYTHON=ON"]
47+
# cmake.args = ["-DVERBOSE=ON"]
48+
49+
[tool.cibuildwheel]
50+
build-verbosity = 1

setup.py

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)