Konstantin Ladutenko 2 jaren geleden
bovenliggende
commit
f0ac224598
2 gewijzigde bestanden met toevoegingen van 262 en 98 verwijderingen
  1. 1 1
      .github/workflows/cmake.yml
  2. 261 97
      Makefile

+ 1 - 1
.github/workflows/cmake.yml

@@ -22,7 +22,7 @@ jobs:
 
       # without GTest and Boost
       - name: Install Python NumPy
-        run: sudo apt install python-numpy python-all-dev python-numpy-dev pybind11
+        run: sudo apt install python-numpy python-all-dev python-numpy-dev python3-pybind11
 
       - name: Configure CMake
         # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.

+ 261 - 97
Makefile

@@ -1,99 +1,263 @@
-PYTHON=`which python3`
-DESTDIR=/
-PROJECT=python-scattnlay
-VERSION=2.3
-BUILDIR=$(CURDIR)/debian/$(PROJECT)
-SRCDIR=$(CURDIR)/src
-MULTIPREC=100
-CXX_NMIE_HEADERS=$(SRCDIR)/nmie.hpp $(SRCDIR)/nmie-basic.hpp $(SRCDIR)/nmie-nearfield.hpp  $(SRCDIR)/nmie-precision.hpp
-
-all:
-	@echo "make source - Create source package for Python extension"
-	@echo "make ext - Create Python extension in place"
-	@echo "make install - Install Python extension on local system"
-	@echo "make rpm - Generate a rpm package for Python extension"
-	@echo "make deb - Generate a deb package for Python extension"
-	@echo "make standalone - Create standalone programs (scattnlay and fieldnlay)"
-	@echo "make clean - Delete temporal files"
-#	make standalone
-
-source:
-	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
-
-ext: $(SRCDIR)/pb11_wrapper.cc $(CXX_NMIE_HEADERS)
-	$(PYTHON) setup.py build_ext --inplace
-
-install:
-	$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
-
-rpm:
-	#$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
-	$(PYTHON) setup.py bdist_rpm --dist-dir=../
-
-deb: source
-	# build the source package in the parent directory
-	# then rename it to project_version.orig.tar.gz
-	rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
-	# build the package
-	dpkg-buildpackage -i -I -rfakeroot
-
-standalone: scattnlay-dp fieldnlay-dp scattnlay-mp fieldnlay-mp
-
-# standalone programs with DP
-scattnlay-dp: $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
-	$(CXX) -DNDEBUG -O2 -Wall -std=c++11 $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc  -lm -o scattnlay-dp $(CXXFLAGS) $(LDFLAGS)
-
-fieldnlay-dp: $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
-	$(CXX) -DNDEBUG -O2 -Wall -std=c++11 $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc  -lm -o fieldnlay-dp $(CXXFLAGS) $(LDFLAGS)
-
-# standalone programs with MP
-scattnlay-mp: $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
-	$(CXX) -DNDEBUG -DMULTI_PRECISION=$(MULTIPREC) -O2 -Wall -std=c++11 $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc  -lm -o scattnlay-mp $(CXXFLAGS) $(LDFLAGS)
-
-fieldnlay-mp: $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
-	$(CXX) -DNDEBUG -DMULTI_PRECISION=$(MULTIPREC) -O2 -Wall -std=c++11 $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc  -lm -o fieldnlay-mp $(CXXFLAGS) $(LDFLAGS)
-
-wasm: $(SRCDIR)/nmie-js-wrapper.cc $(CXX_NMIE_HEADERS)
-#    emcc -lm -Wall -O2 -std=c++11 --bind -s ENVIRONMENT="web" -s MODULARIZE=1 -s SINGLE_FILE=1 -s WASM=1 -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
-#	emcc --bind -lm -Wall -O2 -std=c++11 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-# 	emcc --bind -lm -Wall -O2 -std=c++11 -s MODULARIZE=1 -s WASM=1 -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
-
-	emcc --bind -lm -Wall -pedantic -O2 -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-#	emcc --bind -lm -Wall -pedantic -Oz -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-#	emcc --bind -lm -Wall -pedantic -Oz -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s EXPORT_ES6=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-#	emcc --bind -lm -Wall -pedantic -O2 -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s EXPORT_ES6=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-
-#	emcc --bind -lm -Wall -O3 -std=c++11 -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s 'EXPORT_NAME="nmiejs"' -o ./nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
-# 	emcc -g --bind -lm -Wall -std=c++11 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
-# 	emcc --bind -lm -Wall -O2 -std=c++11 -s MODULARIZE=1 -s EXPORT_ES6=1 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
-
-#     "build:codec": "emcc -O3 -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]' -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s 'EXPORT_NAME=\"fibonacci\"' -o ./fibonacci.js fibonacci.c",
-
-# emcc -O2 \
-#     oniguruma/src/.libs/libonig.so \
-#     src/onigasm.cc\
-#     -Isrc -Ioniguruma/src \
-#     -s ENVIRONMENT=shell \
-#     -s NO_EXIT_RUNTIME=1 \
-#     -s NO_FILESYSTEM=1 \
-#     -s TOTAL_MEMORY=157286400 \
-#     -s ALLOW_MEMORY_GROWTH=1 \
-#     -s DEMANGLE_SUPPORT=1 \
-#     -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall']" \
-#     -s MODULARIZE=1 \
-#     -s EXPORT_NAME="'Onigasm'" \
-#     -o lib/onigasm.js
-
-
-	@cp -f nmiejs.js vue-cli3-webapp/src/
-	@cp -f nmiejs.js guiapp/src/
-	@cp -f nmiejs.wasm vue-cli3-webapp/public/
-	@cp -f nmiejs.wasm guiapp/public/
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 3.22
 
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+# Allow only one "make -f Makefile2" at a time, but pass parallelism.
+.NOTPARALLEL:
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
+
+# Disable VCS-based implicit rules.
+% : %,v
+
+# Disable VCS-based implicit rules.
+% : RCS/%
+
+# Disable VCS-based implicit rules.
+% : RCS/%,v
+
+# Disable VCS-based implicit rules.
+% : SCCS/s.%
+
+# Disable VCS-based implicit rules.
+% : s.%
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Command-line flag to silence nested $(MAKE).
+$(VERBOSE)MAKESILENT = -s
+
+#Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /snap/clion/193/bin/cmake/linux/bin/cmake
+
+# The command to remove a file.
+RM = /snap/clion/193/bin/cmake/linux/bin/cmake -E rm -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/tig/KOsty/Prog/GitHub/scattnlay
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/tig/KOsty/Prog/GitHub/scattnlay
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target test
+test:
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
+	/snap/clion/193/bin/cmake/linux/bin/ctest --force-new-ctest-process $(ARGS)
+.PHONY : test
+
+# Special rule for the target test
+test/fast: test
+.PHONY : test/fast
+
+# Special rule for the target edit_cache
+edit_cache:
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
+	/snap/clion/193/bin/cmake/linux/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+	/snap/clion/193/bin/cmake/linux/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+	$(CMAKE_COMMAND) -E cmake_progress_start /home/tig/KOsty/Prog/GitHub/scattnlay/CMakeFiles /home/tig/KOsty/Prog/GitHub/scattnlay//CMakeFiles/progress.marks
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
+	$(CMAKE_COMMAND) -E cmake_progress_start /home/tig/KOsty/Prog/GitHub/scattnlay/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
 clean:
