@@ -12,14 +12,41 @@ class curl extends WindowsLibraryBase
1212
1313 protected function build (): void
1414 {
15- FileSystem::createDir (BUILD_BIN_PATH );
16- cmd ()->cd ($ this ->source_dir . '\winbuild ' )
15+ // reset cmake
16+ FileSystem::resetDir ($ this ->source_dir . '\cmakebuild ' );
17+
18+ // lib:zstd
19+ $ alt = $ this ->builder ->getLib ('zstd ' ) ? '' : '-DCURL_ZSTD=OFF ' ;
20+ // lib:brotli
21+ $ alt .= $ this ->builder ->getLib ('brotli ' ) ? '' : ' -DCURL_BROTLI=OFF ' ;
22+
23+ // start build
24+ cmd ()->cd ($ this ->source_dir )
25+ ->execWithWrapper (
26+ $ this ->builder ->makeSimpleWrapper ('cmake ' ),
27+ '-B cmakebuild ' .
28+ '-A x64 ' .
29+ "-DCMAKE_TOOLCHAIN_FILE= {$ this ->builder ->cmake_toolchain_file } " .
30+ '-DCMAKE_BUILD_TYPE=Release ' .
31+ '-DBUILD_SHARED_LIBS=OFF ' .
32+ '-DBUILD_STATIC_LIBS=ON ' .
33+ '-DCURL_STATICLIB=ON ' .
34+ '-DCMAKE_INSTALL_PREFIX= ' . BUILD_ROOT_PATH . ' ' .
35+ '-DBUILD_CURL_EXE=OFF ' . // disable curl.exe
36+ '-DBUILD_TESTING=OFF ' . // disable tests
37+ '-DBUILD_EXAMPLES=OFF ' . // disable examples
38+ '-DUSE_LIBIDN2=OFF ' . // disable libidn2
39+ '-DCURL_USE_LIBPSL=OFF ' . // disable libpsl
40+ '-DCURL_ENABLE_SSL=ON ' .
41+ '-DUSE_NGHTTP2=ON ' . // enable nghttp2
42+ '-DCURL_USE_LIBSSH2=ON ' . // enable libssh2
43+ '-DENABLE_IPV6=ON ' . // enable ipv6
44+ '-DNGHTTP2_CFLAGS="/DNGHTTP2_STATICLIB" ' .
45+ $ alt
46+ )
1747 ->execWithWrapper (
18- $ this ->builder ->makeSimpleWrapper ('nmake ' ),
19- '/f Makefile.vc WITH_DEVEL= ' . BUILD_ROOT_PATH . ' ' .
20- 'WITH_PREFIX= ' . BUILD_ROOT_PATH . ' ' .
21- 'mode=static RTLIBCFG=static WITH_SSL=static WITH_NGHTTP2=static WITH_SSH2=static ENABLE_IPV6=yes WITH_ZLIB=static MACHINE=x64 DEBUG=no '
48+ $ this ->builder ->makeSimpleWrapper ('cmake ' ),
49+ "--build cmakebuild --config Release --target install -j {$ this ->builder ->concurrency }"
2250 );
23- FileSystem::copyDir ($ this ->source_dir . '\include\curl ' , BUILD_INCLUDE_PATH . '\curl ' );
2451 }
2552}
0 commit comments