Commit 3a40ddec authored by Ben Boeckel's avatar Ben Boeckel
Browse files

python: use a cmake-ified python which supports static builds

parent 20085d18
......@@ -2,20 +2,52 @@ if (APPLE)
message(FATAL_ERROR "ABORT")
endif()
if(BUILD_SHARED_LIBS)
set(shared_args --enable-shared --disable-static)
else()
set(shared_args --disable-shared --enable-static)
set(shared ${BUILD_SHARED_LIBS})
if (BUILD_SHARED_LIBS)
set(static OFF)
else ()
set(static ON)
endif ()
if (CROSS_BUILD_STAGE STREQUAL "TOOLS")
set(shared OFF)
set(static ON)
endif()
set(extra_args)
if (static)
list(APPEND extra_args
-DWITH_THREAD:BOOL=OFF
-DPYTHON_ALL_BUILTIN:BOOL=ON
-DENABLE_CURSES:BOOL=OFF
-DENABLE_CURSES_PANEL:BOOL=OFF
-DENABLE_MULTIPROCESSING:BOOL=OFF
-DENABLE_TKINTER:BOOL=OFF
-DBUILTIN_CRYPT:BOOL=OFF
-DBUILTIN_CTYPES:BOOL=OFF
-DBUILTIN_ELEMENTTREE:BOOL=OFF
-DBUILTIN_EXPAT:BOOL=OFF
-DBUILTIN_NIS:BOOL=OFF
-DBUILTIN_PYEXPAT:BOOL=OFF
-DBUILTIN_TESTCAPI:BOOL=OFF)
endif ()
if (WIN32)
# Requires OpenSSL. Should look into how to avoid this altogether since the
# stock build obviously used something else.
list(APPEND extra_args
-DENABLE_HASHLIB:BOOL=OFF
-DENABLE_SSL:BOOL=OFF)
endif ()
add_external_project_or_use_system(python
DEPENDS bzip2 zlib png
CONFIGURE_COMMAND <SOURCE_DIR>/configure
--prefix=<INSTALL_DIR>
--enable-unicode
${shared_args}
CMAKE_ARGS
-DBUILD_SHARED:BOOL=${shared}
-DBUILD_STATIC:BOOL=${static}
-DPy_USING_UNICODE:BOOL=ON
${extra_args}
)
if (NOT CROSS_BUILD_STAGE STREQUAL "CROSS")
if (NOT CROSS_BUILD_STAGE STREQUAL "CROSS" AND NOT MSVC)
# Pass the -rpath flag when building python to avoid issues running the
# executable we built.
append_flags(LDFLAGS "-Wl,-rpath,${install_location}/lib" PROJECT_ONLY)
......
set (configuration)
set (python_executable_dir)
if (64bit_build)
set (configuration "Release|x64")
set (python_executable_dir
"${SuperBuild_BINARY_DIR}/python/src/python/PCbuild/amd64")
else()
set (configuration "Release|Win32")
set (python_executable_dir
"${SuperBuild_BINARY_DIR}/python/src/python/PCbuild")
endif()
#------------------------------------------------------------------------------
# in the following build commands, we use devenv explicitly since the generator
# the user has chosen could be nmake, in which case CMAKE_BUILD_TOOL is not the
# right tool. Since devenv is in the path in the nmake build environment as well
# as VS environment, we can safely call it.
add_external_project_or_use_system(python
DEPENDS bzip2 zlib
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${DEVENV_PATH} PCbuild/pcbuild.sln /build ${configuration}
/project python
#devenv doesn't seem to building all specified projects when I list them in
#same command line. So making them separate calls.
# We need to copy pyconfig.h from PC/ to Include.
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different
<SOURCE_DIR>/PC/pyconfig.h
<SOURCE_DIR>/Include/pyconfig.h
)
#------------------------------------------------------------------------------
set (python_projects_to_build
select
make_versioninfo
make_buildinfo
kill_python
w9xpopen
pythoncore
_socket
_testcapi
_msi
_elementtree
_ctypes_test
_ctypes
winsound
pyexpat
_multiprocessing
pythonw
unicodedata
)
foreach(dep IN LISTS python_projects_to_build)
add_external_project_step(python-project-${dep}
COMMAND ${DEVENV_PATH} <SOURCE_DIR>/PCbuild/pcbuild.sln /build ${configuration}
/project ${dep}
DEPENDEES build
DEPENDERS install)
endforeach()
#------------------------------------------------------------------------------
set (pv_python_executable "${python_executable_dir}/python.exe")
add_extra_cmake_args(
-DPYTHON_EXECUTABLE:FILEPATH=${python_executable_dir}/python.exe
-DPYTHON_INCLUDE_DIR:FILEPATH=${SuperBuild_BINARY_DIR}/python/src/python/Include
-DPYTHON_LIBRARY:FILEPATH=${python_executable_dir}/python27.lib)
......@@ -62,15 +62,9 @@ add_revision(qt
URL "http://paraview.org/files/dependencies/qt-everywhere-opensource-src-4.8.6.tar.gz"
URL_MD5 2edbe4d6c2eff33ef91732602f3518eb)
if (WIN32 OR (CROSS_BUILD_STAGE STREQUAL "CROSS"))
add_revision(python
URL "http://www.paraview.org/files/dependencies/Python-2.7.3.tgz"
URL_MD5 "2cf641732ac23b18d139be077bd906cd")
else()
add_revision(python
URL "http://paraview.org/files/dependencies/Python-2.7.2.tgz"
URL_MD5 "0ddfe265f1b3d0a8c2459f5bf66894c7")
endif()
add_revision(python
URL "http://www.paraview.org/files/dependencies/python-2.7.3+cmake+static.tar.bz2"
URL_MD5 035b4c7e112fbf79b1089782b6b985aa)
add_revision(numpy
URL "http://paraview.org/files/dependencies/numpy-1.8.1+cmake+static.tar.bz2"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment