How to run meson build system on windows?

最后都变了- 提交于 2021-01-21 09:58:25

问题


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:

  1. Download and install Python 3 to the default installation location (in %APPDATA%). Have it add Python to your path.

  2. Run python -m pip install meson

  3. Create a meson.bat file somewhere in your PATH 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:

  1. Download the latest MSI for Windows form the Releases page.
  2. Use LessMSI to extract the MSI into my own folder.
  3. Create a bat file which opens a CMD with the path to Meson 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!