问题
I would like to use meson build system on windows. I am python noob. It looks like I installed it, but I do not know how to run it.
I have installed python 3.6. I have installed meson from 'cmd':
C:\>python -m pip install meson
Collecting meson
Downloading meson-0.39.0.tar.gz (558kB)
100% |████████████████████████████████| 563kB 866kB/s
Installing collected packages: meson
Running setup.py install for meson ... done
Successfully installed meson-0.39.0
I try to run meson:
C:\>python -m meson
C:\Users\user\AppData\Local\Programs\Python\Python36-32\python.exe: No module named meson
C:\>meson
'meson' is not recognized as an internal or external command,
operable program or batch file.
How can I use/run this thing?
回答1:
from the documentation
Running
Meson requires that you have a source directory and a build directory and that these two are different. In your source root must exist a file called 'meson.build'. To generate the build system run this command:
meson
Depending on how you obtained Meson the command might also be called meson.py
check for a meson.py in the directory that you installed meson.
https://github.com/mesonbuild/meson
回答2:
Ok the official advice is to associate .py
files with the Windows Python Launcher (at c:\Windows\py.exe
). However this is a shitty solution because a) That means you can't associate them with an editor or IDE, and b) command line argument passing e.g. meson.py --help
does not work.
A better solution is to:
Download and install Python 3 to the default installation location (in
%APPDATA%
). Have it add Python to your path.Run
python -m pip install meson
Create a
meson.bat
file somewhere in yourPATH
with the following contents:@echo off c:\Windows\py.exe %LOCALAPPDATA%\Programs\Python\Python36-32\Scripts\meson.py %*
Then you should be able to just run meson --help
successfully.
I have no idea why this isn't done automatically.
回答3:
This is what I did:
- Download the latest MSI for Windows form the Releases page.
- Use LessMSI to extract the MSI into my own folder.
- Create a
bat
file which opens aCMD
with the path toMeson
added to the System Variable%PATH%
.
Then just use it as guided form the CMD
.
No need to install Python or anything.
来源:https://stackoverflow.com/questions/42712896/how-to-run-meson-build-system-on-windows