I have a C extension that I am building with scikit-build (because it uses a CMake library), and this builds fine and works when imported in python.
I am then trying to build the script that uses the extension with cx-freeze, which is building, but I see the extension listed under "Missing modules":
Missing modules:
? _atscManufacturing imported from atsc.atscManufacturing.atscManufacturing
When I run the built executable from command prompt it just hangs for a couple seconds and then exits with no output.
I have seen this solution which suggests using Extension
to add the C extension, but this seems to want to compile the library instead of just including the compiled library. I don't think this will work because it needs to build the CMake library.
Here is my main setup.py
:
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "atsc.atscManufacturing.atscManufacturing", "intelhex", "logging", "atexit", "sys"], "excludes": []}
base = None
setup( name = "Manufacturing script",
version = "1.0.0",
description = "manufacturing script",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py", base = base)])
Here is the setup.py
from the extension in ./atsc
:
from skbuild import setup
setup(
name="atscManufacturing",
version="0.1",
packages=['atscManufacturing']
)