blob: 0dcf43769f0383b888d262a76258b33903acc031 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
if (NOT CMAKE_HOST_UNIX OR NOT WIN32)
return()
endif()
find_program(WINTOOLS_WINE_EXEC wine)
if (NOT WINTOOLS_WINE_EXEC)
message("Wine executable not found! Failed to initiate wintools staff.")
return()
endif()
find_program(WINTOOLS_WGET_EXEC wget)
if (NOT WINTOOLS_WGET_EXEC)
message("Wget executable not found! Failed to initiate wintools staff.")
return()
endif()
set(WINTOOLS_DIR ${CMAKE_BINARY_DIR}/WINTOOLS)
set(WINTOOLS_DL_ROOT "https://dl.dropboxusercontent.com/u/4709222/windev")
if (NOT EXISTS ${WINTOOLS_DIR})
file(MAKE_DIRECTORY ${WINTOOLS_DIR})
endif()
set(WINTOOLS_EXECS)
foreach (WINTOOLS_EXEC link.exe lib.exe mspdb100.dll)
if (NOT EXISTS ${WINTOOLS_DIR}/${WINTOOLS_EXEC})
add_custom_command(OUTPUT ${WINTOOLS_DIR}/${WINTOOLS_EXEC}
COMMAND ${WINTOOLS_WGET_EXEC} ${WINTOOLS_DL_ROOT}/${WINTOOLS_EXEC} -nv -O${WINTOOLS_DIR}/${WINTOOLS_EXEC}
WORKING_DIRECTORY ${WINTOOLS_DIR})
list(APPEND WINTOOLS_EXECS ${WINTOOLS_DIR}/${WINTOOLS_EXEC})
endif()
endforeach(WINTOOLS_EXEC)
add_custom_target(wintools_init
DEPENDS ${WINTOOLS_EXECS})
if (${PROJECT_ARCH} STREQUAL "x86_64")
set(WINTOOLS_LIB_MACHINE "X64")
else()
set(WINTOOLS_LIB_MACHINE "X86")
endif()
macro(add_w32_importlib tgt libname wdir)
add_custom_command(
TARGET ${tgt}
POST_BUILD
COMMAND ${WINTOOLS_WINE_EXEC} ${WINTOOLS_DIR}/lib.exe /def:${libname}.def /machine:${WINTOOLS_LIB_MACHINE}
WORKING_DIRECTORY ${wdir}
)
endmacro(add_w32_importlib)
|