Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preliminary windows support via some new flags #164

Merged
merged 5 commits into from
Jan 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/bindings/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import glob
import os.path
import sys

from cffi import FFI

Expand All @@ -34,6 +35,21 @@
with open(header, "r") as hfile:
ffi.cdef(hfile.read())

source = []

# SODIUM_STATIC controls the visibility of symbols in the headers. (see
# export.h in the libsodium source tree). If you do not set SODIUM_STATIC
# when linking against the static library in Windows then the compile will
# fail with no symbols found.
if os.getenv("PYNACL_SODIUM_STATIC") is not None:
source.append("#define SODIUM_STATIC")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining that what this does is cause libsodium to be a static lib... or whatever this define does?


source.append("#include <sodium.h>")

if sys.platform == "win32":
libraries = ["libsodium"]
else:
libraries = ["sodium"]

# Set our source so that we can actually build our bindings to sodium.
ffi.set_source("_sodium", "#include <sodium.h>", libraries=["sodium"])
ffi.set_source("_sodium", "\n".join(source), libraries=libraries)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ deps =
pytest
coverage
pretend
passenv = SODIUM_INSTALL PYNACL_SODIUM_STATIC LIB INCLUDE
commands =
coverage run --source nacl --branch -m pytest
coverage report -m
Expand Down