Skip to content
Snippets Groups Projects
Commit cc79e224 authored by Dilawar Singh's avatar Dilawar Singh
Browse files

multiple fix to build system.

- dont use python setup.py install . It does not work anymore if --prefix
  directory is not in PYTHONPATH.
- Use python setup.py bdist -d INSTALL_DIR and let cmake unarchive and copy it
  to desired location. This is much better solution.
parent 25e069db
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,16 @@ option(WITH_CUDA "Use CUDA/GPU" OFF) ...@@ -28,6 +28,16 @@ option(WITH_CUDA "Use CUDA/GPU" OFF)
option(WITH_MPI "Use MPI (experimental)" OFF) option(WITH_MPI "Use MPI (experimental)" OFF)
option(WITH_GUI "Install moose-gui. Works only with python2." ON ) option(WITH_GUI "Install moose-gui. Works only with python2." ON )
# get platform and arch using python.
find_package( PythonInterp REQUIRED)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print('%s-%s'%(sys.platform,sys.arch))"
OUTPUT_VARIABLE PY_PLATFORM_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Building bdist for arch - ${PY_PLATFORM_ARCH}")
# On python3. Do not install GUI. # On python3. Do not install GUI.
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
if(PYTHON_VERSION_MAJOR VERSION_EQUAL 3) if(PYTHON_VERSION_MAJOR VERSION_EQUAL 3)
...@@ -86,6 +96,11 @@ configure_file( ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in ...@@ -86,6 +96,11 @@ configure_file( ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in
add_custom_target( moose-core ALL DEPENDS ${OUTPUT_MOOSEBIN} ) add_custom_target( moose-core ALL DEPENDS ${OUTPUT_MOOSEBIN} )
add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN} add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN}
COMMAND MAKE=$(MAKE) bash -c ${CMAKE_BINARY_DIR}/build_moose-core.sh COMMAND MAKE=$(MAKE) bash -c ${CMAKE_BINARY_DIR}/build_moose-core.sh
# Note that this command requires us to be in the same directory where we
# want to extract the tar file.
COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_INSTALL_DIR}
tar xvf ${PYMOOSE_BUILD_DIR}/pymoose-${MOOSE_VERSION}.${PY_PLATFORM_ARCH}.tar.gz
COMMENT "Building bdist and unarchiving it"
VERBATIM VERBATIM
) )
add_dependencies(moose moose-core) add_dependencies(moose moose-core)
...@@ -114,6 +129,7 @@ endif() ...@@ -114,6 +129,7 @@ endif()
# TODO: moose-gui should be a python module. # TODO: moose-gui should be a python module.
set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui) set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
# Install pymoose. Use tar.gz in PYMOOSE_BUILD_DIR and unarchive it.
install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/ install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/
DESTINATION ${CMAKE_INSTALL_PREFIX} DESTINATION ${CMAKE_INSTALL_PREFIX}
PATTERN ".git" EXCLUDE PATTERN ".git" EXCLUDE
......
...@@ -458,9 +458,20 @@ endif() ...@@ -458,9 +458,20 @@ endif()
if(NOT PYMOOSE_BDIST_DIR) if(NOT PYMOOSE_BDIST_DIR)
set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/pymoose_bdist) set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/pymoose_bdist)
endif( ) endif( )
# get platform and arch using python.
find_package( PythonInterp REQUIRED)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print('%s-%s'%(sys.platform,sys.arch))"
OUTPUT_VARIABLE PY_PLATFORM_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# If not set, use default.
if(NOT PY_PLATFORM_ARCH)
mes(PY_PLATFORM_ARCH "linux-x86_64")
endif( )
message(STATUS "Building bdist for arch: ${PY_PLATFORM_ARCH}")
add_custom_target( bdist add_custom_target( bdist
DEPENDS pymoose COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist -p ${PY_PLATFORM_ARCH} -d ${PYMOOSE_BDIST_DIR}
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist -d ${PYMOOSE_BDIST_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
COMMENT "Genearating bdist using setup.cmake.py." COMMENT "Genearating bdist using setup.cmake.py."
VERBATIM VERBATIM
......
...@@ -25,15 +25,12 @@ try: ...@@ -25,15 +25,12 @@ try:
except Exception as e: except Exception as e:
from distutils.core import setup from distutils.core import setup
# Read version from VERSION created by cmake file. This file must be present for
# setup.cmake.py to work perfectly.
script_dir = os.path.dirname( os.path.abspath( __file__ ) ) script_dir = os.path.dirname( os.path.abspath( __file__ ) )
version = '3.2.0-git' version = None
with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f:
try: version = f.read( )
with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f:
version = f.read( )
except Exception as e:
print( 'Failed to read VERSION from file due to: %s' % e )
print( 'Using default %s' % version )
try: try:
import importlib.machinery import importlib.machinery
......
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