├── .clang-format ├── .git_archival.txt ├── .gitattributes ├── .github ├── dependabot.yml ├── environment.yml └── workflows │ ├── ci.yml │ └── publish.yml ├── .gitignore ├── .gitmodules ├── .ycm_extra_conf.py ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── compiler_flags │ ├── CXXFlags.cmake │ ├── Clang.CXX.cmake │ ├── GNU.CXX.cmake │ ├── Intel.CXX.cmake │ └── MSVC.CXX.cmake └── downloaded │ ├── autocmake_safeguards.cmake │ └── autocmake_save_flags.cmake ├── doc ├── Makefile ├── doxygen_xml │ ├── _r_e_a_d_m_e_8md.xml │ ├── classlibcppe_1_1_c_p_p_e.xml │ ├── classlibcppe_1_1_cppe_state.xml │ ├── classlibcppe_1_1_induced_moments.xml │ ├── classlibcppe_1_1_multipole.xml │ ├── classlibcppe_1_1_multipole_expansion.xml │ ├── classlibcppe_1_1_multipole_fields.xml │ ├── classlibcppe_1_1_nuclear_fields.xml │ ├── classlibcppe_1_1_polarizability.xml │ ├── classlibcppe_1_1_pot_manipulator.xml │ ├── classlibcppe_1_1_potential.xml │ ├── classlibcppe_1_1_potfile_reader.xml │ ├── combine.xslt │ ├── compound.xsd │ ├── cppe__state_8cc.xml │ ├── cppe__state_8hh.xml │ ├── dir_10e4f7b4cfe79cadc3b1bd1deca3ddf7.xml │ ├── dir_34ef9b77aeabc5ec58939d80c2e43bc3.xml │ ├── dir_4ef915e641514ebc91bdfc914537ff46.xml │ ├── dir_53f1138f3f5c4b11e9518e7b6d18a2eb.xml │ ├── dir_7a6499598ddcfcabe96e224cb4a6d834.xml │ ├── dir_eb05382a6b76d2ee1afeadfd5a23001f.xml │ ├── dir_f98a5f65b8c4f880c583640445bd1dcf.xml │ ├── electric__fields_8cc.xml │ ├── electric__fields_8hh.xml │ ├── export__fields_8cc.xml │ ├── export__math_8cc.xml │ ├── export__molecule_8cc.xml │ ├── export__multipole_8cc.xml │ ├── export__options_8cc.xml │ ├── export__state_8cc.xml │ ├── export__utils_8cc.xml │ ├── index.xml │ ├── index.xsd │ ├── interface_8h.xml │ ├── libcppe_8cc.xml │ ├── libcppe_8hh.xml │ ├── math_8cc.xml │ ├── math_8hh.xml │ ├── md___users_maxscheurer__projects_cppe__r_e_a_d_m_e.xml │ ├── molecule_8hh.xml │ ├── multipole_8cc.xml │ ├── multipole_8hh.xml │ ├── multipole__expansion_8cc.xml │ ├── multipole__expansion_8hh.xml │ ├── namespacegen1int__api.xml │ ├── namespacelibcppe.xml │ ├── namespacelibcppe_1_1_0D27.xml │ ├── namespacepe__variables.xml │ ├── namespacepolarizable__embedding.xml │ ├── pe__energies_8cc.xml │ ├── pe__energies_8hh.xml │ ├── pe__interface_8_f90.xml │ ├── pe__options_8hh.xml │ ├── pot__manipulation_8cc.xml │ ├── pot__manipulation_8hh.xml │ ├── potfile__reader_8cc.xml │ ├── potfile__reader_8hh.xml │ ├── pycppe_8cc.xml │ ├── string__utils_8cc.xml │ ├── string__utils_8hh.xml │ ├── structlibcppe_1_1_atom.xml │ ├── structlibcppe_1_1_border_options.xml │ ├── structlibcppe_1_1_molecule.xml │ ├── structlibcppe_1_1_pe_energy.xml │ ├── structlibcppe_1_1_pe_energy_contribution.xml │ ├── structlibcppe_1_1_pe_options.xml │ └── structlibcppe_1_1_site.xml ├── requirements.txt └── source │ ├── conf.py │ ├── cpp_api.rst │ └── index.rst ├── pyproject.toml ├── scripts ├── common.py ├── gen_fmm │ └── gen_fmm.py ├── gen_tensors │ └── gen_tensors.py ├── run-clang-format.py └── setup_environment.sh ├── src ├── CMakeLists.txt ├── core │ ├── CMakeLists.txt │ ├── bmatrix.cc │ ├── bmatrix.hh │ ├── cppe_state.cc │ ├── cppe_state.hh │ ├── electric_fields.cc │ ├── electric_fields.hh │ ├── fmm │ │ ├── CMakeLists.txt │ │ ├── calculate.cc │ │ ├── calculate.hh │ │ ├── field_m0.cc │ │ ├── field_m0.hh │ │ ├── field_m1.cc │ │ ├── field_m1.hh │ │ ├── field_m2.cc │ │ ├── field_m2.hh │ │ ├── tree.cc │ │ ├── tree.hh │ │ ├── utils.cc │ │ └── utils.hh │ ├── math.cc │ ├── math.hh │ ├── molecule.hh │ ├── multipole_expansion.cc │ ├── multipole_expansion.hh │ ├── pe_options.hh │ ├── pot_manipulation.cc │ ├── pot_manipulation.hh │ ├── potential.hh │ ├── potfile_reader.cc │ ├── potfile_reader.hh │ ├── tensors.hh │ └── tensors │ │ ├── CMakeLists.txt │ │ ├── tensors_autogen.cc │ │ ├── tensors_autogen.hh │ │ ├── tensors_recursive.cc │ │ └── tensors_recursive.hh ├── cppe │ └── __init__.py ├── libcppe.hh ├── python_iface │ ├── CMakeLists.txt │ ├── export_cppe.cc │ ├── export_fields.cc │ ├── export_fmm.cc │ ├── export_math.cc │ ├── export_molecule.cc │ ├── export_potential.cc │ ├── export_state.cc │ ├── export_tensors.cc │ └── export_utils.cc └── utils │ ├── CMakeLists.txt │ ├── string_utils.cc │ └── string_utils.hh └── tests ├── __init__.py ├── cache.py ├── conftest.py ├── dump_pyscf.py ├── misc.py ├── nilered.hdf5 ├── pna.hdf5 ├── potfiles ├── fmuls_loprop_solvated_20.txt ├── loprop_solvated_20.pot ├── make_isopol.py ├── pna_6w.pot └── pna_6w_isopol.pot ├── ref_fmm_errors.csv ├── symmetry_helper.py ├── test_fields.py ├── test_fmm.py ├── test_functionality.py ├── test_gradients.py ├── test_math.py ├── test_options.py └── test_solver.py /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | AccessModifierOffset: -1 4 | AlignAfterOpenBracket: Align 5 | AlignConsecutiveAssignments: true 6 | AlignConsecutiveDeclarations: false 7 | AlignEscapedNewlinesLeft: true 8 | AlignOperands: true 9 | AlignTrailingComments: true 10 | AllowAllParametersOfDeclarationOnNextLine: true 11 | AllowShortBlocksOnASingleLine: false 12 | AllowShortCaseLabelsOnASingleLine: false 13 | AllowShortFunctionsOnASingleLine: All 14 | AllowShortIfStatementsOnASingleLine: true 15 | AllowShortLoopsOnASingleLine: true 16 | AlwaysBreakAfterReturnType: None 17 | AlwaysBreakBeforeMultilineStrings: true 18 | AlwaysBreakTemplateDeclarations: true 19 | BinPackArguments: true 20 | BinPackParameters: true 21 | BraceWrapping: 22 | AfterClass: false 23 | AfterControlStatement: false 24 | AfterEnum: false 25 | AfterFunction: false 26 | AfterNamespace: false 27 | AfterObjCDeclaration: false 28 | AfterStruct: false 29 | AfterUnion: false 30 | BeforeCatch: false 31 | BeforeElse: false 32 | IndentBraces: false 33 | BreakBeforeBinaryOperators: None 34 | BreakBeforeBraces: Attach 35 | BreakBeforeTernaryOperators: true 36 | BreakConstructorInitializersBeforeComma: false 37 | ColumnLimit: 90 38 | CommentPragmas: '^ IWYU pragma:' 39 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 40 | ConstructorInitializerIndentWidth: 6 41 | ContinuationIndentWidth: 6 42 | Cpp11BracedListStyle: true 43 | DerivePointerAlignment: false 44 | DisableFormat: false 45 | ExperimentalAutoDetectBinPacking: false 46 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 47 | IndentCaseLabels: true 48 | IndentWidth: 2 49 | IndentWrappedFunctionNames: false 50 | KeepEmptyLinesAtTheStartOfBlocks: true 51 | MaxEmptyLinesToKeep: 1 52 | NamespaceIndentation: None 53 | ObjCBlockIndentWidth: 2 54 | ObjCSpaceAfterProperty: false 55 | ObjCSpaceBeforeProtocolList: false 56 | PenaltyBreakBeforeFirstCallParameter: 1 57 | PenaltyBreakComment: 300 58 | PenaltyBreakFirstLessLess: 120 59 | PenaltyBreakString: 1000 60 | PenaltyExcessCharacter: 1000000 61 | PenaltyReturnTypeOnItsOwnLine: 200 62 | PointerAlignment: Left 63 | ReflowComments: true 64 | SortIncludes: true 65 | SpaceAfterCStyleCast: false 66 | SpaceBeforeAssignmentOperators: true 67 | SpaceBeforeParens: ControlStatements 68 | SpaceInEmptyParentheses: false 69 | SpacesBeforeTrailingComments: 2 70 | SpacesInAngles: false 71 | SpacesInContainerLiterals: true 72 | SpacesInCStyleCastParentheses: false 73 | SpacesInParentheses: false 74 | SpacesInSquareBrackets: false 75 | Standard: Cpp11 76 | TabWidth: 8 77 | UseTab: Never 78 | ... 79 | 80 | -------------------------------------------------------------------------------- /.git_archival.txt: -------------------------------------------------------------------------------- 1 | node: 85fa0c1ec1ddbaa156be93d5a627b427359e7641 2 | node-date: 2024-08-24T21:46:06+02:00 3 | describe-name: v0.3.3a0-2-g85fa0c1e 4 | ref-names: HEAD -> master 5 | 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | .git_archival.txt export-subst 2 | 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | ignore: 9 | # cibuildwheel updates often and cannot be tracked by 10 | # a major version tag like 'v1'. Mute updates since 11 | # this is not a critical component 12 | - dependency-name: "pypa/cibuildwheel*" 13 | -------------------------------------------------------------------------------- /.github/environment.yml: -------------------------------------------------------------------------------- 1 | name: cppe-gha 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - cxx-compiler 6 | - eigen 7 | - pip 8 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | tags: 8 | - 'v*' 9 | pull_request: 10 | branches: 11 | - master 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref }} 15 | cancel-in-progress: true 16 | 17 | env: 18 | FORCE_COLOR: 3 19 | 20 | jobs: 21 | build: 22 | runs-on: ${{ matrix.os }} 23 | 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | os: 28 | - ubuntu-latest 29 | - macos-latest 30 | - windows-latest 31 | python-version: 32 | - "3.8" 33 | - "3.12" 34 | 35 | defaults: 36 | run: 37 | shell: bash -el {0} 38 | 39 | env: 40 | NINJA_STATUS: "[Built edge %f of %t in %e sec] " 41 | 42 | steps: 43 | - uses: actions/checkout@v4 44 | with: 45 | fetch-depth: 0 # such that setuptools_scm can do its job correctly 46 | 47 | # this will set the system compiler; 48 | # This must be done *before* setting up miniconda, see: 49 | # https://github.com/ilammy/msvc-dev-cmd/issues/34 50 | - name: Set Windows env 51 | if: matrix.os == 'windows-latest' 52 | uses: ilammy/msvc-dev-cmd@v1 53 | env: 54 | KMP_DUPLICATE_LIB_OK: "TRUE" 55 | 56 | - name: Cache conda 57 | uses: actions/cache@v4 58 | env: 59 | # Increase this value to reset cache if .github/environment.yml has not changed 60 | CACHE_NUMBER: 2 61 | with: 62 | path: ~/conda_pkgs_dir 63 | key: 64 | ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.github/environment.yml') }} 65 | 66 | - uses: conda-incubator/setup-miniconda@v3 67 | with: 68 | python-version: ${{ matrix.python-version }} 69 | auto-update-conda: true 70 | auto-activate-base: false 71 | channels: conda-forge 72 | channel-priority: true 73 | activate-environment: cppe-gha 74 | environment-file: .github/environment.yml 75 | 76 | - name: Select CMake CLI options 77 | run: | 78 | echo "We are running on ${{ matrix.os }}" 79 | if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then 80 | echo "SKBUILD_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=g++;-GNinja" >> $GITHUB_ENV 81 | elif [ "${{ matrix.os }}" == "macos-latest" ]; then 82 | echo "SKBUILD_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=clang++;-GNinja" >> $GITHUB_ENV 83 | else 84 | echo "SKBUILD_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=clang-cl;-GNinja" >> $GITHUB_ENV 85 | fi 86 | 87 | - name: Configure, build, install 88 | run: | 89 | python -m pip install -v .[test] 90 | 91 | - name: Test 92 | run: | 93 | python -m pytest -vvv --ignore=tests/test_fields.py --ignore=tests/test_functionality.py --ignore=tests/test_gradients.py --ignore=tests/test_solver.py 94 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish package 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | branches: 8 | - master 9 | release: 10 | types: 11 | - published 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref }} 15 | cancel-in-progress: true 16 | 17 | env: 18 | FORCE_COLOR: 3 19 | 20 | jobs: 21 | build_sdist: 22 | name: Build source distribution 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v4 26 | with: 27 | fetch-depth: 0 # such that setuptools_scm can do its job correctly 28 | 29 | - name: Build SDist 30 | run: pipx run build --sdist 31 | 32 | - uses: actions/upload-artifact@v4 33 | with: 34 | name: cibw-sdist 35 | path: dist/*.tar.gz 36 | 37 | generate-wheels-matrix: 38 | name: Generate wheels matrix 39 | runs-on: ubuntu-latest 40 | outputs: 41 | include: ${{ steps.set-matrix.outputs.include }} 42 | steps: 43 | - uses: actions/checkout@v4 44 | - name: Install cibuildwheel 45 | run: pipx install cibuildwheel==2.19.2 46 | - id: set-matrix 47 | run: | 48 | MATRIX=$( 49 | { 50 | cibuildwheel --print-build-identifiers --platform linux \ 51 | | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ 52 | && cibuildwheel --print-build-identifiers --platform macos \ 53 | | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ 54 | && cibuildwheel --print-build-identifiers --platform windows \ 55 | | jq -nRc '{"only": inputs, "os": "windows-latest"}' 56 | } | jq -sc 57 | ) 58 | echo "Full build matrix" 59 | echo "$MATRIX" 60 | echo "include=$MATRIX" >> $GITHUB_OUTPUT 61 | env: 62 | CIBW_ARCHS_LINUX: x86_64 # aarch64 # skipping as h5py stopped providing pre-build wheels for aarch64 on PyPI 63 | CIBW_ARCHS_MACOS: x86_64 arm64 64 | CIBW_ARCHS_WINDOWS: AMD64 65 | # skip musl builds 66 | CIBW_SKIP: "*-musllinux_*" 67 | # disable free-threaded support 68 | CIBW_FREE_THREADED_SUPPORT: False 69 | # exclude latest Python beta 70 | CIBW_PRERELEASE_PYTHONS: False 71 | 72 | build_wheels: 73 | name: Build ${{ matrix.only }} 74 | needs: generate-wheels-matrix 75 | strategy: 76 | matrix: 77 | include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} 78 | runs-on: ${{ matrix.os }} 79 | steps: 80 | - uses: actions/checkout@v4 81 | with: 82 | fetch-depth: 0 # such that setuptools_scm can do its job correctly 83 | 84 | - name: Set up QEMU 85 | if: runner.os == 'Linux' 86 | uses: docker/setup-qemu-action@v3 87 | with: 88 | platforms: all 89 | 90 | # this will set the system compiler 91 | - name: Set Windows env 92 | if: matrix.os == 'windows-latest' 93 | uses: ilammy/msvc-dev-cmd@v1 94 | 95 | - uses: pypa/cibuildwheel@v2.19.2 96 | env: 97 | # skip testing PyPy builds 98 | CIBW_TEST_SKIP: "pp*" 99 | 100 | CIBW_ENVIRONMENT_LINUX: > 101 | SKBUILD_CMAKE_ARGS="-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF" 102 | 103 | CIBW_ENVIRONMENT_MACOS: > 104 | SKBUILD_CMAKE_ARGS="-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF" 105 | 106 | CIBW_ENVIRONMENT_WINDOWS: > 107 | SKBUILD_CMAKE_ARGS="-GNinja;-DCMAKE_CXX_COMPILER=clang-cl;-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF" 108 | with: 109 | only: ${{ matrix.only }} 110 | 111 | - name: Verify clean directory 112 | run: git diff --exit-code 113 | shell: bash 114 | 115 | - uses: actions/upload-artifact@v4 116 | with: 117 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} 118 | path: ./wheelhouse/*.whl 119 | 120 | upload_all: 121 | name: Upload if release 122 | needs: 123 | - build_wheels 124 | - build_sdist 125 | environment: pypi 126 | permissions: 127 | id-token: write 128 | runs-on: ubuntu-latest 129 | #if: github.event_name == 'release' && github.event.action == 'published' 130 | 131 | steps: 132 | - uses: actions/download-artifact@v4 133 | with: 134 | pattern: cibw-* 135 | path: dist 136 | merge-multiple: true 137 | 138 | - uses: pypa/gh-action-pypi-publish@release/v1 139 | with: 140 | repository-url: https://test.pypi.org/legacy/ 141 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | cmake-build-debug 3 | build 4 | dist 5 | *~ 6 | 7 | # Prerequisites 8 | *.d 9 | 10 | # Compiled Object files 11 | *.slo 12 | *.lo 13 | *.o 14 | *.obj 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Compiled Dynamic libraries 21 | *.so 22 | *.dylib 23 | *.dll 24 | 25 | # Fortran module files 26 | *.mod 27 | *.smod 28 | 29 | # Compiled Static libraries 30 | *.lai 31 | *.la 32 | *.a 33 | *.lib 34 | 35 | # Executables 36 | *.exe 37 | *.out 38 | *.app 39 | 40 | .DS_Store 41 | __pycache__ 42 | *.egg-info 43 | *.eggs 44 | .ipynb_checkpoints/ 45 | 46 | # autogenerated by setuptools-scm 47 | _version.py 48 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxscheurer/cppe/85fa0c1ec1ddbaa156be93d5a627b427359e7641/.gitmodules -------------------------------------------------------------------------------- /.ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # This file is loosely based upon the file 4 | # cpp/ycm/.ycm_extra_conf.py from the youcompleteme daemon process 5 | # available on github: 6 | # https://github.com/Valloric/ycmd/blob/master/cpp/ycm/.ycm_extra_conf.py 7 | 8 | 9 | # These are the compilation flags that will be used in case there's no 10 | # compilation database set (by default, one is not set). 11 | flags = [ 12 | # Warnings: For a very detailed discussion about this 13 | # see the following stackexchange post: 14 | # https://programmers.stackexchange.com/questions/122608#124574 15 | '-Wall', 16 | '-Wextra', 17 | '-Werror', 18 | '-pedantic', 19 | # Generate unwind information 20 | '-fexceptions', 21 | # Compile debug code as well 22 | '-DDEBUG', 23 | # Compile as c++14 24 | '-std=c++14', 25 | # Treat .h header files as c++: 26 | '-x', 'c++', 27 | # Include other libraries and show errors and 28 | # warnings within them 29 | # To suppress errors shown here, use "-isystem" 30 | # instead of "-I" 31 | '-I', './cppe/core', 32 | '-I', './cppe/utils', 33 | '-I', './cppe', 34 | '-isystem', './external/krims/src', 35 | ] 36 | 37 | def DirectoryOfThisScript(): 38 | return os.path.dirname( os.path.abspath( __file__ ) ) 39 | 40 | SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.C' ] 41 | 42 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 43 | if not working_directory: 44 | return list( flags ) 45 | new_flags = [] 46 | make_next_absolute = False 47 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 48 | for flag in flags: 49 | new_flag = flag 50 | 51 | if make_next_absolute: 52 | make_next_absolute = False 53 | if not flag.startswith( '/' ): 54 | new_flag = os.path.join( working_directory, flag ) 55 | 56 | for path_flag in path_flags: 57 | if flag == path_flag: 58 | make_next_absolute = True 59 | break 60 | 61 | if flag.startswith( path_flag ): 62 | path = flag[ len( path_flag ): ] 63 | new_flag = path_flag + os.path.join( working_directory, path ) 64 | break 65 | 66 | if new_flag: 67 | new_flags.append( new_flag ) 68 | return new_flags 69 | 70 | 71 | def IsHeaderFile( filename ): 72 | extension = os.path.splitext( filename )[ 1 ] 73 | return extension in [ '.h', '.hxx', '.hpp', '.hh' ] 74 | 75 | def FlagsForFile( filename, **kwargs ): 76 | relative_to = DirectoryOfThisScript() 77 | final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) 78 | 79 | return { 80 | 'flags': final_flags, 81 | 'do_cache': True 82 | } 83 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # set minimum cmake version 2 | cmake_minimum_required(VERSION 3.16...3.20) 3 | 4 | # project name 5 | project(cppe LANGUAGES CXX) 6 | 7 | if(NOT SKBUILD) 8 | message(WARNING "\ 9 | This CMake file is meant to be executed using 'scikit-build'. Running 10 | it directly will almost certainly not produce the desired result. If 11 | you are a user trying to install this package, please use the command 12 | below, which will install all necessary build dependencies, compile 13 | the package in an isolated environment, and then install it. 14 | ===================================================================== 15 | $ pip install . 16 | ===================================================================== 17 | If you are a software developer, and this is your own package, then 18 | it is usually much more efficient to install the build dependencies 19 | in your environment once and use the following command that avoids 20 | a costly creation of a new virtual environment at every compilation: 21 | ===================================================================== 22 | $ pip install scikit-build-core[pyproject] cmake ninja pybind11 setuptools_scm 23 | $ pip install --no-build-isolation -ve . 24 | ===================================================================== 25 | You may optionally add -Ceditable.rebuild=true to auto-rebuild when 26 | the package is imported. Otherwise, you need to re-run the above 27 | after editing C++ files.") 28 | endif() 29 | 30 | # Try to import all Python components potentially needed by nanobind 31 | # do not rebuild if rules (compiler flags) change 32 | set(CMAKE_SKIP_RULE_DEPENDENCY TRUE) 33 | 34 | # if CMAKE_BUILD_TYPE undefined, we set it to Release 35 | if(NOT CMAKE_BUILD_TYPE) 36 | set(CMAKE_BUILD_TYPE "Release") 37 | endif() 38 | 39 | # options handling utilities 40 | include(CMakeDependentOption) 41 | # Macro for printing an option in a consistent manner 42 | # Syntax: print_option(