|
| 1 | +#[=============================================================================[ |
| 2 | +# The uri extension |
| 3 | +
|
| 4 | +Configure the `uri` extension. |
| 5 | +
|
| 6 | +This extension provides support for URI handling. |
| 7 | +#]=============================================================================] |
| 8 | + |
| 9 | +cmake_minimum_required(VERSION 3.25...3.31) |
| 10 | + |
| 11 | +project( |
| 12 | + PhpExtensionUri |
| 13 | + LANGUAGES C |
| 14 | +) |
| 15 | + |
| 16 | +include(FeatureSummary) |
| 17 | + |
| 18 | +add_feature_info( |
| 19 | + "ext/uri" |
| 20 | + TRUE |
| 21 | + "support for URI handling" |
| 22 | +) |
| 23 | + |
| 24 | +add_library(php_ext_uri OBJECT) |
| 25 | + |
| 26 | +target_sources( |
| 27 | + php_ext_uri |
| 28 | + PRIVATE |
| 29 | + php_uri.c |
| 30 | + php_uri.stub.php |
| 31 | + uriparser/src/UriCommon.c |
| 32 | + uriparser/src/UriCompare.c |
| 33 | + uriparser/src/UriEscape.c |
| 34 | + uriparser/src/UriFile.c |
| 35 | + uriparser/src/UriIp4.c |
| 36 | + uriparser/src/UriIp4Base.c |
| 37 | + uriparser/src/UriMemory.c |
| 38 | + uriparser/src/UriNormalize.c |
| 39 | + uriparser/src/UriNormalizeBase.c |
| 40 | + uriparser/src/UriParse.c |
| 41 | + uriparser/src/UriParseBase.c |
| 42 | + uriparser/src/UriQuery.c |
| 43 | + uriparser/src/UriRecompose.c |
| 44 | + $<$<NOT:$<PLATFORM_ID:Windows>>:uriparser/src/UriResolve.c> |
| 45 | + uriparser/src/UriShorten.c |
| 46 | + PUBLIC |
| 47 | + FILE_SET HEADERS |
| 48 | + FILES |
| 49 | + php_uri.h |
| 50 | +) |
| 51 | + |
| 52 | +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") |
| 53 | + target_sources( |
| 54 | + php_ext_uri |
| 55 | + PUBLIC |
| 56 | + FILE_SET HEADERS |
| 57 | + FILES |
| 58 | + uriparser/include/uriparser/Uri.h |
| 59 | + uriparser/include/uriparser/UriBase.h |
| 60 | + uriparser/include/uriparser/UriDefsAnsi.h |
| 61 | + uriparser/include/uriparser/UriDefsConfig.h |
| 62 | + uriparser/include/uriparser/UriDefsUnicode.h |
| 63 | + uriparser/include/uriparser/UriIp4.h |
| 64 | + uriparser/src/UriCommon.h |
| 65 | + uriparser/src/UriConfig.h |
| 66 | + uriparser/src/UriIp4Base.h |
| 67 | + uriparser/src/UriMemory.h |
| 68 | + uriparser/src/UriNormalizeBase.h |
| 69 | + uriparser/src/UriParseBase.h |
| 70 | + ) |
| 71 | +endif() |
| 72 | + |
| 73 | +target_compile_definitions( |
| 74 | + php_ext_uri |
| 75 | + PRIVATE |
| 76 | + URI_STATIC_BUILD |
| 77 | + ZEND_ENABLE_STATIC_TSRMLS_CACHE |
| 78 | +) |
| 79 | + |
| 80 | +target_include_directories( |
| 81 | + php_ext_uri |
| 82 | + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/uriparser/include |
| 83 | +) |
| 84 | + |
| 85 | +add_dependencies(php_ext_uri php_ext_lexbor) |
| 86 | + |
| 87 | +set(URI_ENABLE_ANSI TRUE) |
| 88 | +set(URI_NO_UNICODE TRUE) |
| 89 | + |
| 90 | +configure_file(cmake/config.h.in config.h) |
0 commit comments