Skip to content

Create tools/build.py. Automate building C++ libs and subprocess and make it cross-platform. Windows platform already supported. #210

Open
@cztomczak

Description

@cztomczak

Currently on Windows when building the cefpython module you first need to build the C++ libraries and the subprocess executable by building vcproj files separately. It's a manual process that needs to be automated. On Linux/Mac it's better, the compile.py script will build the C++ libs and the subprocess executable automatically by running Makefile. However when making changes, these changes need to be done separately for Windows and for Mac/Linux. A cross-platform solution for building these libs/subprocess would be nice.

Solution 1: Cmake and Ninja

CMake - https://cmake.org/
Ninja - https://ninja-build.org/

  • Refactor the client_handler/ and subprocess/ directories and put all .cpp/.h files to app/ directory.
  • Get rid of all the vcproj files on Windows:
    • client_handler_py27_32bit.vcproj
    • libcefpythonapp_py27_32bit.vcproj
    • subprocess_32bit.vcproj

Solution 2: setuptools

Looks like there may be an alternative to cmake/ninja. Turns out setuptools can not only build python modules, but also static libraries and executables. Search in Google for "setuptools + xxx" where xxx is:

Does setuptools have some kind of cache mechanism? So that it doesn't rebuild every time when there are no changes in sources?

  • Looks like yes, force rebuilding pass --force flag to setup.py

Cmake seems complicated, things aren't easier than Makefiles, just provides cross-platform support. Using setuptools may be easier, it already takes care of detecting which VC++ compiler to use depending on Python version used. However distutils/setuptools documentation is very poor. I couldn't find any references to "StaticLib" and "Executable" classes referenced above. Some links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions