Requirements

  • MSVC toolchain
  • Cygwin

Note: When installing Cygwin and selecting packages, make sure you search for and select 'make', 'dos2unix' and 'binutils'.

How to build

  • set PATH=%PATH%;C:\Cygwin\bin
  • dos2unix -f configure or other file

Example

c:\cygwin64\bin\bash.exe configure -prefix=/cygdrive/d/workdir/wxProject/mEditor/3rdlib/myinstall1 -enable-static -disable-shared make install

compile static, shared library, dll delay load refer to mEditor project (U_STATIC_IMPLEMENTATION)

MSVC MD MT MDd MTd

运行时库选项	静态链接库名称	说明
/MT	        libcmt.lib	多线程静态链接版本的 C 运行时库(Release 模式)。
/MTd	        libcmtd.lib	多线程静态链接版本的 C 运行时库(Debug 模式)。
/MD	        msvcrt.lib	多线程动态链接版本的 C 运行时库(Release 模式)。
/MDd	        msvcrtd.lib	多线程动态链接版本的 C 运行时库(Debug 模式)。

MSVC dll delay load

add_library(example SHARED lib.c)
add_executable(main main.c)

set(CMAKE_CXX_FLAGS_RELEASE "/MT")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")

target_link_libraries(main PRIVATE example)

if(MSVC)
  set_property(TARGET example PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS true)
  target_link_libraries(main PRIVATE delayimp)
  target_link_options(main PRIVATE "/DELAYLOAD:1.dll;2.dll;3.dll")
endif()

refer to: https://wiki.qt.io/Compiling-ICU-with-MSVC

refer to: https://stackoverflow.com/questions/63930386/statically-linking-icu-on-windows

refer to: https://www.scivision.dev/cmake-msvc-delayload/

除额外注明的地方外,本维基上的内容按下列许可协议发布: CC Attribution-Share Alike 4.0 International