30 lines
1.1 KiB
CMake
30 lines
1.1 KiB
CMake
# Usage:
|
|
# ./scripts/build_third_party_mingw.sh curl
|
|
# cmake -B build-win -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64-x86_64.cmake \
|
|
# -DCST_BUILD_TUI=OFF
|
|
# $MINGW_HOST picks the tool prefix (default x86_64-w64-mingw32; Debian's UCRT
|
|
# cross gcc is x86_64-w64-mingw32ucrt).
|
|
set(CMAKE_SYSTEM_NAME Windows)
|
|
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
|
|
|
if(DEFINED ENV{MINGW_HOST} AND NOT "$ENV{MINGW_HOST}" STREQUAL "")
|
|
set(_MINGW_HOST "$ENV{MINGW_HOST}")
|
|
else()
|
|
set(_MINGW_HOST x86_64-w64-mingw32)
|
|
endif()
|
|
|
|
set(CMAKE_C_COMPILER ${_MINGW_HOST}-gcc)
|
|
set(CMAKE_CXX_COMPILER ${_MINGW_HOST}-g++)
|
|
set(CMAKE_RC_COMPILER ${_MINGW_HOST}-windres)
|
|
|
|
get_filename_component(_AGENT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
|
set(_MINGW_PREFIX "${_AGENT_ROOT}/third_party/prefix-mingw")
|
|
list(APPEND CMAKE_PREFIX_PATH "${_MINGW_PREFIX}")
|
|
set(CMAKE_FIND_ROOT_PATH "/usr/${_MINGW_HOST}" "${_MINGW_PREFIX}")
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
|
|
|
|
set(PDCurses_ROOT "${_MINGW_PREFIX}" CACHE PATH "PDCurses prefix")
|