Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cztomczak opened this issue Feb 12, 2016 · 2 comments
Labels
Milestone

Comments

@cztomczak
Copy link
Owner

cztomczak commented Feb 12, 2016

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:

@cztomczak cztomczak added this to the Chrome 47 milestone Feb 12, 2016
@cztomczak cztomczak changed the title Use cmakefiles and ninja on Windows Use CMake on all platforms Jul 3, 2016
@cztomczak cztomczak changed the title Use CMake on all platforms Use CMake and Ninja on all platforms Jul 3, 2016
@cztomczak cztomczak changed the title Use CMake and Ninja on all platforms Automate building C++ libs and the subprocess executable on all platforms with Cmake/Ninja or setuptools Dec 13, 2016
@cztomczak cztomczak changed the title Automate building C++ libs and the subprocess executable on all platforms with Cmake/Ninja or setuptools Automate building C++ libs and the subprocess executable and make it work cross-platform Dec 13, 2016
@cztomczak cztomczak changed the title Automate building C++ libs and the subprocess executable and make it work cross-platform Create tools/build.py. Automate building C++ libs and subprocess and make it cross-platform. Feb 13, 2017
cztomczak added a commit that referenced this issue Feb 17, 2017
There is still issue with building vcproj files to be resolved.

Currently supported on Windows is only Python 2.7 32-bit.

Remove patch deps on Windows and Mac platforms to facilitate building (#300,
#231, #251).

Create tools/build.py and tools/build_module.py (#210). Cleanup in directories
due to new build tools.

Update tools/automate.py.

DragData methods become Linux-only: GetImage(), HasImage(). This functionality
will be available on all platforms when patch is merged into upstream (#251).
@cztomczak cztomczak modified the milestones: v55, Chrome 50+ Feb 24, 2017
@cztomczak
Copy link
Owner Author

cztomczak commented Mar 3, 2017

tools/build.py was already created. Building C++ projects is automated, however when new c++ files are added then manual modifications are required in makefiles on Mac/Linux and in .vcproj files on Windows.

On Windows only Python 2.7 32-bit is currently supported and to support other platforms / python versions new .vcproj files need to be created. This still needs to be automated. To use a .vcproj template file and generate actual .vcproj files on the fly for given python/platform.

Using setuptools would be cool, but this would require testing on all platforms.

@cztomczak
Copy link
Owner Author

Commit 5f24f50 added tools/build_cpp_projects.py which builds C++ projects on Windows using distutils/setuptools compiler. This allowed to support Python 3. In VS2010 vcbuild.exe was replaced by msbuild.exe. Ufortunately WinSDK 7.1 does not come with msbuild.exe, so it would be required to install Visual Studio 2010, and to support both 32-bit ad 64-bit compilations a non-express version would have to be installed, which is not free. So to make it free open-source it was required migrate to a new compilation system that uses distutils/setuptools packages.

On Linux/Mac C++ projects are still built using Makefiles.

@cztomczak cztomczak changed the title Create tools/build.py. Automate building C++ libs and subprocess and make it cross-platform. Create tools/build.py. Automate building C++ libs and subprocess and make it cross-platform. Windows platform already supported. Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant