CMakeLists.txt 3.13 KB
Newer Older
1 2
SET(PREFIX_ext_sip "${EXTPREFIX}" )
if (UNIX)
3 4 5 6 7 8
    if(NOT APPLE)
      SET(PYTHON_EXECUTABLE_PATH ${PREFIX_ext_sip}/bin/python3)
      if(NOT EXISTS ${PYTHON_EXECUTABLE_PATH})
        message("WARNING: using system python3!")
        SET(PYTHON_EXECUTABLE_PATH python3)
      endif()
9

10
        ExternalProject_Add( ext_sip
11
        DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
Boudewijn Rempt's avatar
Boudewijn Rempt committed
12 13
        URL https://www.riverbankcomputing.com/static/Downloads/sip/4.19.15/sip-4.19.15.tar.gz
        URL_MD5 236578d2199da630ae1251671b9a7bfe
14

15
        CONFIGURE_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/configure.py -b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/lib/python3.5/site-packages -e ${PREFIX_ext_sip}/include  --sipdir ${PREFIX_ext_sip}/sip --target-py-version 3.5 --sip-module PyQt5.sip
16 17
        BUILD_COMMAND make
        INSTALL_COMMAND make install
18

19
            BUILD_IN_SOURCE 1
20

21 22 23 24 25 26 27 28 29 30 31 32 33
            UPDATE_COMMAND ""
        )
    else(APPLE)
        if(NOT PYTHONINTERP_FOUND)
            SET(PYTHON_EXECUTABLE ${PREFIX_ext_sip}/bin/python3)
            if(NOT EXISTS "${PYTHON_EXECUTABLE}")
                message("WARNING: using system python3!")
                SET(PYTHON_EXECUTABLE python3)
            endif()
        endif()

        ExternalProject_Add( ext_sip
            DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
34 35
            URL https://www.riverbankcomputing.com/static/Downloads/sip/4.19.15/sip-4.19.15.tar.gz
            URL_MD5 236578d2199da630ae1251671b9a7bfe
36

37 38 39 40
            CMAKE_ARGS -DPYTHON_INCLUDE_DIR=${PREFIX_ext_sip}/lib/Python.framework/Headers
            CONFIGURE_COMMAND ${PYTHON_EXECUTABLE} <SOURCE_DIR>/configure.py --deployment-target=10.11
                -b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/ 
                -e ${PREFIX_ext_sip}/include --sipdir ${PREFIX_ext_sip}/share/sip --target-py-version 3.5 --sip-module PyQt5.sip
41 42
            BUILD_COMMAND make
            INSTALL_COMMAND make install
43 44
                # COMMAND ${CMAKE_COMMAND} -E create_symlink ./PyQt5/sip.so ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/sip.so
                # COMMAND ${CMAKE_COMMAND} -E create_symlink ./PyQt5/sip.pyi ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/sip.pyi
45 46 47 48 49 50

            BUILD_IN_SOURCE 1

            UPDATE_COMMAND ""
        )
    endif()
Boudewijn Rempt's avatar
Boudewijn Rempt committed
51
elseif (MINGW)
52 53 54
    list(APPEND _SIP_conf
        --platform win32-g++
        -b ${PREFIX_ext_sip}/bin
55
        -d ${PREFIX_ext_sip}/lib/krita-python-libs
56 57 58
        -e ${PREFIX_ext_sip}/include
        --sipdir ${PREFIX_ext_sip}/share/sip
        --target-py-version 3.6
59
        --sip-module PyQt5.sip
60
    )
Boudewijn Rempt's avatar
Boudewijn Rempt committed
61 62
    ExternalProject_Add( ext_sip
        DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
Boudewijn Rempt's avatar
Boudewijn Rempt committed
63
        URL https://www.riverbankcomputing.com/static/Downloads/sip/4.19.15/sip-4.19.15.zip
Boudewijn Rempt's avatar
Boudewijn Rempt committed
64
        URL_MD5 4a1a4760cfabef15d68f45a6920974c2
65

66
        CONFIGURE_COMMAND ${PYTHON_EXECUTABLE} <SOURCE_DIR>/configure.py ${_SIP_conf}
67
        BUILD_COMMAND mingw32-make -j${SUBMAKE_JOBS} LDFLAGS=${SECURITY_SHARED_LINKER_FLAGS}
68
        INSTALL_COMMAND mingw32-make -j${SUBMAKE_JOBS} install
Boudewijn Rempt's avatar
Boudewijn Rempt committed
69 70 71
        
        BUILD_IN_SOURCE 1

72 73 74 75
        UPDATE_COMMAND ""
    )
endif()