Welcome to mirror list, hosted at ThFree Co, Russian Federation.

toolchain-winegcc.cmake « cmake - github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 73a9e53e0c1f84f9b684e332b4f1f8440006f9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Toolchain file for cross-building a Winelib version of Windows PuTTY
# on Linux, using winegcc (tested on Ubuntu).

# Winelib is weird because it's basically compiling ordinary Linux
# objects and executables, but we want to pretend to be Windows for
# purposes of (a) having resource files, and (b) selecting the Windows
# platform subdirectory.
#
# So, do we tag this as a weird kind of Windows build, or a weird kind
# of Linux build? Either way we have to do _something_ out of the
# ordinary.
#
# After some experimentation, it seems to make more sense to treat
# Winelib builds as basically Linux, and set a flag WINELIB that
# PuTTY's main build scripts will detect and handle specially.
# Specifically, that flag will cause cmake/setup.cmake to select the
# Windows platform (overriding the usual check of CMAKE_SYSTEM_NAME),
# and also trigger a call to enable_language(RC), which for some kind
# of cmake re-entrancy reason we can't do in this toolchain file
# itself.
set(CMAKE_SYSTEM_NAME Linux)
set(WINELIB ON)

# We need a wrapper script around winegcc proper, because cmake's link
# command lines will refer to system libraries as "-lkernel32.lib"
# rather than the required "-lkernel32". The winegcc script alongside
# this toolchain file bodges that command-line translation.
set(CMAKE_C_COMPILER ${CMAKE_SOURCE_DIR}/cmake/winegcc)

set(CMAKE_RC_COMPILER wrc)
set(CMAKE_RC_OUTPUT_EXTENSION .res.o)
set(CMAKE_RC_COMPILE_OBJECT
    "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")