Skip to content

Commit

Permalink
Fix windows vc 2022 compatibility (close #122)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoPeng committed Aug 31, 2024
1 parent 2a14016 commit 3d1b4d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,15 @@ def replaceIntHeader(file):
if os.path.isdir(conda_lib):
common_extra_include_dirs.append(os.path.join(conda_lib, 'include'))
common_library_dirs.append(os.path.join(conda_lib, 'lib'))
for conda_var in ('CONDA_PREFIX', 'CONDA_PREFIX_1'):
if conda_var in os.environ:
conda_lib = os.path.join(os.environ[conda_var], 'Library')
if os.path.isdir(conda_lib):
common_extra_include_dirs.append(os.path.join(conda_lib, 'include'))
common_library_dirs.append(os.path.join(conda_lib, 'lib'))

# msvc does not have O3 option, /GR is to fix a C4541 warning

# /EHsc is for VC exception handling,
# /wd4819 disables warning messages for non-unicode character in boost/uitlity/enable_if.hpp
# /wd4996 disables warning messages for unsafe function call in boost/serialization
Expand Down
2 changes: 1 addition & 1 deletion src/mating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ bool HeteroMating::mate(Population &pop, Population &scratch)
if (fcmp_gt(w_neg[i], 0.))
{
// issue 114, allow parental subpopulation to be larger than offspring subpopulation.
vspSize[i] = std::min(all, static_cast<ULONG>(parentSize[i] * w_neg[i]));
vspSize[i] = std::min(all, static_cast<size_t>(parentSize[i] * w_neg[i]));
all -= vspSize[i];
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@

extern "C" {
#include "Python.h"

#ifdef _MSC_VER
typedef SSIZE_T ssize_t;
#endif
}

#include "simuPOP_cfg.h"
Expand Down

0 comments on commit 3d1b4d3

Please sign in to comment.