Commit 740574c2 authored by Laurent Claustre's avatar Laurent Claustre

* SIPMacros.cmake: Fixed SIP code generation and compilation compatibility for Windows

* bootstrap.py: Fixed tab/space for python3
parent e2cc7b5b
......@@ -77,36 +77,44 @@ macro(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
endforeach (_x ${SIP_DISABLE_FEATURES})
set(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}")
set(_module_sbf ${_module_path}/${MODULE_NAME}.sbf)
execute_process(
COMMAND ${SIP_EXECUTABLE} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS}
${_sip_includes} -b ${_module_sbf}
${_abs_module_sip}
)
set(_lima_init_numpy_cpp)
# if(WIN32)
# set(COPY_COMMAND copy)
# else()
# set(COPY_COMMAND cp)
# endif()
set(_module_sbf ${_module_path}/${MODULE_NAME}.sbf)
execute_process(
COMMAND ${SIP_EXECUTABLE} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS}
${_sip_includes} -b ${_module_sbf}
${_abs_module_sip}
)
set(_lima_init_numpy_cpp)
if(NOT (${MODULE_NAME} STREQUAL "processlib"))
set(_lima_init_numpy "lima_init_numpy.cpp")
set(_lima_init_numpy_cpp ${_module_path}/${_lima_init_numpy})
add_custom_command(
OUTPUT ${_lima_init_numpy_cpp}
COMMAND cp ${CMAKE_SOURCE_DIR}/sip/${_lima_init_numpy}
# add_custom_command(
# OUTPUT ${_lima_init_numpy_cpp}
# COMMAND ${COPY_COMMAND} ${CMAKE_SOURCE_DIR}/sip/${_lima_init_numpy}
# ${_module_path}
# DEPENDS ${CMAKE_SOURCE_DIR}/sip/${_lima_init_numpy}
# )
configure_file(${CMAKE_SOURCE_DIR}/sip/${_lima_init_numpy}
${_module_path}
DEPENDS ${CMAKE_SOURCE_DIR}/sip/${_lima_init_numpy}
)
COPYONLY
)
endif()
set(_sip_output_files_list)
execute_process(
COMMAND grep "^sources[ ]*=[ ]*" ${_module_sbf}
COMMAND sed "s/^sources[ ]*=[ ]*//"
COMMAND bash -c "sed 's:\\([^ \\.]\\+\\.cpp\\):'$0'/\\1:g'"
${_module_path}
COMMAND sed "s/ /;/g"
OUTPUT_VARIABLE _sip_output_files_list
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/readsipsbf.py
${_module_sbf} ${_module_path}
OUTPUT_VARIABLE _sip_output_files_list
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(_sip_output_files)
foreach(filename IN LISTS _sip_output_files_list)
set(_sip_output_files ${_sip_output_files} ${filename})
......
......@@ -38,7 +38,7 @@ def checksipexc(ifname, inplace=False):
if lfname.startswith('/'):
sip_fname = os.path.realpath(sip_fname)
else:
lfname = os.path.join(os.curdir, lname)
lfname = os.path.join(os.curdir, lfname)
if not raise_exc:
bfile = open(sip_fname)
......
from __future__ import print_function
import sys, os
sbf_fname = sys.argv[1]
out_dir = sys.argv[2]
src_prefix = 'sources = '
for l in open(sbf_fname):
if l.startswith(src_prefix):
l = l[len(src_prefix):]
files = l.split()
s = ';'.join(map(lambda x: '%s/%s' % (out_dir, x), files))
print(s)
\ No newline at end of file
......@@ -99,7 +99,7 @@ def config_cmake_options(options):
def install_lima_linux():
os.chdir(os.getcwd()+"/build")
global install_path, install_python_path, find_root_path
global install_path, install_python_path, find_root_path
try:
if install_path != "": install_path = " -DCMAKE_INSTALL_PREFIX="+str(install_path)
if install_python_path != "": install_python_path = " -DPYTHON_SITE_PACKAGES_DIR="+str(install_python_path)
......@@ -114,7 +114,7 @@ def install_lima_linux():
install_check = os.system("make install")
if str(install_check)!="0":
raise Exception("CMake couldn't install libraries. Make sure you have necessaries rights.")
except Exception as inst:
except Exception as inst:
if str(cmake_check)!="0":
sys.exit("Problem in CMake configuration")
elif str(compilation_check)!="0":
......@@ -123,7 +123,7 @@ def install_lima_linux():
sys.exit("Problem in CMake installation")
def install_lima_windows():
global install_path, install_python_path, find_root_path
global install_path, install_python_path, find_root_path
# for windows check compat between installed python and mandatory vc++ compiler
# See, https://wiki.python.org/moin/WindowsCompilers
if sys.version_info < (2, 6):
......@@ -145,11 +145,11 @@ def install_lima_windows():
os.chdir(os.getcwd()+"/build")
try :
if install_path != "": install_path = " -DCMAKE_INSTALL_PREFIX="+str(install_path)
if install_python_path != "": install_python_path = " -DPYTHON_SITE_PACKAGES_DIR="+str(install_python_path)
if find_root_path != "": find_root_path = " -DCMAKE_FIND_ROOT_PATH="+str(find_root_path)
if install_path != "": install_path = " -DCMAKE_INSTALL_PREFIX="+str(install_path)
if install_python_path != "": install_python_path = " -DPYTHON_SITE_PACKAGES_DIR="+str(install_python_path)
if find_root_path != "": find_root_path = " -DCMAKE_FIND_ROOT_PATH="+str(find_root_path)
cmake_check = os.system(cmake_cmd+source_path+" "+cmake_config++install_path+install_python_path+find_root_path)
cmake_check = os.system(cmake_cmd+source_path+" "+cmake_config+install_path+install_python_path+find_root_path)
if str(cmake_check)!="0":
raise Exception("Something went wrong in the CMake preparation. Make sure your configuration is good.")
......@@ -189,7 +189,7 @@ if __name__ == '__main__':
if "--install-python-prefix=" in option:
install_python_path=option[24:]
if "--find-root-path=" in option:
print (option)
print (option)
find_root_path=option[17:]
if OS_TYPE=="Linux":
install_lima_linux()
......
......@@ -516,6 +516,14 @@ return aReturnListPt;
%End
};
%ModuleHeaderCode
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "numpy/numpyconfig.h"
#if (defined(NPY_API_VERSION) && NPY_API_VERSION >= 0x00000004 && PY_VERSION_HEX >= 0x03000000)
#include "numpy/npy_3kcompat.h"
#endif
%End
%UnitCode
#include <lima_repr_attr.cpp>
%End
......
......@@ -11,6 +11,14 @@ void lima_import_array();
}
%End
%ModuleHeaderCode
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "numpy/numpyconfig.h"
#if (defined(NPY_API_VERSION) && NPY_API_VERSION >= 0x00000004 && PY_VERSION_HEX >= 0x03000000)
#include "numpy/npy_3kcompat.h"
#endif
%End
%UnitCode
#include <lima_repr_attr.cpp>
%End
......
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