Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SRI-CSL/libpoly
Browse files Browse the repository at this point in the history
  • Loading branch information
ianamason committed Apr 12, 2021
2 parents 1f52c78 + a0873c8 commit 0e41e05
Show file tree
Hide file tree
Showing 5 changed files with 1,046 additions and 445 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ env:
# iam: the precise versions are need, so we know whether we have to install
# or just choose. I picked these, because only 2.7.15 and 3.6.7 needs to be built (on osx).
# the linux image has these versions already.
- CMAKE_BUILD_TYPE=Debug PYTHON=2.7.15
# iam: i remove the 2.7.15 because its no longer a going concern.
# - CMAKE_BUILD_TYPE=Debug PYTHON=2.7.15
- CMAKE_BUILD_TYPE=Debug PYTHON=3.6.7
- CMAKE_BUILD_TYPE=Release PYTHON=2.7.15
# - CMAKE_BUILD_TYPE=Release PYTHON=2.7.15
- CMAKE_BUILD_TYPE=Release PYTHON=3.6.7

install:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ For example, to use Python3 you can configure the project with
cmake .. -DPython_ADDITIONAL_VERSIONS=3
```

### Python Version Skew

On some platforms (i.e. Mac) cmake picks different python installations for the headers and library. If this happens,
you might try:
```cmake
cmake .. -DCMAKE_BUILD_TYPE=$type -DPYTHON_LIBRARY=$pythonlibrary -DPYTHON_INCLUDE_DIR=$pythonheaderfiledir
```
For example:
```
cmake .. -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARY=/opt/homebrew/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib -DPYTHON_INCLUDE_DIR=/opt/homebrew/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/include/python3.9/
```
## Installing Prebuilt Binaries

Currently you can install the libpoly library (without python support) either using
Expand Down
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ endif()
# Linux, FreeBSD, and old versions of Darwin (and probably other systems) don't use fPIC by default.
# We just check for Linux and FreeBSD here.
#
if(LIBPOLY_BUILD_STATIC_PIC AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if(LIBPOLY_BUILD_STATIC_PIC)
add_library(static_pic_poly STATIC ${poly_SOURCES})
set_target_properties(static_pic_poly PROPERTIES OUTPUT_NAME picpoly POSITION_INDEPENDENT_CODE true)

add_library(static_pic_polyxx STATIC ${polyxx_SOURCES})
set_target_properties(static_pic_polyxx PROPERTIES OUTPUT_NAME picpolyxx POSITION_INDEPENDENT_CODE true)
target_link_libraries(static_pic_polyxx static_pic_poly)

if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD"))
set_target_properties(static_pic_poly PROPERTIES EXCLUDE_FROM_ALL ON)
set_target_properties(static_pic_polyxx PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
endif()
4 changes: 4 additions & 0 deletions src/number/algebraic_number.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ void lp_algebraic_number_op(
integer_neg(lp_Z, &p_neg, &a->I.a.a);
dyadic_rational_get_den(&a->I.a, &q);
coefficient_construct_linear(ctx, &f_a, &q, &p_neg, var_x);
lp_integer_destruct(&p_neg);
lp_integer_destruct(&q);
}
if (trace_is_enabled("algebraic_number")) {
tracef("f_a = "); coefficient_print(ctx, &f_a, trace_out); tracef("\n");
Expand All @@ -684,6 +686,8 @@ void lp_algebraic_number_op(
integer_neg(lp_Z, &p_neg, &b->I.a.a);
dyadic_rational_get_den(&b->I.a, &q);
coefficient_construct_linear(ctx, &f_b, &q, &p_neg, var_y);
lp_integer_destruct(&p_neg);
lp_integer_destruct(&q);
}
if (trace_is_enabled("algebraic_number")) {
tracef("f_b = "); coefficient_print(ctx, &f_b, trace_out); tracef("\n");
Expand Down
Loading

0 comments on commit 0e41e05

Please sign in to comment.