LEFT | RIGHT |
1 Experimental CMake build for adblockpluscore | 1 Experimental CMake build for adblockpluscore |
2 ============================================ | 2 ============================================ |
3 | 3 |
4 This files describes an experimental build using CMake. For the duration of | 4 This files describes an experimental build using CMake. For the duration of |
5 this experiment, this file will describe the build independently, leaving the | 5 this experiment, this file will describe the build independently, leaving the |
6 existing README.md intact. | 6 existing README.md intact. |
7 | 7 |
8 Requirements | 8 Requirements |
9 ------------ | 9 ------------ |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 the specific location of the file are visible within the following command | 47 the specific location of the file are visible within the following command |
48 line fragment: | 48 line fragment: |
49 | 49 |
50 ``` | 50 ``` |
51 cmake -DCMAKE_TOOLCHAIN_FILE=<EmscriptenRoot>/cmake/Modules/Platform/Emscrip
ten.cmake [...] | 51 cmake -DCMAKE_TOOLCHAIN_FILE=<EmscriptenRoot>/cmake/Modules/Platform/Emscrip
ten.cmake [...] |
52 ``` | 52 ``` |
53 | 53 |
54 Note that the `<EmscriptenRoot>` about is _not_ the root of the Emscripten | 54 Note that the `<EmscriptenRoot>` about is _not_ the root of the Emscripten |
55 SDK. Within the SDK, the location is `<SdkRoot>/emscripten/<version>` | 55 SDK. Within the SDK, the location is `<SdkRoot>/emscripten/<version>` |
56 | 56 |
57 This toolchain file assumes that it's running within an Emscripten shell with | 57 #### Emscripten environment |
58 all paths and environment variables set up. CMake will appear to configure | |
59 correctly outside this, but will not find executables, etc. | |
60 | 58 |
| 59 The Emscripten toolchain file is not particularly mature and can somewhat |
| 60 brittle in practice. In particular, it does not attempt to see if it's being |
| 61 used from within its SDK installation tree. Instead, it assumes that it is |
| 62 running from within an Emscripten shell. It requires all relevant executables |
| 63 to be present with the search path. It expects to find certain environment |
| 64 variables. |
| 65 |
| 66 Therefore, it is highly recommended that initial configuration of CMake be run |
| 67 from within an Emscripten shell. These are available from the Emscripten SDK. |
| 68 CMake will appear to configure correctly in other circumstances, but it can |
| 69 fail otherwise. |
| 70 |
| 71 Using CMake |
| 72 ----------- |
| 73 |
| 74 CMake supports build both inside the source tree and outside it. The CMake |
| 75 working directory is whatever the current directory is when CMake is initially |
| 76 configured. The project root is specified on the command line of this |
| 77 configuration run. For an in-source build, simply run CMake in the project root. |
| 78 |
| 79 The present CMakeLists.txt is better suited for an out-of-source build. It |
| 80 does not put its intermediate or output files in any special place, so they all |
| 81 end up in the build directory. |
| 82 |
| 83 ### Configurations |
| 84 |
| 85 The present CMakeLists.txt supports four configurations: |
| 86 * Release - `compile` |
| 87 * Debug - `compile -d` |
| 88 * ReleaseTrace - `compile -t` |
| 89 * DebugTrace - `compile -d -t` |
| 90 |
| 91 A single-configuration generator, such as `make` or `ninja`, supports only one |
| 92 configuration per CMake build directory. Multiple build directories for |
| 93 different configurations, however, work just fine; each build directory gets |
| 94 its own CMake cache and working directory. [EH: I have a test setup locally |
| 95 with all four configurations and some scripts to configure everything and to |
| 96 build everything.] If no configuration is specified, it defaults to "Release". |
| 97 |
| 98 ``` |
| 99 cmake -DCMAKE_BUILD_TYPE=Release [...] |
| 100 ``` |
| 101 |
| 102 A multiple-configuration generator, such as for Eclipse or XCode, makes all |
| 103 configurations available through the user interface of the IDE. |
61 | 104 |
62 Notes | 105 Notes |
63 ----- | 106 ----- |
64 | 107 |
65 ### Setting up Emscripten under Cygwin. | 108 ### Setting up Emscripten under Cygwin. |
66 | 109 |
67 tl;dr version: Don't. | 110 tl;dr version: Don't. |
68 | 111 |
69 It's a known issue that the Emscripten tool chain as distributed does not work | 112 It's a known issue that the Emscripten tool chain as distributed does not work |
70 under Cygwin. The core of the issue is that Emscripten uses a number of native | 113 under Cygwin. The core of the issue is that Emscripten uses a number of native |
71 Windows executables and the transition from Cygwin path names to Windows path | 114 Windows executables and the transition from Cygwin path names to Windows path |
72 names doesn't work correctly. | 115 names doesn't work correctly. |
73 | 116 |
74 https://github.com/kripken/emscripten/issues/3947 | 117 https://github.com/kripken/emscripten/issues/3947 |
75 | 118 |
76 Once the command `emcc -v` runs correctly, CMake will be able to set up the | 119 Once the command `emcc -v` runs correctly, CMake will be able to set up the |
77 Emscripten tool chain. Even then, there will still be errors in other ways. | 120 Emscripten tool chain. Even then, there will still be errors in other ways. |
78 | 121 |
79 | 122 |
| 123 Draft Notes |
| 124 ----------- |
80 | 125 |
| 126 There are a few known deficiencies. |
| 127 |
| 128 ### Other targets |
| 129 |
| 130 There are no targets for testing or documentation. |
| 131 |
| 132 ### eslint |
| 133 |
| 134 There's no provision for ignoring compiled-js files in eslint. This is only an |
| 135 issue for an in-source-tree build. |
LEFT | RIGHT |