# qmake2cmake
This repository contains Python scripts to convert QMake projects to
CMake projects.
## Goals
The qmake2cmake tool creates a `CMakeLists.txt` that covers the most common
attributes of the converted `.pro` file. The generated CMake project can be
used as baseline and will most likely need manual adjustments.
QMake constructs that cannot be converted end up in the CMake project as
comment.
## Non-goals
Qt versions lower than 6.0 are not supported.
The following QMake constructs are not converted:
- `TEMPLATE = aux` projects
- custom `.prf` files
- extra compilers
- extra targets
- installation rules
# Requirements
* [Python 3.7](https://www.python.org/downloads/),
* `pip` to manage Python packages.
# Installation
You can install the `qmake2cmake` package directly via `pip install
qmake2cmake`.
In case you are developing a new feature or want to install the latest
repository version, do an editable build by running `pip install -e .`
# Installation for contributors
For developers who want to contribute to `qmake2cmake`, we recommend
using a [virtual
environment](https://docs.python.org/3/library/venv.html) to avoid
conflicts with other packages that are already installed.
* Create an environment: `python3 -m venv env --prompt qmake2cmake`,
* Activate the environment: `source env/bin/activate`
(on Windows: `env\Scripts\activate.bat`)
* Install the requirements: `pip install -r requirements.txt`
If the `pip install` command above doesn't work, try:
```
python3.7 -m pip install -r requirements.txt
```
# Usage
After installing the `qmake2cmake` package, two scripts will be
available in your bin/ directory of your Python environment:
`qmake2cmake` and `qmake2cmake_all`.
The following call converts a single QMake project file to CMake:
```
qmake2cmake ~/projects/myapp/myapp.pro --min-qt-version 6.3
```
It's necessary to specify a minimum Qt version the project is supposed
to be built with. Use the `--min-qt-version` option or the
environment variable `QMAKE2CMAKE_MIN_QT_VERSION`.
By default, a `CMakeLists.txt` is placed next to the `.pro` file.
To generate `CMakeLists.txt` in a different location, use the `-o` option:
```
qmake2cmake ~/projects/myapp/myapp.pro --min-qt-version 6.3 -o ~/projects/myapp-converted/CMakeLists.txt
```
To convert a whole project tree, pass the project directory to `qmake2cmake_all`:
```
qmake2cmake_all ~/projects/myapp --min-qt-version 6.3
```
# Contributing
The main source code repository is hosted at
[codereview.qt-project.org](https://codereview.qt-project.org/q/project:qt/qmake2cmake).
See the [Qt Contribution Guidelines](https://wiki.qt.io/Qt_Contribution_Guidelines)
page, [Setting up Gerrit](https://wiki.qt.io/Setting_up_Gerrit) and
[Gerrit Introduction](https://wiki.qt.io/Gerrit_Introduction) for more
details about how to upload patches for review.
## Code style and tests
You can run the linter (`mypy`), code-style checkers (`flake8`, `black`)
and tests (`pytest`) by executing:
```
make test
```
There are also separate make targets for each of those `make mypy`, `make flake8`,
`make black_format_check`, `make pytest`.
You can auto-format the code using [black](https://black.readthedocs.io/en/stable/):
```
make format
```
# Releasing a new version
Increase the version number in `setup.cfg` according to semantic versioning 2.0.
For building and uploading `qmake2cmake` you will need the Python
modules `build` and `twine`.
Build the wheel:
```
$ python -m build
```
Upload to testpypi:
```
$ twine upload --repository testpypi dist/<wheel-name>
```
Install the uploaded wheel in a fresh venv:
```
$ python -m venv fresh && . ./fresh/bin/activate
(fresh)$ pip install -i https://testpypi.python.org/pypi qmake2cmake --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple
```
If the installation succeeded, try to convert something.
If everything is bueno, upload the wheel to production pypi.
```
$ twine upload --repository pypi dist/<wheel-name>
```
It is advisable to try out this wheel in another fresh venv.
Raw data
{
"_id": null,
"home_page": "https://wiki.qt.io/qmake2cmake",
"name": "qmake2cmake",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "qmake,cmake,development",
"author": "The Qt Company",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/30/c2/c0fce293cc988ce4cf7f399ae0a0d23c4836e3d9d8410acfb59297ef3f58/qmake2cmake-1.0.6.tar.gz",
"platform": null,
"description": "# qmake2cmake\n\nThis repository contains Python scripts to convert QMake projects to\nCMake projects.\n\n## Goals\n\nThe qmake2cmake tool creates a `CMakeLists.txt` that covers the most common\nattributes of the converted `.pro` file. The generated CMake project can be\nused as baseline and will most likely need manual adjustments.\n\nQMake constructs that cannot be converted end up in the CMake project as\ncomment.\n\n## Non-goals\n\nQt versions lower than 6.0 are not supported.\n\nThe following QMake constructs are not converted:\n- `TEMPLATE = aux` projects\n- custom `.prf` files\n- extra compilers\n- extra targets\n- installation rules\n\n# Requirements\n\n* [Python 3.7](https://www.python.org/downloads/),\n* `pip` to manage Python packages.\n\n# Installation\n\nYou can install the `qmake2cmake` package directly via `pip install\nqmake2cmake`.\n\nIn case you are developing a new feature or want to install the latest\nrepository version, do an editable build by running `pip install -e .`\n\n# Installation for contributors\n\nFor developers who want to contribute to `qmake2cmake`, we recommend\nusing a [virtual\nenvironment](https://docs.python.org/3/library/venv.html) to avoid\nconflicts with other packages that are already installed.\n\n* Create an environment: `python3 -m venv env --prompt qmake2cmake`,\n* Activate the environment: `source env/bin/activate`\n (on Windows: `env\\Scripts\\activate.bat`)\n* Install the requirements: `pip install -r requirements.txt`\n\nIf the `pip install` command above doesn't work, try:\n\n```\npython3.7 -m pip install -r requirements.txt\n```\n\n# Usage\n\nAfter installing the `qmake2cmake` package, two scripts will be\navailable in your bin/ directory of your Python environment:\n`qmake2cmake` and `qmake2cmake_all`.\n\nThe following call converts a single QMake project file to CMake:\n```\nqmake2cmake ~/projects/myapp/myapp.pro --min-qt-version 6.3\n```\n\nIt's necessary to specify a minimum Qt version the project is supposed\nto be built with. Use the `--min-qt-version` option or the\nenvironment variable `QMAKE2CMAKE_MIN_QT_VERSION`.\n\nBy default, a `CMakeLists.txt` is placed next to the `.pro` file.\n\nTo generate `CMakeLists.txt` in a different location, use the `-o` option:\n```\nqmake2cmake ~/projects/myapp/myapp.pro --min-qt-version 6.3 -o ~/projects/myapp-converted/CMakeLists.txt\n```\n\nTo convert a whole project tree, pass the project directory to `qmake2cmake_all`:\n```\nqmake2cmake_all ~/projects/myapp --min-qt-version 6.3\n```\n\n# Contributing\n\nThe main source code repository is hosted at\n[codereview.qt-project.org](https://codereview.qt-project.org/q/project:qt/qmake2cmake).\n\nSee the [Qt Contribution Guidelines](https://wiki.qt.io/Qt_Contribution_Guidelines)\npage, [Setting up Gerrit](https://wiki.qt.io/Setting_up_Gerrit) and\n[Gerrit Introduction](https://wiki.qt.io/Gerrit_Introduction) for more\ndetails about how to upload patches for review.\n\n## Code style and tests\n\nYou can run the linter (`mypy`), code-style checkers (`flake8`, `black`)\nand tests (`pytest`) by executing:\n\n```\nmake test\n```\n\nThere are also separate make targets for each of those `make mypy`, `make flake8`,\n`make black_format_check`, `make pytest`.\n\nYou can auto-format the code using [black](https://black.readthedocs.io/en/stable/):\n\n```\nmake format\n```\n\n\n# Releasing a new version\n\nIncrease the version number in `setup.cfg` according to semantic versioning 2.0.\n\nFor building and uploading `qmake2cmake` you will need the Python\nmodules `build` and `twine`.\n\nBuild the wheel:\n```\n$ python -m build\n```\n\nUpload to testpypi:\n```\n$ twine upload --repository testpypi dist/<wheel-name>\n```\n\nInstall the uploaded wheel in a fresh venv:\n```\n$ python -m venv fresh && . ./fresh/bin/activate\n(fresh)$ pip install -i https://testpypi.python.org/pypi qmake2cmake --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple\n\n```\n\nIf the installation succeeded, try to convert something.\nIf everything is bueno, upload the wheel to production pypi.\n\n```\n$ twine upload --repository pypi dist/<wheel-name>\n```\n\nIt is advisable to try out this wheel in another fresh venv.\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "QMake to CMake project file converter",
"version": "1.0.6",
"project_urls": {
"Bug Tracker": "https://bugreports.qt.io",
"Homepage": "https://wiki.qt.io/qmake2cmake",
"Source": "https://codereview.qt-project.org/admin/repos/qt/qmake2cmake"
},
"split_keywords": [
"qmake",
"cmake",
"development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a37cfe7511e3bee8409a4ed1ccedc6acefd4a9c388dd81f59886125690b7d41e",
"md5": "d8a562ba7c8c150aa4cf4499d6d25f54",
"sha256": "4fc5dfa7adb9979c555c9445a1b6dd107bee107f54cdc4e91b313ca063820036"
},
"downloads": -1,
"filename": "qmake2cmake-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8a562ba7c8c150aa4cf4499d6d25f54",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 71103,
"upload_time": "2023-12-04T09:58:01",
"upload_time_iso_8601": "2023-12-04T09:58:01.150529Z",
"url": "https://files.pythonhosted.org/packages/a3/7c/fe7511e3bee8409a4ed1ccedc6acefd4a9c388dd81f59886125690b7d41e/qmake2cmake-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "30c2c0fce293cc988ce4cf7f399ae0a0d23c4836e3d9d8410acfb59297ef3f58",
"md5": "752792333c46975525c7410362cd23ee",
"sha256": "0c6b1b0d19dc76d4bee76f2c4ef84ec4deb67897245798fe3a2b72ecbc3f39d9"
},
"downloads": -1,
"filename": "qmake2cmake-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "752792333c46975525c7410362cd23ee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 76396,
"upload_time": "2023-12-04T09:58:02",
"upload_time_iso_8601": "2023-12-04T09:58:02.759978Z",
"url": "https://files.pythonhosted.org/packages/30/c2/c0fce293cc988ce4cf7f399ae0a0d23c4836e3d9d8410acfb59297ef3f58/qmake2cmake-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-04 09:58:02",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "qmake2cmake"
}