diff --git a/setup.py b/setup.py
index 84dd33b3041e7544bfef0109c1d7771c03927441..1250190c51e667d856805ca509218f85ee5b32c9 100644
--- a/setup.py
+++ b/setup.py
@@ -3,6 +3,13 @@
 
 from setuptools import setup, find_packages
 
+try:
+    import cx_Freeze
+    HAVE_CXFREEZE = True
+    setup = cx_Freeze.setup
+except ImportError:
+    HAVE_CXFREEZE = False
+
 ver_dic = {}
 version_file = open("loopy/version.py")
 try:
@@ -12,6 +19,24 @@ finally:
 
 exec(compile(version_file_contents, "pyopencl/version.py", 'exec'), ver_dic)
 
+setup_kwargs = {}
+
+if HAVE_CXFREEZE:
+    setup_kwargs = dict(
+            executables=[
+                cx_Freeze.Executable(
+                    'bin/loopy',
+                    base='Console',
+                    targetName='loopy')
+                ],
+            options=dict(
+                build_exe=dict(
+                    packages=[],
+                    excludes=["scipy", "meshpy", "Tkinter", "pyublas", "hedge", "pyopencl"]
+                ))
+            )
+
+
 setup(name="loo.py",
       version=ver_dic["VERSION_TEXT"],
       description="A code generator for array-based code on CPUs and GPUs",
@@ -52,4 +77,5 @@ setup(name="loo.py",
       author_email="inform@tiker.net",
       license="MIT",
       packages=find_packages(),
-      )
+
+      **setup_kwargs)