@@ -8,19 +8,46 @@ This extension provides the Component Object Model (COM) and .NET support.
8
8
> [!NOTE]
9
9
> This extension is available only when the target system is Windows.
10
10
11
- ## PHP_EXT_COM_DOTNET
11
+ ## Requirements
12
+
13
+ To build this extension, Windows SDK needs to be installed, which includes
14
+ the COM support.
15
+
16
+ To enable also the .NET support in this extension (e.g., the `dotnet` PHP
17
+ class), the .NET framework needs to be installed, which provides the
18
+ `<mscoree.h>` header. This can be done in several ways:
19
+
20
+ * in Visual Studio by installing the .NET desktop development workload
21
+ * in Visual Studio by installing the .NET framework 4.x component only
22
+ * Download and install
23
+ [.NET framework](https://dotnet.microsoft.com/en-us/download/dotnet-framework)
24
+ manually.
25
+
26
+ The .NET version 5 and later are not supported as they have removed the
27
+ `<mscoree.h>` API.
28
+
29
+ ## Configuration options
30
+
31
+ ### PHP_EXT_COM_DOTNET
12
32
13
33
* Default: `ON`
14
34
* Values: `ON|OFF`
15
35
16
- Enable the extension.
36
+ Enables the extension.
17
37
18
- ## PHP_EXT_COM_DOTNET_SHARED
38
+ ### PHP_EXT_COM_DOTNET_SHARED
19
39
20
40
* Default: `OFF`
21
41
* Values: `ON|OFF`
22
42
23
- Build extension as shared.
43
+ Builds extension as shared.
44
+
45
+ ### PHP_EXT_COM_DOTNET_ENABLE_DOTNET
46
+
47
+ * Default: `ON`
48
+ * Values: `ON|OFF`
49
+
50
+ Enables the .NET Framework support.
24
51
#]=============================================================================]
25
52
26
53
cmake_minimum_required (VERSION 3.29...4.0 )
@@ -54,6 +81,14 @@ cmake_dependent_option(
54
81
OFF
55
82
)
56
83
84
+ cmake_dependent_option (
85
+ PHP_EXT_COM_DOTNET_ENABLE_DOTNET
86
+ "Enable .NET support"
87
+ ON
88
+ PHP_EXT_COM_DOTNET
89
+ OFF
90
+ )
91
+
57
92
if (NOT PHP_EXT_COM_DOTNET )
58
93
return ()
59
94
endif ()
@@ -91,7 +126,20 @@ target_compile_definitions(
91
126
92
127
target_link_libraries (php_ext_com_dotnet PRIVATE oleaut32 )
93
128
94
- check_include_files (mscoree.h HAVE_MSCOREE_H )
129
+ if (PHP_EXT_COM_DOTNET_ENABLE_DOTNET )
130
+ check_include_files (mscoree.h PHP_EXT_COM_DOTNET_HAS_MSCOREE_H )
131
+
132
+ if (NOT PHP_EXT_COM_DOTNET_HAS_MSCOREE_H )
133
+ message (
134
+ FATAL_ERROR
135
+ "<mscoree.h> not found. Please install the .NET Framework or disable the "
136
+ ".NET support with by setting 'PHP_EXT_COM_DOTNET_ENABLE_DOTNET' to "
137
+ "'OFF'."
138
+ )
139
+ endif ()
140
+
141
+ set (HAVE_MSCOREE_H TRUE )
142
+ endif ()
95
143
96
144
set (HAVE_COM_DOTNET TRUE )
97
145
0 commit comments