Skip to content

Commit

Permalink
Improved build scripts for Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
gotthardp committed Feb 10, 2018
1 parent 360a7fa commit 58fd615
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.vs
build
dist
*.egg-info
mercuryapi-*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APIVER ?= 1.29.2.10
APIVER ?= 1.29.4.34
PYTHON ?= $(shell { command -v python3 || command -v python; } 2>/dev/null)

.PHONY: all mercuryapi install
Expand Down
33 changes: 33 additions & 0 deletions mercuryapi.pyproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{87a35692-66bf-448d-a61e-9591147d56fc}</ProjectGuid>
<ProjectHome />
<StartupFile>setup-win.py</StartupFile>
<SearchPath />
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<InterpreterId>Global|PythonCore|3.6-32</InterpreterId>
<Name>mercuryapi</Name>
<CommandLineArguments>bdist_wininst -p win32</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
<IsWindowsApplication>False</IsWindowsApplication>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="setup-win.py" />
<Compile Include="test.py" />
</ItemGroup>
<ItemGroup>
<InterpreterReference Include="Global|PythonCore|3.6-32" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
</Project>
31 changes: 31 additions & 0 deletions mercuryapi.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "python-mercuryapi", "python-mercuryapi.pyproj", "{87A35692-66BF-448D-A61E-9591147D56FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87A35692-66BF-448D-A61E-9591147D56FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87A35692-66BF-448D-A61E-9591147D56FC}.Debug|x64.ActiveCfg = Debug|Any CPU
{87A35692-66BF-448D-A61E-9591147D56FC}.Debug|x86.ActiveCfg = Debug|Any CPU
{87A35692-66BF-448D-A61E-9591147D56FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87A35692-66BF-448D-A61E-9591147D56FC}.Release|x64.ActiveCfg = Release|Any CPU
{87A35692-66BF-448D-A61E-9591147D56FC}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8F032F6E-180D-4CCC-9AE3-68A1A55827FC}
EndGlobalSection
EndGlobal
57 changes: 48 additions & 9 deletions setup-win.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
# python setup-win.py bdist --format=wininst
# python setup-win.py bdist_wininst -p win32

from distutils.core import setup, Extension
setup(name="mercuryapi", version="0.2",
from glob import glob;
from setuptools import setup, find_packages
from setuptools.extension import Extension

# you need to download http://www.thingmagic.com/mercuryapi
# http://www.thingmagic.com/images/Downloads/software/mercuryapi-1.29.4.34.zip
mercuryapi = "mercuryapi-1.29.4.34/c/src/"

setup(name="mercuryapi", version="0.3",
ext_modules=[Extension("mercury",
sources=["mercury.c"],
libraries=["mercuryapi"],
include_dirs=['mercuryapi-1.27.3.16/c/src/api',
'mercuryapi-1.27.3.16/c/src/arch/win32/include'],
library_dirs=['mercuryapi-1.27.3.16/c/proj/MercuryAPI/Release'])],
data_files = [('', ["mercuryapi-1.27.3.16/c/src/arch/win32/lib/pthreadVC2.dll"])])
[mercuryapi + "api/hex_bytes.c",
mercuryapi + "api/llrp_reader.c",
mercuryapi + "api/llrp_reader_l3.c",
mercuryapi + "api/ltkc_win32/src/ltkc_array.c",
mercuryapi + "api/ltkc_win32/src/ltkc_connection.c",
mercuryapi + "api/ltkc_win32/src/ltkc_element.c",
mercuryapi + "api/ltkc_win32/src/ltkc_encdec.c",
mercuryapi + "api/ltkc_win32/src/ltkc_error.c",
mercuryapi + "api/ltkc_win32/src/ltkc_framedecode.c",
mercuryapi + "api/ltkc_win32/src/ltkc_frameencode.c",
mercuryapi + "api/ltkc_win32/src/ltkc_frameextract.c",
mercuryapi + "api/ltkc_win32/src/ltkc_genout.c",
mercuryapi + "api/ltkc_win32/src/ltkc_hdrfd.c",
mercuryapi + "api/ltkc_win32/src/ltkc_typeregistry.c",
mercuryapi + "api/ltkc_win32/src/ltkc_xmltextencode.c",
mercuryapi + "api/ltkc_win32/src/tm_ltkc_genout.c",
mercuryapi + "api/osdep_win32.c",
mercuryapi + "api/serial_reader.c",
mercuryapi + "api/serial_reader_l3.c",
mercuryapi + "api/serial_transport_tcp_win32.c",
mercuryapi + "api/serial_transport_win32.c",
mercuryapi + "api/tmr_loadsave_configuration.c",
mercuryapi + "api/tmr_param.c",
mercuryapi + "api/tmr_strerror.c",
mercuryapi + "api/tmr_utils.c",
mercuryapi + "api/tm_reader.c",
mercuryapi + "api/tm_reader_async.c",
"mercury.c"],
define_macros=[('WIN32', '1'),
('HAVE_STRUCT_TIMESPEC', None),
('_CRT_SECURE_NO_WARNINGS', None)],
include_dirs=[mercuryapi + 'api',
mercuryapi + 'api/ltkc_win32/inc',
mercuryapi + 'pthreads-win32/pthreads.2'],
libraries=["pthreadVC2"],
library_dirs=[mercuryapi + 'pthreads-win32/x86']
)],
data_files = [('', [mercuryapi + 'pthreads-win32/x86/pthreadVC2.dll'])])
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python3 setup.py build

from distutils.core import setup, Extension
from setuptools import setup, Extension
setup(name="mercuryapi", version="0.2",
ext_modules=[Extension("mercury",
sources=["mercury.c"],
Expand Down

0 comments on commit 58fd615

Please sign in to comment.