diff --git a/CMakeLists.txt b/CMakeLists.txt index a7095670..f7e00a00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,6 +337,12 @@ IF ( COOLPROP_OBJECT_LIBRARY OR COOLPROP_STATIC_LIBRARY OR COOLPROP_SHARED_LIBRA SET_PROPERTY (TARGET ${LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS " -m${BITNESS}") SET_PROPERTY (TARGET ${LIB_NAME} APPEND_STRING PROPERTY LINK_FLAGS " -m${BITNESS}") ENDIF() + + # ADD -fPIC flag if needed + IF (COOLPROP_FPIC) + MESSAGE(STATUS "Setting bitness flag -m${BITNESS}") + SET_PROPERTY (TARGET ${LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS " -fPIC") + ENDIF() # # calling conventions IF ( ("${CONVENTION}" STREQUAL "NULL") OR ("${CONVENTION}" STREQUAL "") ) diff --git a/wrappers/Python/manylinux/Dockerfile b/wrappers/Python/manylinux/Dockerfile index aee5c56e..5b7d9245 100644 --- a/wrappers/Python/manylinux/Dockerfile +++ b/wrappers/Python/manylinux/Dockerfile @@ -1,9 +1,11 @@ FROM quay.io/pypa/manylinux1_x86_64 -# Install Cmake +# Install Cmake (either from source (reliable) or from yum (64-bit only, and it doesn't symlink in a cmake executable)) +# ALTERNATE: RUN yum install -y cmake28 && ln -s `which cmake28` /usr/local/bin/cmake RUN wget --no-check-certificate http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz && tar -zxvf cmake-2.8.10.2.tar.gz && cd cmake-2.8.10.2 && ./bootstrap && make && make install +# Install virtualenv into one of the python installations for creating other virtual environments RUN /opt/python/cp27-cp27m/bin/pip install virtualenv # Create virtual environments @@ -14,8 +16,8 @@ RUN /opt/python/cp27-cp27m/bin/virtualenv /py34 --python=/opt/python/cp34-cp34m/ RUN /opt/python/cp27-cp27m/bin/virtualenv /py35 --python=/opt/python/cp35-cp35m/bin/python # Install pip packages needed -RUN /py27/bin/pip install cython virtualenv auditwheel -RUN /py27mu/bin/pip install cython virtualenv -RUN /py33/bin/pip install cython virtualenv -RUN /py34/bin/pip install cython virtualenv -RUN /py35/bin/pip install cython virtualenv \ No newline at end of file +RUN /py27/bin/pip install cython +RUN /py27mu/bin/pip install cython +RUN /py33/bin/pip install cython +RUN /py34/bin/pip install cython +RUN /py35/bin/pip install cython \ No newline at end of file diff --git a/wrappers/Python/manylinux/build_wheels.sh b/wrappers/Python/manylinux/build_wheels.sh index 97298bc2..e9c632b9 100755 --- a/wrappers/Python/manylinux/build_wheels.sh +++ b/wrappers/Python/manylinux/build_wheels.sh @@ -15,17 +15,15 @@ cd ${DIR}/../pypi # deactivate cd ${DIR}/.. -rm -rf cmake_build for PYBIN in /py*; do source ${PYBIN}/bin/activate c++ --version - python setup.py bdist_wheel cmake=default,64 --install-dir + python setup.py bdist_wheel cmake=default,64 deactivate done # Bundle external shared libraries into the wheels -for whl in wheelhouse/*.whl; do - source /py27/bin/activate - auditwheel repair $whl -w /io/wheelhouse/ - deactivate +for whl in dist/*.whl; do + # auditwheel comes in base image + auditwheel repair $whl -w ../../install_root/Python done \ No newline at end of file diff --git a/wrappers/Python/setup.py b/wrappers/Python/setup.py index e63c86e7..98220259 100644 --- a/wrappers/Python/setup.py +++ b/wrappers/Python/setup.py @@ -134,12 +134,17 @@ if __name__=='__main__': raise ValueError('cmake_bitness must be either 32 or 64; got ' + cmake_bitness) else: raise ValueError('cmake_compiler [' + cmake_compiler + '] is invalid') + + if 'Darwin' in sys.platform: + cmake_config_args += ['-DCOOLPROP_OSX_105_COMPATIBILITY=ON'] + if 'linux' in sys.platform: + cmake_config_args += ['-DCOOLPROP_FPIC=ON'] cmake_build_dir = os.path.join('cmake_build', '{compiler}-{bitness}bit'.format(compiler=cmake_compiler, bitness=cmake_bitness)) if not os.path.exists(cmake_build_dir): os.makedirs(cmake_build_dir) - cmake_call_string = ' '.join(['cmake','../../../..','-DCOOLPROP_STATIC_LIBRARY=ON','-DCMAKE_VERBOSE_MAKEFILE=ON','-DCOOLPROP_OSX_105_COMPATIBILITY=ON','-DCMAKE_BUILD_TYPE=Release'] + cmake_config_args) + cmake_call_string = ' '.join(['cmake','../../../..','-DCOOLPROP_STATIC_LIBRARY=ON','-DCMAKE_VERBOSE_MAKEFILE=ON','-DCMAKE_BUILD_TYPE=Release'] + cmake_config_args) print('calling: ' + cmake_call_string) subprocess.check_call(cmake_call_string, shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd = cmake_build_dir)