Skip to content

Commit

Permalink
Merge pull request numpy#4781 from juliantaylor/cpucaps-build
Browse files Browse the repository at this point in the history
BLD: add a simple python file to build cpucaps.dll
  • Loading branch information
charris committed Jun 4, 2014
2 parents c345ee6 + 3cca518 commit 7860d2e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/win32build/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ cpuid. To build it, you have two options:
- with scons: if you have scons, just do scons install. It will build
and put the CpuCaps.dll in the plugins directory of nsis (if you
install nsis in the default path).
- run build-cpucaps.py with a windows python, e.g.
wine "C:\Python27\python" build-cpucaps.py

build.py:
---------
Expand Down
15 changes: 15 additions & 0 deletions tools/win32build/build-cpucaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import subprocess
# build cpucaps.dll
# needs to be run in tools/win32build folder under wine
# e.g. wine "C:\Python27\python" build-cpucaps.py
cc = os.environ.get('CC', 'gcc')
fmt = (cc, os.getcwd())
cmd = '"{0}" -o cpucaps_main.o -c -W -Wall "-I{1}/cpuid" "-I{1}/cpucaps" cpucaps/cpucaps_main.c'.format(*fmt)
subprocess.check_call(cmd, shell=True)
cmd = '"{0}" -o cpuid.o -c -W -Wall "-I{1}/cpuid" cpuid/cpuid.c'.format(*fmt)
subprocess.check_call(cmd, shell=True)
cmd = '"{0}" -shared -Wl,--out-implib,libcpucaps.a -o cpucaps.dll cpuid.o cpucaps_main.o'.format(*fmt)
subprocess.check_call(cmd, shell=True)
os.remove('cpuid.o')
os.remove('cpucaps_main.o')

0 comments on commit 7860d2e

Please sign in to comment.