forked from KDE/krita
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (63 loc) · 3 KB
/
CMakeLists.txt
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
SET(PREFIX_ext_sip "${EXTPREFIX}" )
if(UNIX)
ExternalProject_Add( ext_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.python.org/packages/source/s/sip/sip-6.6.2.tar.gz
URL_HASH SHA256=0e3efac1c5dfd8e525ae57140927df26993e13f58b89d1577c314f4105bfd90d
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E env
"PYTHONPATH=${KRITA_PYTHONPATH}"
${Python_EXECUTABLE} <SOURCE_DIR>/setup.py build -j ${SUBMAKE_JOBS}
INSTALL_COMMAND ${CMAKE_COMMAND} -E env
"PYTHONPATH=${KRITA_PYTHONPATH}"
${Python_EXECUTABLE} <SOURCE_DIR>/setup.py install --skip-build --prefix=${PREFIX_ext_sip} --optimize=1
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
elseif (WIN32)
if(MINGW)
set(_compiler -c mingw32)
elseif(MSVC)
set(_compiler -c msvc)
endif()
krita_to_native_path("${PREFIX_ext_sip}" _sip_prefix)
krita_to_native_path("${KRITA_PYTHONPATH}" _krita_pythonpath)
string(TOLOWER ${_krita_pythonpath} _krita_pythonpath)
krita_to_native_environment_path_list("${_krita_pythonpath}" _krita_pythonpath)
ExternalProject_Add( ext_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.python.org/packages/source/s/sip/sip-6.6.2.tar.gz
URL_HASH SHA256=0e3efac1c5dfd8e525ae57140927df26993e13f58b89d1577c314f4105bfd90d
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${_krita_pythonpath}
SETUPTOOLS_USE_DISTUTILS=local
${Python_EXECUTABLE} <SOURCE_DIR>/setup.py build -j ${SUBMAKE_JOBS} ${_compiler}
# HACK: Create lib\site-packages before installing
# See e.g. https://access.redhat.com/errata/RHBA-2020:4437
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${_sip_prefix}\\lib\\site-packages
COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${_krita_pythonpath}
SETUPTOOLS_USE_DISTUTILS=local
${Python_EXECUTABLE} <SOURCE_DIR>/setup.py install --skip-build --prefix=${_sip_prefix} --optimize=1 --install-scripts=${_sip_prefix}\\bin
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
if (MINGW)
ExternalProject_Add_Step(ext_sip
wheel_update_setuptools
COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${_krita_pythonpath}
PYTHONUSERBASE=${_sip_prefix}
${Python_EXECUTABLE} -m pip install -U pip setuptools>==59.8.0
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../ext_python/sitecustomize.py ${_sip_prefix}\\lib\\site-packages
DEPENDERS build
)
message(STATUS "Using mingw, Will deploy workaround for setuptools.")
ExternalProject_Add_Step(ext_sip
distutils_system_mod
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../ext_python/_distutils_system_mod.py ${_sip_prefix}\\lib\\site-packages
DEPENDERS build
)
endif()
endif()