Skip to content

Build on Windows

cztomczak edited this page Feb 9, 2016 · 21 revisions

This page provides step by step instructions on how to build PHP Desktop Chrome from sources.

Table of Contents generated with DocToc

Preliminary notes

These instructions are for building Chrome 47 branch ("phpdesktop-chrome47/" directory).

Requirements:

  • Visual Studio 2013 with Update 5

Download PHP Desktop sources

Clone git repository.

Download CEF sources / prebuilt binaries

If you would like to use CEF prebuilt binaries then go to www.cefbuilds.com. You have to download CEF for the same branch and revision that phpdesktop uses. See phpdesktop-chrome47/cef/README.txt or appropriate. Look for CEF version in that file. In our case for phpdesktop-chrome47/ branch it is 3.2526.1366.g8617e7c as of writing.

  • Go to www.cefbuilds.com
  • Select branch 2526 > Windows 32bit > click "more revisions"
  • Now find CEF version that matches the one in README.txt. In our case it is "CEF Version: 3.2526.1366.g8617e7c" as of writing. Click on the "CEF 3.2526.1366.g8617e7c (79MB)" link to download and then extract it.

If you would like to build CEF from sources then see CEF Branches and building (external) wiki page. Recently Chromium has migrated from SVN to GIT and now building older branches (branch 1650 with CEF 3.1650.1562) from sources is not officially supported.

Build cefclient and copy CEF files to phpdesktop

The CEF binaries downloaded from cefbuilds.com after extracting have the "cef_binary_3.2526.1366.g8617e7c_windows32" directory. From now on we will refer to this directory as "cef_binary/".

  1. Install CMake 2.8.12.1 or newer from http://www.cmake.org/ . During installation choose an option to add cmake to user's PATH.
  2. Install Ninja from http://martine.github.io/ninja/ . Put ninja.exe in your PATH or copy it to the build/ directory you will be creating in next step.
  3. In "cef_binary/" create a "build" directory and enter it
  4. Execute "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" (with quotes)
  5. Edit "cef_binary/CMakeLists.txt" and in the if(OS_WINDOWS) section add the /wd\"4481\" flag to CEF_COMPILER_FLAGS if it's missing (upstream CEF Issue #1642): set(CEF_COMPILER_FLAGS "/MP /Gy /GR- /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4481\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\" ${CEF_DEBUG_INFO_FLAG}")
  6. Execute cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUSE_SANDBOX=OFF ..
  7. If you get an error during linking "manifest authoring warning 81010002" then install Windows SDK 7.1 and copy "mt.exe" and "mt.exe.config" from "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin" to "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin".
  8. Execute ninja cefclient
  9. Go to the "cef_binary/build/cefclient/" directory and run cefclient.exe to see if it works fine
  10. Create "phpdesktop-chrome47/Release/" directory and copy files and subdirectories from the "cef_binary/Release/" and "cef_binary/Resources/" directories. Exclude ".lib" files. You may also copy cefclient.exe and cefclient.pdb from the "cef_binary/build/cefclient/" directory.
  11. Copy "cef_binary/build/libcef_dll/libcef_dll_wrapper.lib" and "cef_binary/Release/libcef.lib" to the "phpdesktop-chrome47/lib/Release/" directory.
  12. To clean the build directory just delete it. To only clean ninja build and keep cmake files intact type ninja -t clean cefclient. If you need DEBUG binaries re-run commands starting from step 6 with DCMAKE_BUILD_TYPE=Debug and replace any "Release" directories mentioned with a "Debug" directory.

If you're building with version of CEF different from README.txt (eg. upgrading to a newer CEF) then delete the "phpdesktop-chrome47/cef/include/" directory and copy the "cef_binary/include/" directory (ignore the "capi" subdirectory). Also overwrite "phpdesktop-chrome47/cef/README.txt" file with "cef_binary/README.txt".

Download PHP binaries

Go to http://windows.php.net/download/ and:

  • For PHP 5.4 download "VC9 x86 Non Thread Safe" zip file
  • For PHP 5.6 download "VC11 x86 Non Thread Safe" zip file

Extract it and put binaries in phpdesktop-chrome47/php/ directory.

If you want to support Windows XP download PHP 5.4 binaries and additionally move all DLL extensions from php/ext/ directory to the root php/ directory. See Issue 34 for why it needs to be done so. You will also have to create/modify php.ini and set extension_dir option:

extension_dir=./

Build phpdesktop-chrome project

  1. Go to phpdesktop-chrome47/ directory
  2. Open phpdesktop-chrome.sln file in Visual Studio
  3. Change configuration to Release
  4. Build phpdesktop-chrome project. This will generate Release/phpdesktop-chrome.exe executable.
  5. Run phpdesktop-chrome.exe executable
Clone this wiki locally