-	$(PYTHON) setup.py clean
-	$(MAKE) -f $(CURDIR)/debian/rules clean
-	rm -rf build/ MANIFEST
-	find . -name '*.pyc' -delete
-	find . -name '*.o' -delete
-	find . -name '*.so' -delete
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+#=============================================================================
+# Target rules for targets named python3-scattnlay
+
+# Build rule for target.
+python3-scattnlay: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 python3-scattnlay
+.PHONY : python3-scattnlay
+
+# fast build rule for target.
+python3-scattnlay/fast:
+	$(MAKE) $(MAKESILENT) -f src/CMakeFiles/python3-scattnlay.dir/build.make src/CMakeFiles/python3-scattnlay.dir/build
+.PHONY : python3-scattnlay/fast
+
+#=============================================================================
+# Target rules for targets named farfield
+
+# Build rule for target.
+farfield: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 farfield
+.PHONY : farfield
+
+# fast build rule for target.
+farfield/fast:
+	$(MAKE) $(MAKESILENT) -f src/CMakeFiles/farfield.dir/build.make src/CMakeFiles/farfield.dir/build
+.PHONY : farfield/fast
+
+#=============================================================================
+# Target rules for targets named nearfield
+
+# Build rule for target.
+nearfield: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 nearfield
+.PHONY : nearfield
+
+# fast build rule for target.
+nearfield/fast:
+	$(MAKE) $(MAKESILENT) -f src/CMakeFiles/nearfield.dir/build.make src/CMakeFiles/nearfield.dir/build
+.PHONY : nearfield/fast
+
+#=============================================================================
+# Target rules for targets named test_near_field
+
+# Build rule for target.
+test_near_field: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test_near_field
+.PHONY : test_near_field
+
+# fast build rule for target.
+test_near_field/fast:
+	$(MAKE) $(MAKESILENT) -f tests/CMakeFiles/test_near_field.dir/build.make tests/CMakeFiles/test_near_field.dir/build
+.PHONY : test_near_field/fast
+
+#=============================================================================
+# Target rules for targets named test_Riccati_Bessel_logarithmic_derivative
+
+# Build rule for target.
+test_Riccati_Bessel_logarithmic_derivative: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test_Riccati_Bessel_logarithmic_derivative
+.PHONY : test_Riccati_Bessel_logarithmic_derivative
+
+# fast build rule for target.
+test_Riccati_Bessel_logarithmic_derivative/fast:
+	$(MAKE) $(MAKESILENT) -f tests/CMakeFiles/test_Riccati_Bessel_logarithmic_derivative.dir/build.make tests/CMakeFiles/test_Riccati_Bessel_logarithmic_derivative.dir/build
+.PHONY : test_Riccati_Bessel_logarithmic_derivative/fast
+
+#=============================================================================
+# Target rules for targets named test_bulk_sphere
+
+# Build rule for target.
+test_bulk_sphere: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test_bulk_sphere
+.PHONY : test_bulk_sphere
+
+# fast build rule for target.
+test_bulk_sphere/fast:
+	$(MAKE) $(MAKESILENT) -f tests/CMakeFiles/test_bulk_sphere.dir/build.make tests/CMakeFiles/test_bulk_sphere.dir/build
+.PHONY : test_bulk_sphere/fast
+
+#=============================================================================
+# Target rules for targets named test_bulk_sphere_multi_precision
+
+# Build rule for target.
+test_bulk_sphere_multi_precision: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test_bulk_sphere_multi_precision
+.PHONY : test_bulk_sphere_multi_precision
+
+# fast build rule for target.
+test_bulk_sphere_multi_precision/fast:
+	$(MAKE) $(MAKESILENT) -f tests/CMakeFiles/test_bulk_sphere_multi_precision.dir/build.make tests/CMakeFiles/test_bulk_sphere_multi_precision.dir/build
+.PHONY : test_bulk_sphere_multi_precision/fast
+
+#=============================================================================
+# Target rules for targets named test_near_field_multi_precision
+
+# Build rule for target.
+test_near_field_multi_precision: cmake_check_build_system
+	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test_near_field_multi_precision
+.PHONY : test_near_field_multi_precision
+
+# fast build rule for target.
+test_near_field_multi_precision/fast:
+	$(MAKE) $(MAKESILENT) -f tests/CMakeFiles/test_near_field_multi_precision.dir/build.make tests/CMakeFiles/test_near_field_multi_precision.dir/build
+.PHONY : test_near_field_multi_precision/fast
+
+# Help Target
+help:
+	@echo "The following are some of the valid targets for this Makefile:"
+	@echo "... all (the default if no target is provided)"
+	@echo "... clean"
+	@echo "... depend"
+	@echo "... edit_cache"
+	@echo "... rebuild_cache"
+	@echo "... test"
+	@echo "... farfield"
+	@echo "... nearfield"
+	@echo "... python3-scattnlay"
+	@echo "... test_Riccati_Bessel_logarithmic_derivative"
+	@echo "... test_bulk_sphere"
+	@echo "... test_bulk_sphere_multi_precision"
+	@echo "... test_near_field"
+	@echo "... test_near_field_multi_precision"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+