From 4c5afc5fd97408ae62c4dbeb922b7007acd8fb18 Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Mon, 14 Aug 2017 15:09:04 +0200 Subject: [PATCH] Added conda build files to utilities --- apps/pythonmodule/setup.py | 26 +++++++++++++++----- utilities/conda/cmake/bld.bat | 30 +++++++++++++++++++++++ utilities/conda/cmake/meta.yaml | 36 ++++++++++++++++++++++++++++ utilities/conda/withLbm/build.sh | 7 ++++++ utilities/conda/withLbm/meta.yaml | 26 ++++++++++++++++++++ utilities/conda/withoutLbm/bld.bat | 16 +++++++++++++ utilities/conda/withoutLbm/build.sh | 7 ++++++ utilities/conda/withoutLbm/meta.yaml | 27 +++++++++++++++++++++ 8 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 utilities/conda/cmake/bld.bat create mode 100644 utilities/conda/cmake/meta.yaml create mode 100644 utilities/conda/withLbm/build.sh create mode 100644 utilities/conda/withLbm/meta.yaml create mode 100644 utilities/conda/withoutLbm/bld.bat create mode 100644 utilities/conda/withoutLbm/build.sh create mode 100644 utilities/conda/withoutLbm/meta.yaml diff --git a/apps/pythonmodule/setup.py b/apps/pythonmodule/setup.py index 0d5e53ef..146f6238 100644 --- a/apps/pythonmodule/setup.py +++ b/apps/pythonmodule/setup.py @@ -1,26 +1,41 @@ from distutils.core import setup import shutil from os.path import exists, join +import platform +import sys # The following variables are configure by CMake walberla_source_dir = "${walberla_SOURCE_DIR}" walberla_binary_dir = "${CMAKE_CURRENT_BINARY_DIR}" +if platform.system() == 'Windows': + extension = ( 'dll', 'pyd' ) + configuration = 'Release' +else: + extension = ( 'so', 'so' ) + configuration = '' + + def collectFiles(): - shared_lib = join(walberla_binary_dir, 'walberla_cpp.so' ) + src_shared_lib = join(walberla_binary_dir, configuration, 'walberla_cpp.' + extension[0] ) + dst_shared_lib = join(walberla_binary_dir, 'waLBerla', 'walberla_cpp.' + extension[1] ) # copy everything inplace - if not exists( shared_lib ): + + print( src_shared_lib ) + + if not exists( src_shared_lib ): print("Python Module was not built yet - run 'make walberla_cpp'") exit(1) + shutil.rmtree( join(walberla_binary_dir, 'waLBerla'), ignore_errors=True ) shutil.copytree( join(walberla_source_dir, 'python', 'waLBerla'), join(walberla_binary_dir, 'waLBerla') ) - shutil.copy( shared_lib, - join(walberla_binary_dir, 'waLBerla', 'walberla_cpp.so') ) + shutil.copy( src_shared_lib, + dst_shared_lib ) packages = ['waLBerla', 'waLBerla.evaluation', @@ -39,10 +54,9 @@ setup( name='waLBerla', author_email='martin.bauer@fau.de', url='http://www.walberla.net', packages=packages, - package_data = {'' : ['walberla_cpp.so'] } + package_data = {'' : ['walberla_cpp.' + extension[1]] } ) -import sys if sys.argv[1] == 'build': print("\nCollected all files for waLBerla Python module.\n" " - to install run 'make pythonModuleInstall'\n" diff --git a/utilities/conda/cmake/bld.bat b/utilities/conda/cmake/bld.bat new file mode 100644 index 00000000..3c26e88d --- /dev/null +++ b/utilities/conda/cmake/bld.bat @@ -0,0 +1,30 @@ +:: move bin\* %LIBRARY_BIN%\ +:: if errorlevel 1 exit 1 + +:: move share %LIBRARY_PREFIX%\ +:: if errorlevel 1 exit 1 + + +:: fetch a bootstrap cmake +pushd %TEMP% +curl -SLO https://cmake.org/files/v3.9/cmake-3.9.1-win32-x86.zip +unzip -q -o cmake-3.9.1-win32-x86.zip +set PATH=%CD%\cmake-3.9.1-win32-x86\bin;%PATH% +popd + +set CMAKE_GENERATOR=NMake Makefiles JOM +mkdir build +cd build + +cmake -G "%CMAKE_GENERATOR%" ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DBUILD_SHARED_LIBS=True .. ^ + -DBUILD_QtDialog=False + +if errorlevel 1 exit 1 + +cmake --build . --config Release --target all +cmake --build . --config Release --target install +if errorlevel 1 exit 1 diff --git a/utilities/conda/cmake/meta.yaml b/utilities/conda/cmake/meta.yaml new file mode 100644 index 00000000..320f54f7 --- /dev/null +++ b/utilities/conda/cmake/meta.yaml @@ -0,0 +1,36 @@ +# This file created by conda-build 0+unknown +# meta.yaml template originally from: +# c:\users\ray\conda\anaconda\packages\cmake, last modified Mon Nov 21 11:52:59 2016 +# ------------------------------------------------ + +package: + name: cmake + version: 3.9.1 +source: + sha256: d768ee83d217f91bb597b3ca2ac663da7a8603c97e1f1a5184bc01e0ad2b12bb + url: https://cmake.org/files/v3.9/cmake-3.9.1.tar.gz +build: + features: + - vc14 + number: '0' +requirements: + build: + - python + - m2-curl + - m2-unzip + - jom + - zlib 1.2.* + run: + - zlib 1.2.* +test: + commands: + - cmake --version + requires: + - python +about: + dev_url: https://gitlab.kitware.com/cmake/cmake/ + doc_url: https://cmake.org/documentation/ + home: http://www.cmake.org/ + license: BSD 3-clause + license_family: BSD + summary: CMake is an extensible, open-source system that manages the build process diff --git a/utilities/conda/withLbm/build.sh b/utilities/conda/withLbm/build.sh new file mode 100644 index 00000000..6633c771 --- /dev/null +++ b/utilities/conda/withLbm/build.sh @@ -0,0 +1,7 @@ +mkdir build +cd build +export BOOST_ROOT=$PREFIX + +CC=mpicc CXX=mpicxx cmake .. -DWALBERLA_BUILD_WITH_PYTHON=1 -DWALBERLA_BUILD_WITH_PYTHON_MODULE=1 -DWALBERLA_BUILD_WITH_PYTHON_LBM=1 + +make -j 8 pythonModuleInstall diff --git a/utilities/conda/withLbm/meta.yaml b/utilities/conda/withLbm/meta.yaml new file mode 100644 index 00000000..dfa5f661 --- /dev/null +++ b/utilities/conda/withLbm/meta.yaml @@ -0,0 +1,26 @@ +about: + home: www.walberla.net + license: GPLv3 +package: + name: walberla-lbm + version: {{ GIT_DESCRIBE_TAG }} +build: + number: {{ GIT_DESCRIBE_NUMBER }} + + +requirements: + build: + - python + - git + - boost + - cmake + - gcc [linux] + - mpich2 [linux] + run: + - python >=3.6 + - boost + - numpy + - mpich2 [linux] +source: + git_rev: master + git_url: https://i10git.cs.fau.de/walberla/walberla.git diff --git a/utilities/conda/withoutLbm/bld.bat b/utilities/conda/withoutLbm/bld.bat new file mode 100644 index 00000000..ead78eca --- /dev/null +++ b/utilities/conda/withoutLbm/bld.bat @@ -0,0 +1,16 @@ +mkdir build +cd build + +set BOOST_ROOT=%PREFIX% +cmake -LAH -G"Visual Studio 15 2017 Win64" ^ + -DWALBERLA_BUILD_WITH_PYTHON=ON ^ + -DWALBERLA_BUILD_WITH_PYTHON_MODULE=ON ^ + -DWALBERLA_BUILD_WITH_MPI=OFF ^ + -DWALBERLA_BUILD_WITH_OPENMP=ON ^ + -DPYTHON_EXECUTABLE="%PYTHON%" ^ + -DBoost_USE_STATIC_LIBS=OFF ^ + -DBoost_USE_MULTITHREADED=ON .. +if errorlevel 1 exit 1 + +cmake --build . --config Release --target pythonModuleInstall +if errorlevel 1 exit 1 \ No newline at end of file diff --git a/utilities/conda/withoutLbm/build.sh b/utilities/conda/withoutLbm/build.sh new file mode 100644 index 00000000..7839cb74 --- /dev/null +++ b/utilities/conda/withoutLbm/build.sh @@ -0,0 +1,7 @@ +mkdir build +cd build +export BOOST_ROOT=$PREFIX + +CC=mpicc CXX=mpicxx cmake .. -DWALBERLA_BUILD_WITH_PYTHON=1 -DWALBERLA_BUILD_WITH_PYTHON_MODULE=1 + +make -j 8 pythonModuleInstall diff --git a/utilities/conda/withoutLbm/meta.yaml b/utilities/conda/withoutLbm/meta.yaml new file mode 100644 index 00000000..1aced44a --- /dev/null +++ b/utilities/conda/withoutLbm/meta.yaml @@ -0,0 +1,27 @@ +about: + home: www.walberla.net + license: GPLv3 +package: + name: walberla + version: {{ GIT_DESCRIBE_TAG }} +build: + number: {{ GIT_DESCRIBE_NUMBER }} + + +requirements: + build: + - python + - git + - boost + - cmake [linux] + - cmake >=3.7.0 [win] + - gcc [linux] + - mpich2 [linux] + run: + - python + - boost + - numpy + - mpich2 [linux] +source: + git_rev: master + git_url: https://i10git.cs.fau.de/walberla/walberla.git -- GitLab