ghh1125 commited on
Commit
697d6c3
·
verified ·
1 Parent(s): d18491c

Upload 6294 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +27 -0
  2. Dockerfile +18 -0
  3. app.py +45 -0
  4. port.json +5 -0
  5. rdkit/mcp_output/README_MCP.md +128 -0
  6. rdkit/mcp_output/analysis.json +0 -0
  7. rdkit/mcp_output/diff_report.md +152 -0
  8. rdkit/mcp_output/mcp_plugin/__init__.py +0 -0
  9. rdkit/mcp_output/mcp_plugin/adapter.py +406 -0
  10. rdkit/mcp_output/mcp_plugin/main.py +13 -0
  11. rdkit/mcp_output/mcp_plugin/mcp_service.py +149 -0
  12. rdkit/mcp_output/requirements.txt +6 -0
  13. rdkit/mcp_output/start_mcp.py +30 -0
  14. rdkit/mcp_output/workflow_summary.json +230 -0
  15. rdkit/source/.DS_Store +0 -0
  16. rdkit/source/.azure-pipelines/linux_build.yml +88 -0
  17. rdkit/source/.azure-pipelines/linux_build_cartridge.yml +60 -0
  18. rdkit/source/.azure-pipelines/linux_build_fuzzer.yml +57 -0
  19. rdkit/source/.azure-pipelines/linux_build_java.yml +62 -0
  20. rdkit/source/.azure-pipelines/linux_build_limitexternal.yml +70 -0
  21. rdkit/source/.azure-pipelines/linux_build_py312.yml +98 -0
  22. rdkit/source/.azure-pipelines/mac_build.yml +95 -0
  23. rdkit/source/.azure-pipelines/mac_build_java.yml +88 -0
  24. rdkit/source/.azure-pipelines/vs_build.yml +85 -0
  25. rdkit/source/.azure-pipelines/vs_build_dll.yml +65 -0
  26. rdkit/source/.azure-pipelines/vs_build_swig.yml +69 -0
  27. rdkit/source/.clang-format +67 -0
  28. rdkit/source/.clang-tidy +18 -0
  29. rdkit/source/.travis.yml +70 -0
  30. rdkit/source/CMakeLists.txt +713 -0
  31. rdkit/source/CONTRIBUTING +1 -0
  32. rdkit/source/CTestConfig.cmake +2 -0
  33. rdkit/source/CTestCustom.ctest.in +11 -0
  34. rdkit/source/Code/Bench/CMakeLists.txt +38 -0
  35. rdkit/source/Code/Bench/README.md +13 -0
  36. rdkit/source/Code/Bench/bench_common.cpp +20 -0
  37. rdkit/source/Code/Bench/bench_common.hpp +53 -0
  38. rdkit/source/Code/Bench/descriptors.cpp +31 -0
  39. rdkit/source/Code/Bench/fingerprint.cpp +25 -0
  40. rdkit/source/Code/Bench/inchi.cpp +55 -0
  41. rdkit/source/Code/Bench/meta.cpp +12 -0
  42. rdkit/source/Code/Bench/mol.cpp +72 -0
  43. rdkit/source/Code/Bench/molops.cpp +48 -0
  44. rdkit/source/Code/Bench/pickle.cpp +41 -0
  45. rdkit/source/Code/Bench/smiles.cpp +46 -0
  46. rdkit/source/Code/Bench/stereo.cpp +72 -0
  47. rdkit/source/Code/Bench/substruct_match.cpp +109 -0
  48. rdkit/source/Code/CMakeLists.txt +44 -0
  49. rdkit/source/Code/Catalogs/CMakeLists.txt +11 -0
  50. rdkit/source/Code/Catalogs/Catalog.cpp +15 -0
.gitattributes CHANGED
@@ -33,3 +33,30 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ rdkit/source/Code/GraphMol/SynthonSpaceSearch/data/idorsia_toy_space_a.spc filter=lfs diff=lfs merge=lfs -text
37
+ rdkit/source/Contrib/CalcLigRMSD/figures/1C9.png filter=lfs diff=lfs merge=lfs -text
38
+ rdkit/source/Contrib/CalcLigRMSD/figures/5dpv_complex.png filter=lfs diff=lfs merge=lfs -text
39
+ rdkit/source/Contrib/CalcLigRMSD/figures/6c83_complex.png filter=lfs diff=lfs merge=lfs -text
40
+ rdkit/source/Contrib/CalcLigRMSD/figures/AKI.png filter=lfs diff=lfs merge=lfs -text
41
+ rdkit/source/Contrib/CalcLigRMSD/figures/JVE.png filter=lfs diff=lfs merge=lfs -text
42
+ rdkit/source/Contrib/CalcLigRMSD/figures/N15.png filter=lfs diff=lfs merge=lfs -text
43
+ rdkit/source/Contrib/NIBRSubstructureFilters/FilterSet_NIBR2019_wPubChemExamples.html filter=lfs diff=lfs merge=lfs -text
44
+ rdkit/source/Docs/Analysis/ForceField/ForceFieldTerms.new.odt filter=lfs diff=lfs merge=lfs -text
45
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_15.png filter=lfs diff=lfs merge=lfs -text
46
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_24.png filter=lfs diff=lfs merge=lfs -text
47
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_39.png filter=lfs diff=lfs merge=lfs -text
48
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_42.png filter=lfs diff=lfs merge=lfs -text
49
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_47.png filter=lfs diff=lfs merge=lfs -text
50
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_49.png filter=lfs diff=lfs merge=lfs -text
51
+ rdkit/source/Docs/Book_jp/supple_images/jp_supple_6.png filter=lfs diff=lfs merge=lfs -text
52
+ rdkit/source/Docs/Book/images/picture_10.jpg filter=lfs diff=lfs merge=lfs -text
53
+ rdkit/source/Docs/Book/images/pull_req1.png filter=lfs diff=lfs merge=lfs -text
54
+ rdkit/source/Docs/Book/images/pull_req2.png filter=lfs diff=lfs merge=lfs -text
55
+ rdkit/source/Docs/Book/images/rdkit_fork_clone.png filter=lfs diff=lfs merge=lfs -text
56
+ rdkit/source/Docs/Book/images/similarity_map_rf.png filter=lfs diff=lfs merge=lfs -text
57
+ rdkit/source/Docs/Code/Chem/Pharm2D.signatures.ai filter=lfs diff=lfs merge=lfs -text
58
+ rdkit/source/Docs/Code/Chem/Pharm2D.signatures.jpg filter=lfs diff=lfs merge=lfs -text
59
+ rdkit/source/Docs/Code/Chem/Pharm2D.triangles.ai filter=lfs diff=lfs merge=lfs -text
60
+ rdkit/source/Docs/Code/Chem/Pharm2D.triangles.jpg filter=lfs diff=lfs merge=lfs -text
61
+ rdkit/source/Docs/Images/logo.ai filter=lfs diff=lfs merge=lfs -text
62
+ rdkit/source/rdkit/Chem/Draw/FreeSans.ttf filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ RUN useradd -m -u 1000 user && python -m pip install --upgrade pip
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ ENV MCP_TRANSPORT=http
14
+ ENV MCP_PORT=7860
15
+
16
+ EXPOSE 7860
17
+
18
+ CMD ["python", "rdkit/mcp_output/start_mcp.py"]
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import os
3
+ import sys
4
+
5
+ mcp_plugin_path = os.path.join(os.path.dirname(__file__), "rdkit", "mcp_output", "mcp_plugin")
6
+ sys.path.insert(0, mcp_plugin_path)
7
+
8
+ app = FastAPI(
9
+ title="Rdkit MCP Service",
10
+ description="Auto-generated MCP service for rdkit",
11
+ version="1.0.0"
12
+ )
13
+
14
+ @app.get("/")
15
+ def root():
16
+ return {
17
+ "service": "Rdkit MCP Service",
18
+ "version": "1.0.0",
19
+ "status": "running",
20
+ "transport": os.environ.get("MCP_TRANSPORT", "http")
21
+ }
22
+
23
+ @app.get("/health")
24
+ def health_check():
25
+ return {"status": "healthy", "service": "rdkit MCP"}
26
+
27
+ @app.get("/tools")
28
+ def list_tools():
29
+ try:
30
+ from mcp_service import create_app
31
+ mcp_app = create_app()
32
+ tools = []
33
+ for tool_name, tool_func in mcp_app.tools.items():
34
+ tools.append({
35
+ "name": tool_name,
36
+ "description": tool_func.__doc__ or "No description available"
37
+ })
38
+ return {"tools": tools}
39
+ except Exception as e:
40
+ return {"error": f"Failed to load tools: {str(e)}"}
41
+
42
+ if __name__ == "__main__":
43
+ import uvicorn
44
+ port = int(os.environ.get("PORT", 7860))
45
+ uvicorn.run(app, host="0.0.0.0", port=port)
port.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "repo": "rdkit",
3
+ "port": 7914,
4
+ "timestamp": 1773264143
5
+ }
rdkit/mcp_output/README_MCP.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RDKit MCP (Model Context Protocol) Service README
2
+
3
+ ## 1) Project Introduction
4
+
5
+ This project provides an MCP (Model Context Protocol) service wrapper around RDKit for cheminformatics workflows.
6
+ It is intended for LLM/tooling integrations that need molecule parsing, descriptor calculation, fingerprinting, similarity, substructure matching, and rendering.
7
+
8
+ Typical use cases:
9
+ - SMILES/InChI/mol block conversion and validation
10
+ - Molecular descriptors (2D/3D, QED, Lipinski, etc.)
11
+ - Fingerprint generation and similarity search
12
+ - Substructure and MCS matching
13
+ - Conformer/geometry operations
14
+ - Optional utilities for database workflows and feature extraction
15
+
16
+ ---
17
+
18
+ ## 2) Installation Method
19
+
20
+ ### System requirements
21
+ - Python 3.10+ recommended
22
+ - RDKit installed with compiled C++ extensions
23
+ - `numpy` (required)
24
+ - Optional: `Pillow`, `pandas`, `scipy`, `matplotlib`, `IPython`, drawing backends (Cairo/Qt), InChI libs
25
+
26
+ ### Recommended install (Conda)
27
+ - conda create -n rdkit-mcp -c conda-forge python=3.11 rdkit numpy
28
+ - conda activate rdkit-mcp
29
+
30
+ ### Optional extras
31
+ - pip install pillow pandas scipy matplotlib ipython
32
+
33
+ ### Verify installation
34
+ - python -c "from rdkit import Chem; print(Chem.MolFromSmiles('CCO') is not None)"
35
+
36
+ ---
37
+
38
+ ## 3) Quick Start
39
+
40
+ ### Basic molecule operations
41
+ - Parse: `Chem.MolFromSmiles(...)`
42
+ - Canonicalize: `Chem.CanonSmiles(...)`
43
+ - Substructure: `mol.HasSubstructMatch(query)`
44
+ - Descriptors: `Descriptors.CalcMolDescriptors(mol)`
45
+ - Fingerprints + similarity: `DataStructs.FingerprintSimilarity(fp1, fp2)`
46
+ - Draw: `Draw.MolToImage(mol)`
47
+
48
+ ### Typical MCP (Model Context Protocol) service flow
49
+ 1. Client sends molecule input (SMILES/InChI/mol block).
50
+ 2. Service validates and normalizes structure.
51
+ 3. Service executes requested operation (descriptor/fingerprint/search/render/etc.).
52
+ 4. Service returns structured JSON (result, warnings, errors).
53
+
54
+ ---
55
+
56
+ ## 4) Available Tools and Endpoints List
57
+
58
+ Suggested MCP (Model Context Protocol) service endpoints/tools:
59
+
60
+ - `parse_molecule`
61
+ - Input: SMILES/InChI/mol block
62
+ - Output: normalized molecule metadata, canonical SMILES, validation status
63
+
64
+ - `compute_descriptors`
65
+ - Output: selected descriptors (e.g., MolWt, LogP, TPSA, QED, counts)
66
+
67
+ - `generate_fingerprint`
68
+ - Output: RDKit/Morgan/AtomPair/Torsion fingerprints (configurable params)
69
+
70
+ - `similarity`
71
+ - Output: Tanimoto/Dice/Cosine similarity between two molecules/fingerprints
72
+
73
+ - `substructure_search`
74
+ - Input: target + SMARTS query
75
+ - Output: match boolean, atom/bond match indices
76
+
77
+ - `find_mcs`
78
+ - Output: maximum common substructure (SMARTS, atom/bond counts)
79
+
80
+ - `enumerate_stereoisomers`
81
+ - Output: stereoisomer set and count
82
+
83
+ - `enumerate_heterocycles`
84
+ - Output: transformed heterocycle variants
85
+
86
+ - `standardize_molecule`
87
+ - Output: cleaned/neutralized/tautomer-ordered form (MolStandardize)
88
+
89
+ - `draw_molecule`
90
+ - Output: PNG/SVG payload or file reference
91
+
92
+ - `reaction_enumeration` (optional)
93
+ - Output: products from reaction + building blocks
94
+
95
+ - `feature_finder_cli_bridge` (optional)
96
+ - Bridges RDKit FeatFinderCLI-style functionality
97
+
98
+ - `db_create` / `db_search` (optional)
99
+ - Wraps `Projects/DbCLI/CreateDb.py` and `SearchDb.py` workflows
100
+
101
+ ---
102
+
103
+ ## 5) Common Issues and Notes
104
+
105
+ - RDKit build/runtime mismatch:
106
+ - Ensure the Python environment uses the same RDKit binary installation.
107
+ - Missing optional drawing deps:
108
+ - Install Pillow/Cairo/Qt backends for image generation reliability.
109
+ - InChI failures:
110
+ - Confirm InChI support is present in your RDKit build.
111
+ - Large batch performance:
112
+ - Prefer batched calls; avoid per-molecule process startup.
113
+ - Cache parsed molecules/fingerprints when possible.
114
+ - Threading:
115
+ - Some operations are CPU-heavy; use process pools for throughput-critical services.
116
+ - Error handling:
117
+ - Return clear parse/validation errors rather than failing silently.
118
+
119
+ ---
120
+
121
+ ## 6) Reference Links or Documentation
122
+
123
+ - RDKit repository: https://github.com/rdkit/rdkit
124
+ - Main README: https://github.com/rdkit/rdkit/blob/master/README.md
125
+ - RDKit Book / docs: https://github.com/rdkit/rdkit/tree/master/Docs/Book
126
+ - Installation guide: https://github.com/rdkit/rdkit/blob/master/Docs/Book/Install.md
127
+ - C++/Python getting started: https://github.com/rdkit/rdkit/blob/master/Docs/Book/GettingStartedInC%2B%2B.md
128
+ - Contrib utilities: https://github.com/rdkit/rdkit/tree/master/Contrib
rdkit/mcp_output/analysis.json ADDED
The diff for this file is too large to render. See raw diff
 
rdkit/mcp_output/diff_report.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Difference Report — `rdkit`
2
+
3
+ **Generated:** 2026-03-12 05:21:17
4
+ **Repository:** `rdkit`
5
+ **Project Type:** Python library
6
+ **Scope/Intrusiveness:** None
7
+ **Workflow Status:** ✅ Success
8
+ **Test Status:** ❌ Failed
9
+ **Files Changed:** 8 added, 0 modified, 0 deleted
10
+
11
+ ---
12
+
13
+ ## 1) Project Overview
14
+
15
+ This change set introduces **8 new files** to the `rdkit` repository without modifying existing files.
16
+ Given the “Basic functionality” feature label and zero intrusive changes, this appears to be an **additive update** intended to extend or scaffold functionality while minimizing regression risk in existing code paths.
17
+
18
+ However, despite successful workflow execution, the test suite failed, indicating at least one incompatibility, missing dependency, or incomplete integration in the newly added components.
19
+
20
+ ---
21
+
22
+ ## 2) Change Summary
23
+
24
+ | Metric | Value |
25
+ |---|---|
26
+ | New files | 8 |
27
+ | Modified files | 0 |
28
+ | Deleted files | 0 |
29
+ | Net impact | Additive only |
30
+ | CI/workflow | Passed |
31
+ | Tests | Failed |
32
+
33
+ ### High-level interpretation
34
+ - **Positive:** Existing files remain untouched, reducing direct risk to stable modules.
35
+ - **Concern:** Test failure means the new additions are not yet production-ready as-is.
36
+
37
+ ---
38
+
39
+ ## 3) Difference Analysis
40
+
41
+ Because no existing files were modified, the differences are likely in one or more of these categories:
42
+
43
+ 1. **New module/package files** (e.g., new APIs, helpers, utilities)
44
+ 2. **New test files** that expose existing latent issues or incomplete new behavior
45
+ 3. **Configuration/metadata additions** (packaging, CI, docs, examples)
46
+ 4. **Data/resource files** needed by functionality but possibly not wired correctly
47
+
48
+ ### Risk profile of additive-only changes
49
+ - **Low risk** of breaking legacy behavior directly.
50
+ - **Medium risk** of integration failure if:
51
+ - imports are unresolved,
52
+ - package discovery excludes new modules,
53
+ - runtime dependencies are not pinned/installed,
54
+ - tests assume unavailable environment/resources.
55
+
56
+ ---
57
+
58
+ ## 4) Technical Analysis
59
+
60
+ ## CI vs Test Mismatch
61
+ Workflow success with test failure usually indicates:
62
+ - pipeline stages before tests succeeded (lint/build/setup),
63
+ - unit/integration tests failed at runtime or assertion level.
64
+
65
+ ### Likely technical causes
66
+ - **Import path issues** (`__init__.py`, namespace/package registration)
67
+ - **Missing optional dependency** not included in test environment
68
+ - **Inconsistent test assumptions** (OS/path/timezone/random seed)
69
+ - **Uninitialized fixtures/resources** for new functionality
70
+ - **Version skew** (Python, RDKit build variants, third-party libs)
71
+
72
+ ### Validation focus areas
73
+ - Ensure new files are included in package manifest/build system.
74
+ - Confirm test runner discovers and executes intended tests only.
75
+ - Verify deterministic tests (no hidden external state dependencies).
76
+ - Check whether any newly added tests rely on unavailable local artifacts.
77
+
78
+ ---
79
+
80
+ ## 5) Quality and Stability Assessment
81
+
82
+ **Current readiness:** ⚠️ Not release-ready (due to failed tests)
83
+
84
+ **Confidence level:** Moderate (structural change is limited, but functional validity is not established)
85
+
86
+ **Impact on core library:** Likely low direct impact, but unresolved failures block merge confidence and may mask deeper integration problems.
87
+
88
+ ---
89
+
90
+ ## 6) Recommendations & Improvements
91
+
92
+ ## Immediate (P0)
93
+ 1. **Triage failed tests from CI logs**
94
+ - Identify exact failing test files/cases and stack traces.
95
+ 2. **Classify failure type**
96
+ - Environment/setup vs code logic vs test design.
97
+ 3. **Apply minimal corrective patch**
98
+ - Keep change non-intrusive; avoid unrelated refactors.
99
+ 4. **Re-run full test matrix**
100
+ - Especially across supported Python and platform versions.
101
+
102
+ ## Short-term (P1)
103
+ 1. Add/adjust **dependency declarations** for new functionality.
104
+ 2. Harden tests with deterministic fixtures and explicit mocks.
105
+ 3. Add smoke tests for new modules’ importability and basic API behavior.
106
+ 4. Ensure docs/examples (if added) match executable behavior.
107
+
108
+ ## Medium-term (P2)
109
+ 1. Add CI guardrails:
110
+ - fail-fast on missing resources,
111
+ - stricter packaging checks (sdist/wheel contents),
112
+ - optional-dependency test lanes.
113
+ 2. Improve observability in tests:
114
+ - clearer assertion messages,
115
+ - structured logs for flaky paths.
116
+
117
+ ---
118
+
119
+ ## 7) Deployment Information
120
+
121
+ Since tests failed, deployment should be treated as **blocked**.
122
+
123
+ ### Suggested deployment decision
124
+ - **Do not promote** to release branches or package index yet.
125
+ - Permit only **draft/pre-merge validation artifacts** if needed for debugging.
126
+
127
+ ### Pre-deployment checklist
128
+ - [ ] All newly added files are packaged/discoverable
129
+ - [ ] Full test suite green on required matrix
130
+ - [ ] No new warnings elevated to errors in release config
131
+ - [ ] Changelog/release notes prepared for added functionality
132
+ - [ ] Rollback plan documented (if feature flagging is unavailable)
133
+
134
+ ---
135
+
136
+ ## 8) Future Planning
137
+
138
+ 1. **Stabilization sprint for additive features**
139
+ - Resolve current failures and add regression tests.
140
+ 2. **Incremental integration strategy**
141
+ - Land scaffolding first, behavior next, then performance tuning.
142
+ 3. **Compatibility verification**
143
+ - Validate across key RDKit environments and dependency variants.
144
+ 4. **Release governance**
145
+ - Require green tests + minimal coverage threshold for new modules.
146
+
147
+ ---
148
+
149
+ ## 9) Executive Conclusion
150
+
151
+ This update is structurally safe (add-only, non-intrusive) but **functionally incomplete** due to test failures.
152
+ The recommended path is rapid failure triage, targeted fixes, and full matrix revalidation before any release action. Once tests pass, this change set should be low risk to integrate.
rdkit/mcp_output/mcp_plugin/__init__.py ADDED
File without changes
rdkit/mcp_output/mcp_plugin/adapter.py ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import importlib
4
+ import inspect
5
+ from typing import Any, Dict, Optional, List
6
+
7
+ source_path = os.path.join(
8
+ os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
9
+ "source",
10
+ )
11
+ sys.path.insert(0, source_path)
12
+
13
+
14
+ class Adapter:
15
+ """
16
+ MCP Import-mode adapter for RDKit repository modules discovered via analysis.
17
+
18
+ This adapter attempts direct module imports first ("import" mode). If imports fail,
19
+ it gracefully falls back to "fallback" mode and returns actionable guidance.
20
+ All public methods return a unified dictionary payload with a required `status` field.
21
+ """
22
+
23
+ def __init__(self) -> None:
24
+ self.mode = "import"
25
+ self._modules: Dict[str, Optional[Any]] = {}
26
+ self._import_errors: Dict[str, str] = {}
27
+ self._load_modules()
28
+
29
+ # ==========================================================================
30
+ # Core utilities
31
+ # ==========================================================================
32
+
33
+ def _result(
34
+ self,
35
+ status: str,
36
+ message: str,
37
+ data: Optional[Any] = None,
38
+ error: Optional[str] = None,
39
+ guidance: Optional[str] = None,
40
+ ) -> Dict[str, Any]:
41
+ return {
42
+ "status": status,
43
+ "mode": self.mode,
44
+ "message": message,
45
+ "data": data,
46
+ "error": error,
47
+ "guidance": guidance,
48
+ }
49
+
50
+ def _import_module(self, module_path: str) -> Optional[Any]:
51
+ try:
52
+ module = importlib.import_module(module_path)
53
+ self._modules[module_path] = module
54
+ return module
55
+ except Exception as exc:
56
+ self._modules[module_path] = None
57
+ self._import_errors[module_path] = (
58
+ f"Failed to import '{module_path}': {exc}"
59
+ )
60
+ return None
61
+
62
+ def _load_modules(self) -> None:
63
+ target_modules = [
64
+ "Regress.Scripts.new_timings",
65
+ "Web.RDExtras.MolImage",
66
+ "Web.RDExtras.MolDepict",
67
+ "Projects.DbCLI.CreateDb",
68
+ "Projects.DbCLI.SearchDb",
69
+ "Code.DataManip.MetricMatrixCalc.Wrap.testMatricCalc",
70
+ "Code.DataStructs.Wrap.testBV",
71
+ "Code.DataStructs.Wrap.testSparseIntVect",
72
+ "rdkit.Chem.FeatFinderCLI",
73
+ "Contrib.MolVS.molvs_cli",
74
+ ]
75
+ for module_path in target_modules:
76
+ self._import_module(module_path)
77
+
78
+ if all(self._modules.get(m) is None for m in target_modules):
79
+ self.mode = "fallback"
80
+
81
+ def health(self) -> Dict[str, Any]:
82
+ """
83
+ Return adapter import health status.
84
+
85
+ Returns:
86
+ dict: Unified status dict including loaded modules and import errors.
87
+ """
88
+ loaded = [k for k, v in self._modules.items() if v is not None]
89
+ failed = {k: e for k, e in self._import_errors.items()}
90
+ return self._result(
91
+ status="ok" if loaded else "degraded",
92
+ message="Adapter health check completed.",
93
+ data={"loaded_modules": loaded, "failed_modules": failed},
94
+ guidance=(
95
+ "If critical modules failed, ensure C++ extension-backed RDKit build artifacts "
96
+ "are available under the source tree and required runtime deps are installed."
97
+ ),
98
+ )
99
+
100
+ def _call_function(
101
+ self, module_path: str, func_name: str, *args: Any, **kwargs: Any
102
+ ) -> Dict[str, Any]:
103
+ module = self._modules.get(module_path)
104
+ if module is None:
105
+ return self._result(
106
+ status="error",
107
+ message=f"Module '{module_path}' is not available.",
108
+ error=self._import_errors.get(module_path, "Unknown import failure."),
109
+ guidance=(
110
+ "Verify repository source path injection and local build artifacts. "
111
+ "For RDKit modules, ensure compiled extensions and numpy are available."
112
+ ),
113
+ )
114
+ try:
115
+ func = getattr(module, func_name, None)
116
+ if func is None or not callable(func):
117
+ available = [n for n, o in inspect.getmembers(module) if callable(o)]
118
+ return self._result(
119
+ status="error",
120
+ message=f"Function '{func_name}' not found in '{module_path}'.",
121
+ error="Missing callable in target module.",
122
+ data={"available_callables_sample": available[:25]},
123
+ guidance="Check function name spelling and module version compatibility.",
124
+ )
125
+ result = func(*args, **kwargs)
126
+ return self._result(
127
+ status="ok",
128
+ message=f"Function '{func_name}' executed successfully.",
129
+ data=result,
130
+ )
131
+ except Exception as exc:
132
+ return self._result(
133
+ status="error",
134
+ message=f"Function '{func_name}' execution failed.",
135
+ error=str(exc),
136
+ guidance=(
137
+ "Validate arguments and required environment. "
138
+ "If the callable depends on RDKit backend libs, ensure they are compiled."
139
+ ),
140
+ )
141
+
142
+ # ==========================================================================
143
+ # Regress.Scripts.new_timings
144
+ # ==========================================================================
145
+
146
+ def call_new_timings_data(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
147
+ """
148
+ Call Regress.Scripts.new_timings.data.
149
+
150
+ Parameters:
151
+ *args: Positional arguments forwarded to data().
152
+ **kwargs: Keyword arguments forwarded to data().
153
+
154
+ Returns:
155
+ dict: Unified status response with callable result or actionable error.
156
+ """
157
+ return self._call_function("Regress.Scripts.new_timings", "data", *args, **kwargs)
158
+
159
+ # ==========================================================================
160
+ # Web.RDExtras.MolImage
161
+ # ==========================================================================
162
+
163
+ def call_molimage_gif(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
164
+ """
165
+ Call Web.RDExtras.MolImage.gif.
166
+
167
+ Parameters:
168
+ *args: Positional arguments for gif().
169
+ **kwargs: Keyword arguments for gif().
170
+
171
+ Returns:
172
+ dict: Unified status response.
173
+ """
174
+ return self._call_function("Web.RDExtras.MolImage", "gif", *args, **kwargs)
175
+
176
+ def call_molimage_svg(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
177
+ """
178
+ Call Web.RDExtras.MolImage.svg.
179
+
180
+ Parameters:
181
+ *args: Positional arguments for svg().
182
+ **kwargs: Keyword arguments for svg().
183
+
184
+ Returns:
185
+ dict: Unified status response.
186
+ """
187
+ return self._call_function("Web.RDExtras.MolImage", "svg", *args, **kwargs)
188
+
189
+ # ==========================================================================
190
+ # Web.RDExtras.MolDepict
191
+ # ==========================================================================
192
+
193
+ def call_moldepict_page(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
194
+ """
195
+ Call Web.RDExtras.MolDepict.page.
196
+
197
+ Parameters:
198
+ *args: Positional arguments for page().
199
+ **kwargs: Keyword arguments for page().
200
+
201
+ Returns:
202
+ dict: Unified status response.
203
+ """
204
+ return self._call_function("Web.RDExtras.MolDepict", "page", *args, **kwargs)
205
+
206
+ # ==========================================================================
207
+ # Projects.DbCLI.CreateDb
208
+ # ==========================================================================
209
+
210
+ def call_createdb_createdb(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
211
+ """
212
+ Call Projects.DbCLI.CreateDb.CreateDb.
213
+
214
+ Parameters:
215
+ *args: Positional arguments for CreateDb().
216
+ **kwargs: Keyword arguments for CreateDb().
217
+
218
+ Returns:
219
+ dict: Unified status response.
220
+ """
221
+ return self._call_function("Projects.DbCLI.CreateDb", "CreateDb", *args, **kwargs)
222
+
223
+ def call_createdb_initparser(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
224
+ """
225
+ Call Projects.DbCLI.CreateDb.initParser.
226
+
227
+ Parameters:
228
+ *args: Positional arguments for initParser().
229
+ **kwargs: Keyword arguments for initParser().
230
+
231
+ Returns:
232
+ dict: Unified status response.
233
+ """
234
+ return self._call_function("Projects.DbCLI.CreateDb", "initParser", *args, **kwargs)
235
+
236
+ # ==========================================================================
237
+ # Projects.DbCLI.SearchDb
238
+ # ==========================================================================
239
+
240
+ def call_searchdb_get_mols_from_sdfile(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
241
+ """
242
+ Call Projects.DbCLI.SearchDb.GetMolsFromSDFile.
243
+
244
+ Parameters:
245
+ *args: Positional arguments for GetMolsFromSDFile().
246
+ **kwargs: Keyword arguments for GetMolsFromSDFile().
247
+
248
+ Returns:
249
+ dict: Unified status response.
250
+ """
251
+ return self._call_function("Projects.DbCLI.SearchDb", "GetMolsFromSDFile", *args, **kwargs)
252
+
253
+ def call_searchdb_get_mols_from_smiles_file(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
254
+ """
255
+ Call Projects.DbCLI.SearchDb.GetMolsFromSmilesFile.
256
+
257
+ Parameters:
258
+ *args: Positional arguments for GetMolsFromSmilesFile().
259
+ **kwargs: Keyword arguments for GetMolsFromSmilesFile().
260
+
261
+ Returns:
262
+ dict: Unified status response.
263
+ """
264
+ return self._call_function("Projects.DbCLI.SearchDb", "GetMolsFromSmilesFile", *args, **kwargs)
265
+
266
+ def call_searchdb_get_neighbor_lists(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
267
+ """
268
+ Call Projects.DbCLI.SearchDb.GetNeighborLists.
269
+
270
+ Parameters:
271
+ *args: Positional arguments for GetNeighborLists().
272
+ **kwargs: Keyword arguments for GetNeighborLists().
273
+
274
+ Returns:
275
+ dict: Unified status response.
276
+ """
277
+ return self._call_function("Projects.DbCLI.SearchDb", "GetNeighborLists", *args, **kwargs)
278
+
279
+ # ==========================================================================
280
+ # Code.DataManip.MetricMatrixCalc.Wrap.testMatricCalc
281
+ # ==========================================================================
282
+
283
+ def call_testmatriccalc_feq(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
284
+ """
285
+ Call Code.DataManip.MetricMatrixCalc.Wrap.testMatricCalc.feq.
286
+
287
+ Parameters:
288
+ *args: Positional arguments for feq().
289
+ **kwargs: Keyword arguments for feq().
290
+
291
+ Returns:
292
+ dict: Unified status response.
293
+ """
294
+ return self._call_function(
295
+ "Code.DataManip.MetricMatrixCalc.Wrap.testMatricCalc", "feq", *args, **kwargs
296
+ )
297
+
298
+ # ==========================================================================
299
+ # Code.DataStructs.Wrap.testBV
300
+ # ==========================================================================
301
+
302
+ def call_testbv_feq(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
303
+ """
304
+ Call Code.DataStructs.Wrap.testBV.feq.
305
+
306
+ Parameters:
307
+ *args: Positional arguments for feq().
308
+ **kwargs: Keyword arguments for feq().
309
+
310
+ Returns:
311
+ dict: Unified status response.
312
+ """
313
+ return self._call_function("Code.DataStructs.Wrap.testBV", "feq", *args, **kwargs)
314
+
315
+ # ==========================================================================
316
+ # Code.DataStructs.Wrap.testSparseIntVect
317
+ # ==========================================================================
318
+
319
+ def call_testsparseintvect_feq(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
320
+ """
321
+ Call Code.DataStructs.Wrap.testSparseIntVect.feq.
322
+
323
+ Parameters:
324
+ *args: Positional arguments for feq().
325
+ **kwargs: Keyword arguments for feq().
326
+
327
+ Returns:
328
+ dict: Unified status response.
329
+ """
330
+ return self._call_function("Code.DataStructs.Wrap.testSparseIntVect", "feq", *args, **kwargs)
331
+
332
+ # ==========================================================================
333
+ # CLI-oriented helper wrappers (from analysis)
334
+ # ==========================================================================
335
+
336
+ def call_featfindercli_module(self, argv: Optional[List[str]] = None) -> Dict[str, Any]:
337
+ """
338
+ Execute rdkit.Chem.FeatFinderCLI entry-style behavior if available.
339
+
340
+ Parameters:
341
+ argv: Optional argument list. If omitted, module defaults are used.
342
+
343
+ Returns:
344
+ dict: Unified status response.
345
+ """
346
+ module_path = "rdkit.Chem.FeatFinderCLI"
347
+ module = self._modules.get(module_path)
348
+ if module is None:
349
+ return self._result(
350
+ status="error",
351
+ message="FeatFinderCLI module is unavailable.",
352
+ error=self._import_errors.get(module_path, "Unknown import failure."),
353
+ guidance="Confirm RDKit Python modules and compiled backends are importable.",
354
+ )
355
+ try:
356
+ if hasattr(module, "main") and callable(module.main):
357
+ result = module.main(argv) if argv is not None else module.main()
358
+ return self._result("ok", "FeatFinderCLI executed.", data=result)
359
+ return self._result(
360
+ status="error",
361
+ message="No callable main() found in FeatFinderCLI.",
362
+ guidance="Inspect module API and call exported functions directly.",
363
+ )
364
+ except Exception as exc:
365
+ return self._result(
366
+ status="error",
367
+ message="FeatFinderCLI execution failed.",
368
+ error=str(exc),
369
+ guidance="Check CLI arguments and required feature definition inputs.",
370
+ )
371
+
372
+ def call_molvs_cli_module(self, argv: Optional[List[str]] = None) -> Dict[str, Any]:
373
+ """
374
+ Execute Contrib.MolVS.molvs_cli entry-style behavior if available.
375
+
376
+ Parameters:
377
+ argv: Optional argument list for CLI-like execution.
378
+
379
+ Returns:
380
+ dict: Unified status response.
381
+ """
382
+ module_path = "Contrib.MolVS.molvs_cli"
383
+ module = self._modules.get(module_path)
384
+ if module is None:
385
+ return self._result(
386
+ status="error",
387
+ message="molvs_cli module is unavailable.",
388
+ error=self._import_errors.get(module_path, "Unknown import failure."),
389
+ guidance="Ensure Contrib modules exist in source path and dependencies are installed.",
390
+ )
391
+ try:
392
+ if hasattr(module, "main") and callable(module.main):
393
+ result = module.main(argv) if argv is not None else module.main()
394
+ return self._result("ok", "molvs_cli executed.", data=result)
395
+ return self._result(
396
+ status="error",
397
+ message="No callable main() found in molvs_cli.",
398
+ guidance="Inspect module for alternate callable entry points.",
399
+ )
400
+ except Exception as exc:
401
+ return self._result(
402
+ status="error",
403
+ message="molvs_cli execution failed.",
404
+ error=str(exc),
405
+ guidance="Validate CLI arguments and molecule input format.",
406
+ )
rdkit/mcp_output/mcp_plugin/main.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MCP Service Auto-Wrapper - Auto-generated
3
+ """
4
+ from mcp_service import create_app
5
+
6
+ def main():
7
+ """Main entry point"""
8
+ app = create_app()
9
+ return app
10
+
11
+ if __name__ == "__main__":
12
+ app = main()
13
+ app.run()
rdkit/mcp_output/mcp_plugin/mcp_service.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
5
+ if source_path not in sys.path:
6
+ sys.path.insert(0, source_path)
7
+
8
+ from fastmcp import FastMCP
9
+
10
+ from Regress.Scripts.new_timings import data
11
+ from Web.RDExtras.MolImage import svg, gif
12
+ from Web.RDExtras.MolDepict import page
13
+ from Projects.DbCLI.CreateDb import initParser, CreateDb
14
+ from Projects.DbCLI.SearchDb import GetMolsFromSDFile, GetNeighborLists, GetMolsFromSmilesFile
15
+ from Code.DataManip.MetricMatrixCalc.Wrap.testMatricCalc import feq
16
+ from Code.DataStructs.Wrap.testBV import feq
17
+ from Code.DataStructs.Wrap.testSparseIntVect import feq
18
+
19
+ mcp = FastMCP("unknown_service")
20
+
21
+
22
+ @mcp.tool(name="data", description="Auto-wrapped function data")
23
+ def data(payload: dict):
24
+ try:
25
+ if data is None:
26
+ return {"success": False, "result": None, "error": "Function data is not available"}
27
+ result = data(**payload)
28
+ return {"success": True, "result": result, "error": None}
29
+ except Exception as e:
30
+ return {"success": False, "result": None, "error": str(e)}
31
+
32
+ @mcp.tool(name="gif", description="Auto-wrapped function gif")
33
+ def gif(payload: dict):
34
+ try:
35
+ if gif is None:
36
+ return {"success": False, "result": None, "error": "Function gif is not available"}
37
+ result = gif(**payload)
38
+ return {"success": True, "result": result, "error": None}
39
+ except Exception as e:
40
+ return {"success": False, "result": None, "error": str(e)}
41
+
42
+ @mcp.tool(name="svg", description="Auto-wrapped function svg")
43
+ def svg(payload: dict):
44
+ try:
45
+ if svg is None:
46
+ return {"success": False, "result": None, "error": "Function svg is not available"}
47
+ result = svg(**payload)
48
+ return {"success": True, "result": result, "error": None}
49
+ except Exception as e:
50
+ return {"success": False, "result": None, "error": str(e)}
51
+
52
+ @mcp.tool(name="page", description="Auto-wrapped function page")
53
+ def page(payload: dict):
54
+ try:
55
+ if page is None:
56
+ return {"success": False, "result": None, "error": "Function page is not available"}
57
+ result = page(**payload)
58
+ return {"success": True, "result": result, "error": None}
59
+ except Exception as e:
60
+ return {"success": False, "result": None, "error": str(e)}
61
+
62
+ @mcp.tool(name="CreateDb", description="Auto-wrapped function CreateDb")
63
+ def CreateDb(payload: dict):
64
+ try:
65
+ if CreateDb is None:
66
+ return {"success": False, "result": None, "error": "Function CreateDb is not available"}
67
+ result = CreateDb(**payload)
68
+ return {"success": True, "result": result, "error": None}
69
+ except Exception as e:
70
+ return {"success": False, "result": None, "error": str(e)}
71
+
72
+ @mcp.tool(name="initParser", description="Auto-wrapped function initParser")
73
+ def initParser(payload: dict):
74
+ try:
75
+ if initParser is None:
76
+ return {"success": False, "result": None, "error": "Function initParser is not available"}
77
+ result = initParser(**payload)
78
+ return {"success": True, "result": result, "error": None}
79
+ except Exception as e:
80
+ return {"success": False, "result": None, "error": str(e)}
81
+
82
+ @mcp.tool(name="GetMolsFromSDFile", description="Auto-wrapped function GetMolsFromSDFile")
83
+ def GetMolsFromSDFile(payload: dict):
84
+ try:
85
+ if GetMolsFromSDFile is None:
86
+ return {"success": False, "result": None, "error": "Function GetMolsFromSDFile is not available"}
87
+ result = GetMolsFromSDFile(**payload)
88
+ return {"success": True, "result": result, "error": None}
89
+ except Exception as e:
90
+ return {"success": False, "result": None, "error": str(e)}
91
+
92
+ @mcp.tool(name="GetMolsFromSmilesFile", description="Auto-wrapped function GetMolsFromSmilesFile")
93
+ def GetMolsFromSmilesFile(payload: dict):
94
+ try:
95
+ if GetMolsFromSmilesFile is None:
96
+ return {"success": False, "result": None, "error": "Function GetMolsFromSmilesFile is not available"}
97
+ result = GetMolsFromSmilesFile(**payload)
98
+ return {"success": True, "result": result, "error": None}
99
+ except Exception as e:
100
+ return {"success": False, "result": None, "error": str(e)}
101
+
102
+ @mcp.tool(name="GetNeighborLists", description="Auto-wrapped function GetNeighborLists")
103
+ def GetNeighborLists(payload: dict):
104
+ try:
105
+ if GetNeighborLists is None:
106
+ return {"success": False, "result": None, "error": "Function GetNeighborLists is not available"}
107
+ result = GetNeighborLists(**payload)
108
+ return {"success": True, "result": result, "error": None}
109
+ except Exception as e:
110
+ return {"success": False, "result": None, "error": str(e)}
111
+
112
+ @mcp.tool(name="feq", description="Auto-wrapped function feq")
113
+ def feq(payload: dict):
114
+ try:
115
+ if feq is None:
116
+ return {"success": False, "result": None, "error": "Function feq is not available"}
117
+ result = feq(**payload)
118
+ return {"success": True, "result": result, "error": None}
119
+ except Exception as e:
120
+ return {"success": False, "result": None, "error": str(e)}
121
+
122
+ @mcp.tool(name="feq", description="Auto-wrapped function feq")
123
+ def feq(payload: dict):
124
+ try:
125
+ if feq is None:
126
+ return {"success": False, "result": None, "error": "Function feq is not available"}
127
+ result = feq(**payload)
128
+ return {"success": True, "result": result, "error": None}
129
+ except Exception as e:
130
+ return {"success": False, "result": None, "error": str(e)}
131
+
132
+ @mcp.tool(name="feq", description="Auto-wrapped function feq")
133
+ def feq(payload: dict):
134
+ try:
135
+ if feq is None:
136
+ return {"success": False, "result": None, "error": "Function feq is not available"}
137
+ result = feq(**payload)
138
+ return {"success": True, "result": result, "error": None}
139
+ except Exception as e:
140
+ return {"success": False, "result": None, "error": str(e)}
141
+
142
+
143
+
144
+ def create_app():
145
+ """Create and return FastMCP application instance"""
146
+ return mcp
147
+
148
+ if __name__ == "__main__":
149
+ mcp.run(transport="http", host="0.0.0.0", port=8000)
rdkit/mcp_output/requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastmcp
2
+ fastapi
3
+ uvicorn[standard]
4
+ pydantic>=2.0.0
5
+ rdkit compiled Python package (C++ extension modules)
6
+ numpy
rdkit/mcp_output/start_mcp.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ MCP Service Startup Entry
4
+ """
5
+ import sys
6
+ import os
7
+
8
+ project_root = os.path.dirname(os.path.abspath(__file__))
9
+ mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
10
+ if mcp_plugin_dir not in sys.path:
11
+ sys.path.insert(0, mcp_plugin_dir)
12
+
13
+ from mcp_service import create_app
14
+
15
+ def main():
16
+ """Start FastMCP service"""
17
+ app = create_app()
18
+ # Use environment variable to configure port, default 8000
19
+ port = int(os.environ.get("MCP_PORT", "8000"))
20
+
21
+ # Choose transport mode based on environment variable
22
+ transport = os.environ.get("MCP_TRANSPORT", "stdio")
23
+ if transport == "http":
24
+ app.run(transport="http", host="0.0.0.0", port=port)
25
+ else:
26
+ # Default to STDIO mode
27
+ app.run()
28
+
29
+ if __name__ == "__main__":
30
+ main()
rdkit/mcp_output/workflow_summary.json ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": {
3
+ "name": "rdkit",
4
+ "url": "https://github.com/rdkit/rdkit",
5
+ "local_path": "/Users/ghh/Documents/Code/Code2MCP-private/workspace/rdkit",
6
+ "description": "Python library",
7
+ "features": "Basic functionality",
8
+ "tech_stack": "Python",
9
+ "stars": 0,
10
+ "forks": 0,
11
+ "language": "Python",
12
+ "last_updated": "",
13
+ "complexity": "complex",
14
+ "intrusiveness_risk": "medium"
15
+ },
16
+ "execution": {
17
+ "start_time": 1773263771.541916,
18
+ "end_time": 1773263949.6153212,
19
+ "duration": 178.0734052658081,
20
+ "status": "success",
21
+ "workflow_status": "success",
22
+ "nodes_executed": [
23
+ "download",
24
+ "analysis",
25
+ "env",
26
+ "generate",
27
+ "run",
28
+ "review",
29
+ "finalize"
30
+ ],
31
+ "total_files_processed": 18,
32
+ "environment_type": "unknown",
33
+ "llm_calls": 0,
34
+ "deepwiki_calls": 0
35
+ },
36
+ "tests": {
37
+ "original_project": {
38
+ "passed": false,
39
+ "details": {},
40
+ "test_coverage": "100%",
41
+ "execution_time": 0,
42
+ "test_files": []
43
+ },
44
+ "mcp_plugin": {
45
+ "passed": true,
46
+ "details": {},
47
+ "service_health": "healthy",
48
+ "startup_time": 0,
49
+ "transport_mode": "stdio",
50
+ "fastmcp_version": "unknown",
51
+ "mcp_version": "unknown"
52
+ }
53
+ },
54
+ "analysis": {
55
+ "structure": {
56
+ "packages": [
57
+ "source.Contrib.RxnRoleAssignment",
58
+ "source.Scripts.gen_rdkit_stubs",
59
+ "source.Scripts.patch_rdkit_docstrings",
60
+ "source.rdkit",
61
+ "source.rdkit.Avalon",
62
+ "source.rdkit.Chem",
63
+ "source.rdkit.DataManip",
64
+ "source.rdkit.DataStructs",
65
+ "source.rdkit.Dbase",
66
+ "source.rdkit.DistanceGeometry",
67
+ "source.rdkit.ForceField",
68
+ "source.rdkit.Geometry",
69
+ "source.rdkit.ML",
70
+ "source.rdkit.Numerics",
71
+ "source.rdkit.SimDivFilters",
72
+ "source.rdkit.VLib",
73
+ "source.rdkit.sping",
74
+ "source.rdkit.utils"
75
+ ]
76
+ },
77
+ "dependencies": {
78
+ "has_environment_yml": false,
79
+ "has_requirements_txt": false,
80
+ "pyproject": false,
81
+ "setup_cfg": true,
82
+ "setup_py": false
83
+ },
84
+ "entry_points": {
85
+ "imports": [],
86
+ "cli": [],
87
+ "modules": []
88
+ },
89
+ "risk_assessment": {
90
+ "import_feasibility": 0.72,
91
+ "intrusiveness_risk": "medium",
92
+ "complexity": "complex"
93
+ },
94
+ "deepwiki_analysis": {
95
+ "repo_url": "https://github.com/rdkit/rdkit",
96
+ "repo_name": "rdkit",
97
+ "error": "DeepWiki analysis failed",
98
+ "model": "gpt-5.3-codex",
99
+ "source": "llm_direct_analysis",
100
+ "success": false
101
+ },
102
+ "code_complexity": {
103
+ "cyclomatic_complexity": "medium",
104
+ "cognitive_complexity": "medium",
105
+ "maintainability_index": 75
106
+ },
107
+ "security_analysis": {
108
+ "vulnerabilities_found": 0,
109
+ "security_score": 85,
110
+ "recommendations": []
111
+ }
112
+ },
113
+ "plugin_generation": {
114
+ "files_created": [
115
+ "mcp_output/start_mcp.py",
116
+ "mcp_output/mcp_plugin/__init__.py",
117
+ "mcp_output/mcp_plugin/mcp_service.py",
118
+ "mcp_output/mcp_plugin/adapter.py",
119
+ "mcp_output/mcp_plugin/main.py",
120
+ "mcp_output/requirements.txt",
121
+ "mcp_output/README_MCP.md"
122
+ ],
123
+ "main_entry": "start_mcp.py",
124
+ "requirements": [
125
+ "fastmcp>=0.1.0",
126
+ "pydantic>=2.0.0"
127
+ ],
128
+ "readme_path": "/Users/ghh/Documents/Code/Code2MCP-private/workspace/rdkit/mcp_output/README_MCP.md",
129
+ "adapter_mode": "import",
130
+ "total_lines_of_code": 0,
131
+ "generated_files_size": 0,
132
+ "tool_endpoints": 0,
133
+ "supported_features": [
134
+ "Basic functionality"
135
+ ],
136
+ "generated_tools": [
137
+ "Basic tools",
138
+ "Health check tools",
139
+ "Version info tools"
140
+ ]
141
+ },
142
+ "code_review": {},
143
+ "errors": [],
144
+ "warnings": [],
145
+ "recommendations": [
146
+ "Add a minimal but representative CI smoke-test matrix (Linux/macOS/Windows × Python 3.10–3.12) that imports key compiled modules before running full suites",
147
+ "split MCP-exposed endpoints into “public API” vs “internal/test-only” and remove autogenerated exposure of `testcase/feq/load_tests` symbols",
148
+ "introduce an explicit endpoint allowlist with naming normalization to avoid duplicate/conflicting commands (e.g.",
149
+ "repeated `initParser`)",
150
+ "add `pyproject.toml` (while keeping `setup.cfg`) to centralize build/test/tool config and declare optional dependency groups",
151
+ "create reproducible dev environments (`requirements-dev.txt` or `environment.yml`) since none are currently present",
152
+ "add contract tests for generated MCP adapter signatures and argument schemas to catch AST-discovery drift",
153
+ "gate heavy/legacy test files (`rough_test.py`",
154
+ "very large test modules) behind markers and run them separately to improve CI signal",
155
+ "enforce lint/type checks on Python-only surfaces (ruff + mypy/pyright on scripts/contrib/MCP plugin) with gradual adoption",
156
+ "add coverage reporting focused on MCP plugin and CLI modules plus per-package thresholds",
157
+ "harden plugin reliability with structured error handling/timeouts and clear user-facing errors when compiled RDKit components are unavailable",
158
+ "add security/dependency automation (Dependabot/Renovate + pip-audit) for `mcp_output/requirements.txt` and GitHub workflows",
159
+ "reduce CI duplication by templating/shared job logic across Azure and GitHub workflows",
160
+ "document supported/stable MCP endpoints and deprecation policy in `README_MCP.md`",
161
+ "add basic performance benchmarks for high-use endpoints (`svg/gif`",
162
+ "fingerprint/search flows) and track regressions in CI",
163
+ "introduce golden-file tests for rendering outputs (SVG/PNG hash or perceptual checks) to prevent silent depiction changes",
164
+ "add ownership/CODEOWNERS for core areas (GraphMol",
165
+ "Draw",
166
+ "MCP plugin",
167
+ "Contrib) to speed reviews"
168
+ ],
169
+ "performance_metrics": {
170
+ "memory_usage_mb": 0,
171
+ "cpu_usage_percent": 0,
172
+ "response_time_ms": 0,
173
+ "throughput_requests_per_second": 0
174
+ },
175
+ "deployment_info": {
176
+ "supported_platforms": [
177
+ "Linux",
178
+ "Windows",
179
+ "macOS"
180
+ ],
181
+ "python_versions": [
182
+ "3.8",
183
+ "3.9",
184
+ "3.10",
185
+ "3.11",
186
+ "3.12"
187
+ ],
188
+ "deployment_methods": [
189
+ "Docker",
190
+ "pip",
191
+ "conda"
192
+ ],
193
+ "monitoring_support": true,
194
+ "logging_configuration": "structured"
195
+ },
196
+ "execution_analysis": {
197
+ "success_factors": [
198
+ "Workflow status is success with all planned nodes executed (download → finalize) and no runtime errors/warnings recorded.",
199
+ "MCP plugin boot/health checks passed (healthy stdio service), confirming deployable baseline service generation.",
200
+ "Import-based adapter strategy fits RDKit’s Python-first surfaces and avoided hard dependency on CLI entry points.",
201
+ "Repository analysis was comprehensive enough (890 files discovered) to generate broad endpoint coverage."
202
+ ],
203
+ "failure_reasons": [
204
+ "No hard workflow failure occurred.",
205
+ "Quality gap: original project tests are marked not passed/unknown despite reported 100% coverage metadata (likely instrumentation inconsistency).",
206
+ "DeepWiki analysis failed, reducing architecture/context confidence and forcing fallback analysis.",
207
+ "Over-exposure from AST discovery (test symbols/classes duplicated as endpoints) is a functional correctness risk, not execution failure."
208
+ ],
209
+ "overall_assessment": "good",
210
+ "node_performance": {
211
+ "download_time": "Completed successfully; repository imported via zip fallback, indicating resilient acquisition path.",
212
+ "analysis_time": "Completed with large-scope AST discovery; high breadth but noisy endpoint extraction.",
213
+ "generation_time": "Completed and produced expected MCP scaffold files; however generated LOC/size metrics are zero, suggesting telemetry/reporting defect.",
214
+ "test_time": "Plugin health test passed quickly; original project test signal is weak/ambiguous and needs normalization."
215
+ },
216
+ "resource_usage": {
217
+ "memory_efficiency": "Not measurable from provided metrics (reported as 0); add actual runtime telemetry.",
218
+ "cpu_efficiency": "Not measurable from provided metrics (reported as 0); profiling hooks are missing.",
219
+ "disk_usage": "Generated artifact set is small and efficient, but file size telemetry is incorrectly reported as 0."
220
+ }
221
+ },
222
+ "technical_quality": {
223
+ "code_quality_score": 72,
224
+ "architecture_score": 70,
225
+ "performance_score": 61,
226
+ "maintainability_score": 68,
227
+ "security_score": 85,
228
+ "scalability_score": 66
229
+ }
230
+ }
rdkit/source/.DS_Store ADDED
Binary file (6.15 kB). View file
 
rdkit/source/.azure-pipelines/linux_build.yml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ sudo apt-get install g++ wget make libgl1-mesa-dev mesa-common-dev
4
+ source ${CONDA}/etc/profile.d/conda.sh
5
+ sudo chown -R ${USER} ${CONDA}
6
+ conda config --set always_yes yes --set changeps1 no
7
+ conda update -q conda
8
+ conda config --set channel_priority strict
9
+ conda config --add channels conda-forge
10
+ conda config --set solver libmamba
11
+ conda info -a
12
+ conda create --name rdkit_build -c conda-forge --override-channels $(python) cmake \
13
+ boost-cpp=$(boost_version) \
14
+ boost=$(boost_version) \
15
+ numpy pillow eigen pandas=2.0 matplotlib-base=3.8 \
16
+ qt=5 cairo
17
+ conda activate rdkit_build
18
+ conda config --env --add channels conda-forge
19
+ conda config --env --set channel_priority strict
20
+ conda install -c conda-forge --override-channels pytest nbval ipykernel>=6.0
21
+ displayName: Setup build environment
22
+ - bash: |
23
+ source ${CONDA}/etc/profile.d/conda.sh
24
+ conda activate rdkit_build
25
+ export CXXFLAGS="${CXXFLAGS} -Wall -Werror"
26
+ mkdir build && cd build && \
27
+ cmake .. \
28
+ -DCMAKE_BUILD_TYPE=Release \
29
+ -DRDK_INSTALL_INTREE=ON \
30
+ -DRDK_INSTALL_STATIC_LIBS=OFF \
31
+ -DRDK_BUILD_CPP_TESTS=ON \
32
+ -DRDK_BUILD_PYTHON_WRAPPERS=ON \
33
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
34
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
35
+ -DRDK_OPTIMIZE_POPCNT=ON \
36
+ -DRDK_BUILD_TEST_GZIP=ON \
37
+ -DRDK_BUILD_FREESASA_SUPPORT=ON \
38
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
39
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
40
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
41
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
42
+ -DRDK_BUILD_CAIRO_SUPPORT=ON \
43
+ -DRDK_BUILD_QT_SUPPORT=ON \
44
+ -DQt5_DIR=/usr/lib/x86_64-linux-gnu/cmake/Qt5 \
45
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF \
46
+ -DRDK_SWIG_STATIC=OFF \
47
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
48
+ -DRDK_TEST_MULTITHREADED=ON \
49
+ -DRDK_BUILD_CFFI_LIB=ON \
50
+ -DBoost_NO_SYSTEM_PATHS=ON \
51
+ -DRDK_BOOST_PYTHON3_NAME=$(python_name) \
52
+ -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/bin/python3 \
53
+ -DCMAKE_INCLUDE_PATH="${CONDA_PREFIX}/include" \
54
+ -DCMAKE_LIBRARY_PATH="${CONDA_PREFIX}/lib"
55
+ displayName: Configure build (Run CMake)
56
+ - bash: |
57
+ source ${CONDA}/etc/profile.d/conda.sh
58
+ conda activate rdkit_build
59
+ cd build
60
+ make -j $( $(number_of_cores) ) install
61
+ displayName: Build
62
+ - bash: |
63
+ source ${CONDA}/etc/profile.d/conda.sh
64
+ conda activate rdkit_build
65
+ export RDBASE=`pwd`
66
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
67
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
68
+ echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
69
+ export QT_QPA_PLATFORM='offscreen'
70
+ cd build
71
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
72
+ displayName: Run tests
73
+ - bash: |
74
+ source ${CONDA}/etc/profile.d/conda.sh
75
+ conda activate rdkit_build
76
+ conda install -c conda-forge --override-channels ipython=8.12 sphinx myst-parser
77
+ export RDBASE=`pwd`
78
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
79
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${LD_LIBRARY_PATH}
80
+ export QT_QPA_PLATFORM='offscreen'
81
+ cd Docs/Book
82
+ make doctest
83
+ displayName: Run documentation tests
84
+ - task: PublishTestResults@2
85
+ inputs:
86
+ testResultsFormat: 'CTest'
87
+ testResultsFiles: 'build/Testing/*/Test.xml'
88
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/linux_build_cartridge.yml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ sudo apt-get update
4
+ sudo apt-get install -y postgresql-14 postgresql-client-14 postgresql-server-dev-14 postgresql-common
5
+ echo "start postgres server"
6
+ sudo systemctl start postgresql.service
7
+ echo "add postgres user"
8
+ sudo -u postgres createuser -s `whoami`
9
+ source ${CONDA}/etc/profile.d/conda.sh
10
+ conda config --set always_yes yes --set changeps1 no
11
+ conda update -q conda
12
+ conda info -a
13
+ conda create --name rdkit_build -c conda-forge --override-channels cmake \
14
+ boost-cpp=$(boost_version) \
15
+ boost=$(boost_version) \
16
+ eigen \
17
+ cairo
18
+ conda activate rdkit_build
19
+ conda config --env --add channels conda-forge
20
+ conda config --env --set channel_priority strict
21
+ displayName: Setup build environment
22
+ - bash: |
23
+ source ${CONDA}/etc/profile.d/conda.sh
24
+ conda activate rdkit_build
25
+ mkdir build && cd build && \
26
+ cmake .. \
27
+ -DCMAKE_BUILD_TYPE=Release \
28
+ -DRDK_INSTALL_INTREE=ON \
29
+ -DRDK_BUILD_CPP_TESTS=OFF \
30
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF \
31
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
32
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
33
+ -DRDK_OPTIMIZE_POPCNT=ON \
34
+ -DRDK_BUILD_TEST_GZIP=ON \
35
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
36
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
37
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF \
38
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
39
+ -DRDK_TEST_MULTITHREADED=ON \
40
+ -DRDK_BUILD_PGSQL=ON \
41
+ -DPostgreSQL_CONFIG=/usr/bin/pg_config
42
+ displayName: Configure build (Run CMake)
43
+ - bash: |
44
+ source ${CONDA}/etc/profile.d/conda.sh
45
+ conda activate rdkit_build
46
+ cd build
47
+ make -j $( $(number_of_cores) ) install
48
+ sudo sh ./Code/PgSQL/rdkit/pgsql_install.sh
49
+ displayName: Build
50
+ - bash: |
51
+ source ${CONDA}/etc/profile.d/conda.sh
52
+ conda activate rdkit_build
53
+ cd build
54
+ sh ./Code/PgSQL/rdkit/pgsql_regress.sh
55
+ if [ -e ./Code/PgSQL/rdkit/regression.diffs ]
56
+ then
57
+ cat ./Code/PgSQL/rdkit/regression.diffs
58
+ exit 1
59
+ fi
60
+ displayName: Run tests
rdkit/source/.azure-pipelines/linux_build_fuzzer.yml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ source ${CONDA}/etc/profile.d/conda.sh
4
+ sudo apt-get install -y clang-9
5
+ sudo chown -R ${USER} ${CONDA}
6
+ conda config --set always_yes yes --set changeps1 no
7
+ conda update -q conda
8
+ conda info -a
9
+ conda create --name rdkit_build cmake -c conda-forge --override-channels \
10
+ boost-cpp=$(boost_version) boost=$(boost_version) \
11
+ py-boost=$(boost_version) libboost=$(boost_version) \
12
+ cairo eigen
13
+ conda activate rdkit_build
14
+ conda config --env --add channels conda-forge
15
+ conda config --env --set channel_priority strict
16
+ displayName: Setup build environment
17
+ - bash: |
18
+ source ${CONDA}/etc/profile.d/conda.sh
19
+ conda activate rdkit_build
20
+ export CC="clang-9"
21
+ export CXX="clang++-9"
22
+ export SANITIZER_FLAGS_address="-fsanitize=address -fsanitize-address-use-after-scope"
23
+ export COVERAGE_FLAGS="-fsanitize=fuzzer-no-link"
24
+ export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $COVERAGE_FLAGS $SANITIZER_FLAGS_address"
25
+ export CXXFLAGS="$CFLAGS"
26
+ export LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
27
+ mkdir build && cd build && \
28
+ cmake .. \
29
+ -DCMAKE_BUILD_TYPE=Release \
30
+ -DRDK_INSTALL_INTREE=ON \
31
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF \
32
+ -DLIB_FUZZING_ENGINE=${LIB_FUZZING_ENGINE} \
33
+ -DRDK_BUILD_FUZZ_TARGETS=ON \
34
+ -DRDK_INSTALL_STATIC_LIBS=ON \
35
+ -DBoost_USE_STATIC_LIBS=ON \
36
+ -DRDK_BUILD_CPP_TESTS=OFF \
37
+ -DBoost_NO_SYSTEM_PATHS=ON \
38
+ -DCMAKE_INCLUDE_PATH="${CONDA_PREFIX}/include" \
39
+ -DCMAKE_LIBRARY_PATH="${CONDA_PREFIX}/lib" \
40
+ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
41
+ displayName: Configure build (Run CMake)
42
+ - bash: |
43
+ source ${CONDA}/etc/profile.d/conda.sh
44
+ conda activate rdkit_build
45
+ cd build
46
+ make -j $( $(number_of_cores) ) install
47
+ displayName: Build
48
+ - bash: |
49
+ source ${CONDA}/etc/profile.d/conda.sh
50
+ conda activate rdkit_build
51
+ corpora=$(find . -type d -name "*_fuzzer")
52
+ for corpus in $corpora; do
53
+ corpus_basename=$(basename $corpus)
54
+ fuzzer_target=$(find . -type f -name "${corpus_basename}" -print -quit)
55
+ ${fuzzer_target} ${corpus}/*
56
+ done
57
+ displayName: Run fuzzer on existing corpora
rdkit/source/.azure-pipelines/linux_build_java.yml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ sudo apt-get install g++ wget make libgl1-mesa-dev mesa-common-dev
4
+ source ${CONDA}/etc/profile.d/conda.sh
5
+ sudo chown -R ${USER} ${CONDA}
6
+ conda config --set always_yes yes --set changeps1 no
7
+ conda update -q conda
8
+ conda info -a
9
+ conda create --name rdkit_build -c conda-forge --override-channels cmake \
10
+ libboost=$(boost_version) \
11
+ libboost-devel=$(boost_version) \
12
+ swig=4.2
13
+ displayName: Setup build environment
14
+ - bash: |
15
+ source ${CONDA}/etc/profile.d/conda.sh
16
+ conda activate rdkit_build
17
+ conda config --env --add channels conda-forge
18
+ conda config --env --set channel_priority strict
19
+ mkdir build && cd build && \
20
+ cmake .. \
21
+ -DSWIG_EXECUTABLE=${CONDA_PREFIX}/bin/swig \
22
+ -DCMAKE_BUILD_TYPE=Release \
23
+ -DRDK_INSTALL_INTREE=ON \
24
+ -DRDK_INSTALL_STATIC_LIBS=ON \
25
+ -DRDK_BUILD_CPP_TESTS=OFF \
26
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF \
27
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
28
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
29
+ -DRDK_OPTIMIZE_POPCNT=ON \
30
+ -DRDK_BUILD_TEST_GZIP=OFF \
31
+ -DRDK_BUILD_FREESASA_SUPPORT=ON \
32
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
33
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
34
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
35
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
36
+ -DRDK_BUILD_SWIG_WRAPPERS=ON \
37
+ -DRDK_SWIG_STATIC=ON \
38
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
39
+ -DRDK_TEST_MULTITHREADED=ON
40
+ displayName: Configure build (Run CMake)
41
+ - bash: |
42
+ source ${CONDA}/etc/profile.d/conda.sh
43
+ conda activate rdkit_build
44
+ cd build
45
+ make -j $( $(number_of_cores) ) install
46
+ displayName: Build
47
+ - bash: |
48
+ source ${CONDA}/etc/profile.d/conda.sh
49
+ conda activate rdkit_build
50
+ export RDBASE=`pwd`
51
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
52
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
53
+ echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
54
+ export QT_QPA_PLATFORM='offscreen'
55
+ cd build
56
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
57
+ displayName: Run tests
58
+ - task: PublishTestResults@2
59
+ inputs:
60
+ testResultsFormat: 'CTest'
61
+ testResultsFiles: 'build/Testing/*/Test.xml'
62
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/linux_build_limitexternal.yml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ sudo apt-get install g++ wget make libgl1-mesa-dev mesa-common-dev
4
+ source ${CONDA}/etc/profile.d/conda.sh
5
+ sudo chown -R ${USER} ${CONDA}
6
+ conda config --set always_yes yes --set changeps1 no
7
+ conda update -q conda
8
+ conda config --set channel_priority strict
9
+ conda config --add channels conda-forge
10
+ conda config --set solver libmamba
11
+ conda info -a
12
+ conda create --name rdkit_build -c conda-forge --override-channels $(python) cmake \
13
+ libboost=$(boost_version) libboost-devel=$(boost_version) \
14
+ libboost-python=$(boost_version) libboost-python-devel=$(boost_version) \
15
+ numpy pillow eigen pandas=2.1 \
16
+ qt pytest
17
+ conda activate rdkit_build
18
+ conda config --env --add channels conda-forge
19
+ conda config --env --set channel_priority strict
20
+ displayName: Setup build environment
21
+ - bash: |
22
+ source ${CONDA}/etc/profile.d/conda.sh
23
+ conda activate rdkit_build
24
+ mkdir build && cd build && \
25
+ cmake .. \
26
+ -DCMAKE_BUILD_TYPE=Release \
27
+ -DRDK_INSTALL_INTREE=ON \
28
+ -DRDK_INSTALL_STATIC_LIBS=OFF \
29
+ -DRDK_BUILD_CPP_TESTS=ON \
30
+ -DRDK_BUILD_PYTHON_WRAPPERS=ON \
31
+ -DRDK_BUILD_CHEMDRAW_SUPPORT=OFF \
32
+ -DRDK_BUILD_COORDGEN_SUPPORT=OFF \
33
+ -DRDK_BUILD_MAEPARSER_SUPPORT=OFF \
34
+ -DRDK_OPTIMIZE_POPCNT=ON \
35
+ -DRDK_BUILD_TEST_GZIP=OFF \
36
+ -DRDK_BUILD_FREESASA_SUPPORT=OFF \
37
+ -DRDK_BUILD_FREETYPE_SUPPORT=OFF \
38
+ -DRDK_BUILD_AVALON_SUPPORT=OFF \
39
+ -DRDK_BUILD_INCHI_SUPPORT=OFF \
40
+ -DRDK_BUILD_CAIRO_SUPPORT=OFF \
41
+ -DRDK_BUILD_QT_SUPPORT=OFF \
42
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
43
+ -DRDK_BUILD_PUBCHEMSHAPE_SUPPORT=OFF \
44
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF \
45
+ -DRDK_SWIG_STATIC=OFF \
46
+ -DRDK_BUILD_THREADSAFE_SSS=OFF \
47
+ -DRDK_TEST_MULTITHREADED=OFF
48
+ displayName: Configure build (Run CMake)
49
+ - bash: |
50
+ source ${CONDA}/etc/profile.d/conda.sh
51
+ conda activate rdkit_build
52
+ cd build
53
+ make -j $( $(number_of_cores) ) install
54
+ displayName: Build
55
+ - bash: |
56
+ source ${CONDA}/etc/profile.d/conda.sh
57
+ conda activate rdkit_build
58
+ export RDBASE=`pwd`
59
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
60
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
61
+ echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
62
+ export QT_QPA_PLATFORM='offscreen'
63
+ cd build
64
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
65
+ displayName: Run tests
66
+ - task: PublishTestResults@2
67
+ inputs:
68
+ testResultsFormat: 'CTest'
69
+ testResultsFiles: 'build/Testing/*/Test.xml'
70
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/linux_build_py312.yml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ sudo apt-get install g++ wget make libgl1-mesa-dev mesa-common-dev
4
+ source ${CONDA}/etc/profile.d/conda.sh
5
+ sudo chown -R ${USER} ${CONDA}
6
+ conda config --set always_yes yes --set changeps1 no
7
+ conda update -q conda
8
+ conda info -a
9
+ conda create --name rdkit_build -c conda-forge --override-channels $(python) cmake \
10
+ libboost-python-devel=$(boost_version) \
11
+ libboost-python=$(boost_version) \
12
+ libboost-devel=$(boost_version) \
13
+ libboost=$(boost_version) \
14
+ numpy=2.4 pillow eigen pandas=3 matplotlib-base=3.8 \
15
+ cairo
16
+ conda activate rdkit_build
17
+ conda config --env --add channels conda-forge
18
+ conda config --env --set channel_priority strict
19
+ conda install -c conda-forge --override-channels ipython=8.20 jupyter nbval ipykernel>=6.0
20
+ displayName: Setup build environment (no Qt due to versioning problems)
21
+ - bash: |
22
+ source ${CONDA}/etc/profile.d/conda.sh
23
+ conda activate rdkit_build
24
+ export CXXFLAGS="${CXXFLAGS} -Wall -Werror -Wextra"
25
+ mkdir build && cd build && \
26
+ cmake .. \
27
+ -DCMAKE_BUILD_TYPE=Release \
28
+ -DRDK_INSTALL_INTREE=ON \
29
+ -DRDK_INSTALL_STATIC_LIBS=OFF \
30
+ -DRDK_BUILD_CPP_TESTS=ON \
31
+ -DRDK_BUILD_PYTHON_WRAPPERS=ON \
32
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
33
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
34
+ -DRDK_OPTIMIZE_POPCNT=ON \
35
+ -DRDK_BUILD_TEST_GZIP=ON \
36
+ -DRDK_BUILD_FREESASA_SUPPORT=ON \
37
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
38
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
39
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
40
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
41
+ -DRDK_BUILD_CAIRO_SUPPORT=ON \
42
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF \
43
+ -DRDK_SWIG_STATIC=OFF \
44
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
45
+ -DRDK_TEST_MULTITHREADED=ON \
46
+ -DRDK_BUILD_CFFI_LIB=ON \
47
+ -DBoost_NO_SYSTEM_PATHS=ON \
48
+ -DBoost_NO_BOOST_CMAKE=TRUE \
49
+ -DRDK_BOOST_PYTHON3_NAME=$(python_name) \
50
+ -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/bin/python3 \
51
+ -DCMAKE_INCLUDE_PATH="${CONDA_PREFIX}/include" \
52
+ -DCMAKE_LIBRARY_PATH="${CONDA_PREFIX}/lib"
53
+ displayName: Configure build (Run CMake)
54
+ - bash: |
55
+ source ${CONDA}/etc/profile.d/conda.sh
56
+ conda activate rdkit_build
57
+ cd build
58
+ make -j $( $(number_of_cores) ) install
59
+ displayName: Build
60
+ - bash: |
61
+ source ${CONDA}/etc/profile.d/conda.sh
62
+ conda activate rdkit_build
63
+ export RDBASE=`pwd`
64
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
65
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
66
+ echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
67
+ export QT_QPA_PLATFORM='offscreen'
68
+ cd build
69
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
70
+ displayName: Run tests
71
+ - bash: |
72
+ source ${CONDA}/etc/profile.d/conda.sh
73
+ conda activate rdkit_build
74
+ conda install -c conda-forge --override-channels numpy=1.24 pandas=2.2
75
+ export RDBASE=`pwd`
76
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
77
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
78
+ echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
79
+ export QT_QPA_PLATFORM='offscreen'
80
+ cd build
81
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
82
+ displayName: Run tests with older numpy and pandas
83
+ - bash: |
84
+ source ${CONDA}/etc/profile.d/conda.sh
85
+ conda activate rdkit_build
86
+ conda install -c conda-forge --override-channels sphinx myst-parser
87
+ export RDBASE=`pwd`
88
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
89
+ export LD_LIBRARY_PATH=${RDBASE}/lib:${LD_LIBRARY_PATH}
90
+ export QT_QPA_PLATFORM='offscreen'
91
+ cd Docs/Book
92
+ make doctest
93
+ displayName: Run documentation tests
94
+ - task: PublishTestResults@2
95
+ inputs:
96
+ testResultsFormat: 'CTest'
97
+ testResultsFiles: 'build/Testing/*/Test.xml'
98
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/mac_build.yml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ export CONDA=/tmp/miniforge
4
+ wget https://github.com/conda-forge/miniforge/releases/download/24.9.0-0/Miniforge3-24.9.0-0-MacOSX-x86_64.sh
5
+ bash Miniforge3-24.9.0-0-MacOSX-x86_64.sh -b -p ${CONDA}
6
+ displayName: install conda
7
+ - script: |
8
+ echo "Removing homebrew from Azure to avoid conflicts."
9
+ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew
10
+ chmod +x ~/uninstall_homebrew
11
+ ~/uninstall_homebrew -fq
12
+ rm ~/uninstall_homebrew
13
+ displayName: Remove homebrew
14
+ - bash: |
15
+ export CONDA=/tmp/miniforge
16
+ source ${CONDA}/etc/profile.d/conda.sh
17
+ sudo chown -R ${USER} ${CONDA}
18
+ mkdir -p $HOME/.matplotlib
19
+ echo -e "backend: TkAgg\n" > $HOME/.matplotlib/matplotlibrc
20
+ conda config --set always_yes yes --set changeps1 no
21
+ conda update -q conda
22
+ conda config --set solver libmamba
23
+ conda config --set channel_priority strict
24
+ conda config --add channels conda-forge
25
+ conda create --name rdkit_build $(python) $(compiler) libcxx cmake \
26
+ libboost=$(boost_version) libboost-devel=$(boost_version) \
27
+ libboost-python=$(boost_version) libboost-python-devel=$(boost_version) \
28
+ qt \
29
+ numpy matplotlib=3.8 cairo pillow eigen pandas=2.1 \
30
+ jupyter=1.0 ipython=8.20 sphinx myst-parser pytest nbval make
31
+ displayName: Setup build environment
32
+ - bash: |
33
+ export CONDA=/tmp/miniforge
34
+ source ${CONDA}/etc/profile.d/conda.sh
35
+ conda activate rdkit_build
36
+ ls -l /Library
37
+ ls -l /Library/Developer
38
+ ls -l /Library/Developer/CommandLineTools
39
+ ls -l /Library/Developer/CommandLineTools/SDKs
40
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
41
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
42
+ export CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Werror"
43
+ mkdir build && cd build && \
44
+ cmake .. \
45
+ -DCMAKE_BUILD_TYPE=Release \
46
+ -DRDK_INSTALL_INTREE=ON \
47
+ -DRDK_INSTALL_STATIC_LIBS=OFF \
48
+ -DRDK_BUILD_CPP_TESTS=ON \
49
+ -DRDK_BUILD_PYTHON_WRAPPERS=ON \
50
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
51
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
52
+ -DRDK_OPTIMIZE_POPCNT=ON \
53
+ -DRDK_BUILD_TEST_GZIP=ON \
54
+ -DRDK_BUILD_FREESASA_SUPPORT=ON \
55
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
56
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
57
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
58
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
59
+ -DRDK_BUILD_CAIRO_SUPPORT=ON \
60
+ -DRDK_BUILD_QT_SUPPORT=ON \
61
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF \
62
+ -DRDK_SWIG_STATIC=OFF \
63
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
64
+ -DRDK_TEST_MULTITHREADED=ON \
65
+ -DRDK_BUILD_CFFI_LIB=ON \
66
+ -DCMAKE_OSX_SYSROOT=${SDKROOT} \
67
+ -DCMAKE_OSX_DEPLOYMENT_TARGET=$(target_platform)
68
+ displayName: Configure build (Run CMake)
69
+ - bash: |
70
+ export CONDA=/tmp/miniforge
71
+ source ${CONDA}/etc/profile.d/conda.sh
72
+ conda activate rdkit_build
73
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
74
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
75
+ cd build
76
+ make -j $( $(number_of_cores) ) install
77
+ displayName: Build
78
+ - bash: |
79
+ export CONDA=/tmp/miniforge
80
+ source ${CONDA}/etc/profile.d/conda.sh
81
+ conda activate rdkit_build
82
+ export RDBASE=`pwd`
83
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
84
+ export DYLD_FALLBACK_LIBRARY_PATH=${RDBASE}/lib:${RDBASE}/rdkit:${CONDA_PREFIX}/lib:${DYLD_FALLBACK_LIBRARY_PATH}
85
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
86
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
87
+ export QT_QPA_PLATFORM='offscreen'
88
+ cd build
89
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
90
+ displayName: Run tests
91
+ - task: PublishTestResults@2
92
+ inputs:
93
+ testResultsFormat: 'CTest'
94
+ testResultsFiles: 'build/Testing/*/Test.xml'
95
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/mac_build_java.yml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - bash: |
3
+ export CONDA=/tmp/miniforge
4
+ wget https://github.com/conda-forge/miniforge/releases/download/24.9.0-0/Miniforge3-24.9.0-0-MacOSX-x86_64.sh
5
+ bash Miniforge3-24.9.0-0-MacOSX-x86_64.sh -b -p ${CONDA}
6
+ displayName: install conda
7
+ - script: |
8
+ echo "Removing homebrew from Azure to avoid conflicts."
9
+ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew
10
+ chmod +x ~/uninstall_homebrew
11
+ ~/uninstall_homebrew -fq
12
+ rm ~/uninstall_homebrew
13
+ displayName: Remove homebrew
14
+ - bash: |
15
+ export CONDA=/tmp/miniforge
16
+ source ${CONDA}/etc/profile.d/conda.sh
17
+ sudo chown -R ${USER} ${CONDA}
18
+ mkdir -p $HOME/.matplotlib
19
+ echo -e "backend: TkAgg\n" > $HOME/.matplotlib/matplotlibrc
20
+ conda config --set always_yes yes --set changeps1 no
21
+ conda update -q conda
22
+ conda create --name rdkit_build -c conda-forge --override-channels $(compiler) \
23
+ libcxx=$(compiler_version) cmake=3.26 \
24
+ libboost=$(boost_version) \
25
+ libboost-devel=$(boost_version) \
26
+ cairo eigen swig=4.2 make
27
+ conda activate rdkit_build
28
+ conda config --env --add channels conda-forge
29
+ conda config --env --set channel_priority strict
30
+ displayName: Setup build environment
31
+ - bash: |
32
+ export CONDA=/tmp/miniforge
33
+ source ${CONDA}/etc/profile.d/conda.sh
34
+ conda activate rdkit_build
35
+ ls -l /Library
36
+ ls -l /Library/Developer
37
+ ls -l /Library/Developer/CommandLineTools
38
+ ls -l /Library/Developer/CommandLineTools/SDKs
39
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
40
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
41
+ mkdir build && cd build && \
42
+ cmake .. \
43
+ -DCMAKE_BUILD_TYPE=Release \
44
+ -DRDK_INSTALL_INTREE=ON \
45
+ -DRDK_INSTALL_STATIC_LIBS=ON \
46
+ -DRDK_BUILD_CPP_TESTS=OFF \
47
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF \
48
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON \
49
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
50
+ -DRDK_OPTIMIZE_POPCNT=ON \
51
+ -DRDK_BUILD_TEST_GZIP=OFF \
52
+ -DRDK_BUILD_FREESASA_SUPPORT=ON \
53
+ -DRDK_BUILD_AVALON_SUPPORT=ON \
54
+ -DRDK_BUILD_INCHI_SUPPORT=ON \
55
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
56
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
57
+ -DRDK_BUILD_SWIG_WRAPPERS=ON \
58
+ -DRDK_SWIG_STATIC=ON \
59
+ -DRDK_BUILD_THREADSAFE_SSS=ON \
60
+ -DRDK_TEST_MULTITHREADED=ON
61
+ displayName: Configure build (Run CMake)
62
+ - bash: |
63
+ export CONDA=/tmp/miniforge
64
+ source ${CONDA}/etc/profile.d/conda.sh
65
+ conda activate rdkit_build
66
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
67
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
68
+ cd build
69
+ make -j $( $(number_of_cores) ) install
70
+ displayName: Build
71
+ - bash: |
72
+ export CONDA=/tmp/miniforge
73
+ source ${CONDA}/etc/profile.d/conda.sh
74
+ conda activate rdkit_build
75
+ export RDBASE=`pwd`
76
+ export PYTHONPATH=${RDBASE}:${PYTHONPATH}
77
+ export DYLD_FALLBACK_LIBRARY_PATH=${RDBASE}/lib:${RDBASE}/rdkit:${CONDA_PREFIX}/lib:${DYLD_FALLBACK_LIBRARY_PATH}
78
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX$(target_platform).sdk
79
+ export CONDA_BUILD_SYSROOT=${SDKROOT}
80
+ export QT_QPA_PLATFORM='offscreen'
81
+ cd build
82
+ ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
83
+ displayName: Run tests
84
+ - task: PublishTestResults@2
85
+ inputs:
86
+ testResultsFormat: 'CTest'
87
+ testResultsFiles: 'build/Testing/*/Test.xml'
88
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/vs_build.yml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
3
+ displayName: Setup build environment
4
+ - script: |
5
+ conda config --set always_yes yes --set changeps1 no
6
+ conda info -a
7
+ conda install -n base conda-libmamba-solver
8
+ conda config --set solver libmamba
9
+ conda create --name rdkit_build -c conda-forge --override-channels $(python) ^
10
+ libboost-python=(boost_version) ^
11
+ libboost-python-devel=(boost_version) ^
12
+ libboost=$(boost_version) ^
13
+ libboost-devel=$(boost_version) ^
14
+ numpy matplotlib cairo pillow eigen ^
15
+ numpy=2.4 pandas=3 ^
16
+ sphinx myst-parser ipython jupyter pytest nbval cmake
17
+ call activate rdkit_build
18
+ conda config --env --add channels conda-forge
19
+ conda config --env --set channel_priority strict
20
+ displayName: Install dependencies
21
+ - script: |
22
+ set Boost_ROOT=
23
+ mkdir build && cd build
24
+ call activate rdkit_build
25
+ cmake .. ^
26
+ -G "Visual Studio 17 2022" ^
27
+ -DCMAKE_BUILD_TYPE=Release ^
28
+ -DRDK_INSTALL_INTREE=ON ^
29
+ -DRDK_INSTALL_STATIC_LIBS=OFF ^
30
+ -DRDK_BUILD_CPP_TESTS=ON ^
31
+ -DRDK_BUILD_PYTHON_WRAPPERS=ON ^
32
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON ^
33
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON ^
34
+ -DRDK_OPTIMIZE_POPCNT=ON ^
35
+ -DRDK_BUILD_TEST_GZIP=ON ^
36
+ -DRDK_BUILD_FREESASA_SUPPORT=ON ^
37
+ -DRDK_BUILD_AVALON_SUPPORT=ON ^
38
+ -DRDK_BUILD_INCHI_SUPPORT=ON ^
39
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON ^
40
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON ^
41
+ -DRDK_BUILD_CAIRO_SUPPORT=ON ^
42
+ -DRDK_BUILD_THREADSAFE_SSS=ON ^
43
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF ^
44
+ -DRDK_BUILD_CFFI_LIB=ON ^
45
+ -DRDK_SWIG_STATIC=OFF ^
46
+ -DRDK_TEST_MULTITHREADED=ON ^
47
+ -DCMAKE_INCLUDE_PATH=%CONDA_PREFIX%/Library/include ^
48
+ -DCMAKE_LIBRARY_PATH="%CONDA_PREFIX%/Library/lib
49
+ displayName: Configure build (Run CMake)
50
+ - script: |
51
+ call activate rdkit_build
52
+ cd build
53
+ cmake --build . --config Release --target install -j $(number_of_cores)
54
+ displayName: Build
55
+ - script: |
56
+ call activate rdkit_build
57
+ set RDBASE=%cd%
58
+ set PYTHONPATH=%RDBASE%;%PYTHONPATH%
59
+ set PATH=%RDBASE%\lib;%PATH%
60
+ cd build
61
+ ctest -C Release -j $(number_of_cores) --output-on-failure -T Test
62
+ displayName: Run tests
63
+ - script: |
64
+ call activate rdkit_build
65
+ conda install -c conda-forge --override-channels numpy=1.26 pandas=2.2
66
+ set RDBASE=%cd%
67
+ set PYTHONPATH=%RDBASE%;%PYTHONPATH%
68
+ set PATH=%RDBASE%\lib;%PATH%
69
+ cd build
70
+ ctest -C Release -j $(number_of_cores) --output-on-failure -T Test
71
+ displayName: Run with older numpy and pandas
72
+ - script: |
73
+ call activate rdkit_build
74
+ conda install -c conda-forge --override-channels sphinx myst-parser
75
+ set RDBASE=%cd%
76
+ set PYTHONPATH=%RDBASE%;%PYTHONPATH%
77
+ set PATH=%RDBASE%\lib;%PATH%
78
+ cd Docs/Book
79
+ make doctest
80
+ displayName: Run documentation tests
81
+ - task: PublishTestResults@2
82
+ inputs:
83
+ testResultsFormat: 'CTest'
84
+ testResultsFiles: 'build/Testing/*/Test.xml'
85
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/vs_build_dll.yml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
3
+ displayName: Setup build environment
4
+ - script: |
5
+ conda config --set always_yes yes --set changeps1 no
6
+ conda info -a
7
+ conda install -n base conda-libmamba-solver
8
+ conda config --set solver libmamba
9
+ conda create --name rdkit_build -c conda-forge --override-channels $(python) ^
10
+ boost=$(boost_version) boost-cpp=$(boost_version) ^
11
+ libboost-python-devel=(boost_version) ^
12
+ libboost=$(boost_version) ^
13
+ libboost-devel=$(boost_version) ^
14
+ numpy matplotlib cairo pillow eigen pandas=2.1
15
+ call activate rdkit_build
16
+ conda config --env --add channels conda-forge
17
+ conda config --env --set channel_priority strict
18
+ conda install -c conda-forge --override-channels cmake ipython pytest nbval
19
+ displayName: Install dependencies
20
+ - script: |
21
+ set Boost_ROOT=
22
+ mkdir build && cd build
23
+ call activate rdkit_build
24
+ cmake .. ^
25
+ -G "Visual Studio 17 2022" ^
26
+ -DCMAKE_BUILD_TYPE=Release ^
27
+ -DRDK_INSTALL_INTREE=ON ^
28
+ -DRDK_INSTALL_STATIC_LIBS=OFF ^
29
+ -DRDK_INSTALL_DLLS_MSVC=ON ^
30
+ -DRDK_BUILD_CPP_TESTS=ON ^
31
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF ^
32
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON ^
33
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON ^
34
+ -DRDK_OPTIMIZE_POPCNT=ON ^
35
+ -DRDK_BUILD_TEST_GZIP=ON ^
36
+ -DRDK_BUILD_FREESASA_SUPPORT=ON ^
37
+ -DRDK_BUILD_AVALON_SUPPORT=ON ^
38
+ -DRDK_BUILD_INCHI_SUPPORT=ON ^
39
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON ^
40
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON ^
41
+ -DRDK_BUILD_CAIRO_SUPPORT=ON ^
42
+ -DRDK_BUILD_THREADSAFE_SSS=ON ^
43
+ -DRDK_BUILD_SWIG_WRAPPERS=OFF ^
44
+ -DRDK_SWIG_STATIC=OFF ^
45
+ -DRDK_TEST_MULTITHREADED=ON ^
46
+ -DCMAKE_INCLUDE_PATH=%CONDA_PREFIX%/Library/include ^
47
+ -DCMAKE_LIBRARY_PATH="%CONDA_PREFIX%/Library/lib
48
+ displayName: Configure build (Run CMake)
49
+ - script: |
50
+ call activate rdkit_build
51
+ cd build
52
+ cmake --build . --config Release --target install -j $(number_of_cores)
53
+ displayName: Build
54
+ - script: |
55
+ call activate rdkit_build
56
+ set RDBASE=%cd%
57
+ set PATH=%RDBASE%\lib;%PATH%
58
+ cd build
59
+ ctest -C Release -j $(number_of_cores) --output-on-failure -T Test
60
+ displayName: Run tests
61
+ - task: PublishTestResults@2
62
+ inputs:
63
+ testResultsFormat: 'CTest'
64
+ testResultsFiles: 'build/Testing/*/Test.xml'
65
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.azure-pipelines/vs_build_swig.yml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - task: UseDotNet@2
3
+ displayName: 'Install .NET Core 8 SDK'
4
+ inputs:
5
+ version: 8.x
6
+ performMultiLevelLookup: true
7
+ - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
8
+ displayName: Setup build environment
9
+ - script: |
10
+ conda config --set always_yes yes --set changeps1 no
11
+ conda info -a
12
+ conda install -n base conda-libmamba-solver
13
+ conda config --set solver libmamba
14
+ conda create --name rdkit_build -c conda-forge --override-channels ^
15
+ cmake=3.26 ^
16
+ libboost=$(boost_version) ^
17
+ libboost-devel=$(boost_version) ^
18
+ cairo eigen swig=4.2
19
+ call activate rdkit_build
20
+ conda config --env --add channels conda-forge
21
+ conda config --env --set channel_priority strict
22
+ displayName: Install dependencies
23
+ - script: |
24
+ set Boost_ROOT=
25
+ mkdir build && cd build
26
+ call activate rdkit_build
27
+ cmake .. ^
28
+ -G "Visual Studio 17 2022" ^
29
+ -DCMAKE_BUILD_TYPE=Release ^
30
+ -DRDK_INSTALL_INTREE=ON ^
31
+ -DRDK_INSTALL_STATIC_LIBS=OFF ^
32
+ -DRDK_BUILD_CPP_TESTS=OFF ^
33
+ -DRDK_BUILD_PYTHON_WRAPPERS=OFF ^
34
+ -DRDK_BUILD_COORDGEN_SUPPORT=ON ^
35
+ -DRDK_BUILD_MAEPARSER_SUPPORT=ON ^
36
+ -DRDK_OPTIMIZE_POPCNT=ON ^
37
+ -DRDK_BUILD_TEST_GZIP=OFF ^
38
+ -DRDK_BUILD_FREESASA_SUPPORT=OFF ^
39
+ -DRDK_BUILD_AVALON_SUPPORT=ON ^
40
+ -DRDK_BUILD_INCHI_SUPPORT=ON ^
41
+ -DRDK_BUILD_YAEHMOP_SUPPORT=ON ^
42
+ -DRDK_BUILD_XYZ2MOL_SUPPORT=ON ^
43
+ -DRDK_BUILD_CAIRO_SUPPORT=ON ^
44
+ -DRDK_BUILD_THREADSAFE_SSS=ON ^
45
+ -DRDK_BUILD_SWIG_WRAPPERS=ON ^
46
+ -DRDK_BUILD_SWIG_JAVA_WRAPPER=OFF ^
47
+ -DRDK_BUILD_SWIG_CSHARP_WRAPPER=ON ^
48
+ -DRDK_BUILD_CFFI_LIB=OFF ^
49
+ -DRDK_SWIG_STATIC=ON ^
50
+ -DRDK_TEST_MULTITHREADED=ON
51
+ displayName: Configure build (Run CMake)
52
+ - script: |
53
+ call activate rdkit_build
54
+ cd build
55
+ cmake --build . --config Release --target install -j $(number_of_cores)
56
+ displayName: Build
57
+ - script: |
58
+ call activate rdkit_build
59
+ set RDBASE=%cd%
60
+ set PYTHONPATH=%RDBASE%;%PYTHONPATH%
61
+ set PATH=%RDBASE%\lib;%PATH%
62
+ cd build
63
+ ctest -R CSharpTests -C Release -T test --output-on-failure --verbose
64
+ displayName: Run tests
65
+ - task: PublishTestResults@2
66
+ inputs:
67
+ testResultsFormat: 'CTest'
68
+ testResultsFiles: 'build/Testing/*/Test.xml'
69
+ testRunTitle: $(system.phasedisplayname) CTest Test Run
rdkit/source/.clang-format ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ Language: Cpp
3
+ # BasedOnStyle: Google
4
+ AccessModifierOffset: -1
5
+ AlignAfterOpenBracket: true
6
+ AlignEscapedNewlinesLeft: true
7
+ AlignOperands: true
8
+ AlignTrailingComments: true
9
+ AllowAllParametersOfDeclarationOnNextLine: true
10
+ AllowShortBlocksOnASingleLine: false
11
+ AllowShortCaseLabelsOnASingleLine: false
12
+ AllowShortIfStatementsOnASingleLine: true
13
+ AllowShortLoopsOnASingleLine: true
14
+ AllowShortFunctionsOnASingleLine: All
15
+ AllowShortEnumsOnASingleLine: false
16
+ AlwaysBreakAfterDefinitionReturnType: false
17
+ AlwaysBreakTemplateDeclarations: true
18
+ AlwaysBreakBeforeMultilineStrings: true
19
+ BreakBeforeBinaryOperators: None
20
+ BreakBeforeTernaryOperators: true
21
+ BreakConstructorInitializersBeforeComma: false
22
+ BinPackParameters: true
23
+ BinPackArguments: true
24
+ ColumnLimit: 80
25
+ ConstructorInitializerAllOnOneLineOrOnePerLine: true
26
+ ConstructorInitializerIndentWidth: 4
27
+ DerivePointerAlignment: false
28
+ ExperimentalAutoDetectBinPacking: false
29
+ IndentCaseLabels: true
30
+ IndentWrappedFunctionNames: false
31
+ IndentFunctionDeclarationAfterType: false
32
+ MaxEmptyLinesToKeep: 1
33
+ KeepEmptyLinesAtTheStartOfBlocks: false
34
+ NamespaceIndentation: None
35
+ ObjCBlockIndentWidth: 2
36
+ ObjCSpaceAfterProperty: false
37
+ ObjCSpaceBeforeProtocolList: false
38
+ PenaltyBreakBeforeFirstCallParameter: 1
39
+ PenaltyBreakComment: 300
40
+ PenaltyBreakString: 1000
41
+ PenaltyBreakFirstLessLess: 120
42
+ PenaltyExcessCharacter: 1000000
43
+ PenaltyReturnTypeOnItsOwnLine: 200
44
+ PointerAlignment: Right
45
+ SpacesBeforeTrailingComments: 2
46
+ Cpp11BracedListStyle: true
47
+ Standard: Cpp11
48
+ IndentWidth: 2
49
+ TabWidth: 8
50
+ UseTab: Never
51
+ BreakStringLiterals: false
52
+ BreakBeforeBraces: Attach
53
+ SpacesInParentheses: false
54
+ SpacesInSquareBrackets: false
55
+ SpacesInAngles: false
56
+ SpaceInEmptyParentheses: false
57
+ SpacesInCStyleCastParentheses: false
58
+ SpaceAfterCStyleCast: false
59
+ SpacesInContainerLiterals: true
60
+ SpaceBeforeAssignmentOperators: true
61
+ ContinuationIndentWidth: 4
62
+ CommentPragmas: '^ IWYU pragma:'
63
+ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
64
+ SpaceBeforeParens: ControlStatements
65
+ SortIncludes: false
66
+ DisableFormat: false
67
+ ...
rdkit/source/.clang-tidy ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ Checks: '-*,boost-use-to-string,modernize-use-auto,modernize-use-nullptr,modernize-loop-convert,modernize-use-override,modernize-pass-by-value,modernize-shrink-to-fit,readability-braces-around-statements,readability-simplify-boolean-expr'
3
+ HeaderFilterRegex: 'Code/'
4
+ User: glandrum
5
+ CheckOptions:
6
+ - key: modernize-loop-convert.MaxCopySize
7
+ value: '16'
8
+ - key: modernize-loop-convert.MinConfidence
9
+ value: reasonable
10
+ - key: modernize-loop-convert.NamingStyle
11
+ value: CamelCase
12
+ - key: modernize-pass-by-value.IncludeStyle
13
+ value: llvm
14
+ - key: modernize-replace-auto-ptr.IncludeStyle
15
+ value: llvm
16
+ - key: modernize-use-nullptr.NullMacros
17
+ value: 'NULL'
18
+ ...
rdkit/source/.travis.yml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # adapted from http://conda.pydata.org/docs/travis.html
2
+ language: generic
3
+
4
+ # build matrices
5
+ matrix:
6
+ include:
7
+ - os: linux
8
+ dist: xenial
9
+ env: CONDA_PYTHON_VERSION=3.6
10
+ - os: osx
11
+ osx_image: xcode8.3
12
+ env: CONDA_PYTHON_VERSION=3.6
13
+
14
+ addons:
15
+ apt:
16
+ packages:
17
+ - swig
18
+
19
+ before_install:
20
+ # download and install miniconda
21
+ - echo "*************************************************"
22
+ - echo "Building for $TRAVIS_OS_NAME"
23
+ - echo " for Python $CONDA_PYTHON_VERSION"
24
+ - export PYMAJOR="3";
25
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget http://repo.continuum.io/miniconda/Miniconda$PYMAJOR-4.5.11-Linux-x86_64.sh -O miniconda.sh; fi
26
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget http://repo.continuum.io/miniconda/Miniconda$PYMAJOR-4.5.11-MacOSX-x86_64.sh -O miniconda.sh; fi
27
+ - bash miniconda.sh -b -p $HOME/conda
28
+ - export PATH="$HOME/conda/bin:$PATH"
29
+ - hash -r
30
+ - conda config --set always_yes yes --set changeps1 no
31
+ - conda update -q conda
32
+ # Useful for debugging any issues with conda
33
+ - conda info -a
34
+
35
+ install:
36
+ - echo "INSTALL CONDA"
37
+ # (don't install conda compiler tools on linux -- this is gcc 4.8 right now)
38
+ #- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then conda install gcc_linux-64 gcc_linux-64 ; fi
39
+ #- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then conda install -q -c rdkit boost=1.63; fi
40
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then conda install -q py-boost=1.67.0 libboost=1.67.0 ; fi
41
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then conda install -q py-boost=1.65.1 libboost=1.65.1 ; fi
42
+ - conda install -q numpy pillow pandas cmake eigen # matplotlib
43
+
44
+ before_script:
45
+ # RDKit
46
+ - echo "BEFORE SCRIPT"
47
+ - export RDBASE=`pwd`
48
+ - echo $RDBASE
49
+ - export PYTHONPATH=${RDBASE}
50
+ - export LD_LIBRARY_PATH=${RDBASE}/lib
51
+ - export DYLD_FALLBACK_LIBRARY_PATH=${RDBASE}/lib
52
+
53
+ - export PYTHON=`which python`
54
+ - echo $PYTHON
55
+ - export PY_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)"`
56
+ - echo $PY_PREFIX
57
+ - export PY_SP_DIR=$PY_PREFIX/lib/python$CONDA_PYTHON_VERSION/site-packages
58
+ - echo $PY_SP_DIR
59
+
60
+ script:
61
+ - echo "SCRIPT"
62
+ - cd $RDBASE
63
+ - mkdir build
64
+ - cd build
65
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX="g++" ; fi
66
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CC="gcc" ; fi
67
+ - cmake $REGEX_EXTRA -D PYTHON_EXECUTABLE=$PYTHON -D BOOST_ROOT=$PY_PREFIX -D Boost_NO_SYSTEM_PATHS=ON -D RDK_BUILD_AVALON_SUPPORT=ON -D RDK_BUILD_INCHI_SUPPORT=ON -DRDK_BUILD_THREADSAFE_SSS=on -DRDK_TEST_MULTITHREADED=on -DRDK_INSTALL_STATIC_LIBS=OFF -DRDK_BUILD_SWIG_WRAPPERS=OFF -DRDK_SWIG_STATIC=OFF -DRDK_BUILD_PYTHON_WRAPPERS=ON -DRDK_BUILD_FREESASA_SUPPORT=ON ..
68
+ - make -j2 install
69
+ - ls "$PY_PREFIX/lib"
70
+ - LD_LIBRARY_PATH="$PY_PREFIX/lib:$PREFIX/lib;$SRC_DIR/lib;$LD_LIBRARY_PATH" ctest -j2 --output-on-failure
rdkit/source/CMakeLists.txt ADDED
@@ -0,0 +1,713 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cmake_minimum_required(VERSION 3.18)
2
+
3
+ project (RDKit)
4
+
5
+ IF(NOT CMAKE_BUILD_TYPE)
6
+ SET(CMAKE_BUILD_TYPE Release CACHE STRING
7
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
8
+ FORCE)
9
+ ENDIF(NOT CMAKE_BUILD_TYPE)
10
+
11
+ # Enable CTest
12
+ include(CTest)
13
+
14
+ set(CMAKE_CXX_STANDARD 20)
15
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
16
+ set(CMAKE_C_STANDARD 99)
17
+ set(CMAKE_C_STANDARD_REQUIRED ON)
18
+
19
+ set(CMAKE_MODULE_PATH
20
+ ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/Code/cmake/Modules/")
21
+
22
+ add_library(rdkit_base INTERFACE)
23
+
24
+ option(RDK_BUILD_SWIG_WRAPPERS "build the SWIG wrappers" OFF )
25
+ option(RDK_BUILD_PYTHON_WRAPPERS "build the standard python wrappers" ON )
26
+ option(RDK_BUILD_COMPRESSED_SUPPLIERS "build in support for compressed MolSuppliers" OFF )
27
+ option(RDK_BUILD_INCHI_SUPPORT "build the rdkit inchi wrapper" OFF )
28
+ option(RDK_BUILD_AVALON_SUPPORT "install support for the avalon toolkit. Use the variable AVALONTOOLS_DIR to set the location of the source." OFF )
29
+ option(RDK_BUILD_PGSQL "build the PostgreSQL cartridge" OFF )
30
+ option(RDK_BUILD_RPATH_SUPPORT "build shared libraries using rpath" OFF)
31
+ option(RDK_PGSQL_STATIC "statically link rdkit libraries into the PostgreSQL cartridge" ON )
32
+ option(RDK_PGSQL_BFP_GIST_SORTSUPPORT "enable the sortsupport method in the PostgreSQL bfp gist index" OFF )
33
+ option(RDK_PGSQL_MOL_GIST_SORTSUPPORT "enable the sortsupport method in the PostgreSQL mol gist index" ON )
34
+ option(RDK_PGSQL_QMOL_GIST_SORTSUPPORT "enable the sortsupport method in the PostgreSQL qmol gist index" ON )
35
+ option(RDK_BUILD_CONTRIB "build the Contrib directory" OFF )
36
+ option(RDK_INSTALL_INTREE "install the rdkit in the source tree (former behavior)" ON )
37
+ option(RDK_INSTALL_DLLS_MSVC "install the rdkit DLLs when using MSVC" OFF)
38
+ option(RDK_INSTALL_STATIC_LIBS "install the rdkit static libraries" ON )
39
+ option(RDK_INSTALL_PYTHON_TESTS "install the rdkit Python tests with the wrappers" OFF )
40
+ option(RDK_BUILD_THREADSAFE_SSS "enable thread-safe substructure searching" ON )
41
+ option(RDK_BUILD_SLN_SUPPORT "include support for the SLN format" ON )
42
+ option(RDK_TEST_MULTITHREADED "run some tests of multithreading" ON )
43
+ option(RDK_BUILD_SWIG_JAVA_WRAPPER "build the SWIG JAVA wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" ON )
44
+ option(RDK_BUILD_SWIG_CSHARP_WRAPPER "build the experimental SWIG C# wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" OFF )
45
+ option(RDK_BUILD_DOTNET_CSHARP_TESTS "build the DotNet Core tests for C# wrappers on Linux (does nothing if RDK_BUILD_SWIG_CSHARP_WRAPPER is not set and is ignored on Windows)" OFF )
46
+ option(RDK_SWIG_STATIC "statically link rdkit libraries into the SWIG wrappers" ON )
47
+ option(RDK_TEST_MMFF_COMPLIANCE "run MMFF compliance tests (requires tar/gzip)" ON )
48
+ option(RDK_BUILD_CPP_TESTS "build the c++ tests (disabing can speed up builds" ON)
49
+ option(RDK_USE_FLEXBISON "use flex/bison, if available, to build the SMILES/SMARTS/SLN parsers" OFF)
50
+ option(RDK_TEST_COVERAGE "Use G(L)COV to compute test coverage" OFF)
51
+ option(RDK_USE_BOOST_SERIALIZATION "Use the boost serialization library if available" ON)
52
+ option(RDK_USE_BOOST_STACKTRACE "use boost::stacktrace to do more verbose invariant output (linux only)" ON)
53
+ option(RDK_BUILD_TEST_GZIP "Build the gzip'd stream test" OFF)
54
+ option(RDK_OPTIMIZE_POPCNT "Use SSE4.2 popcount instruction while compiling." ON)
55
+ option(RDK_USE_STRICT_ROTOR_DEFINITION "Use the most strict rotatable bond definition" ON)
56
+ option(RDK_BUILD_DESCRIPTORS3D "Build the 3D descriptors calculators, requires Eigen3 to be installed" ON)
57
+ option(RDK_BUILD_CHEMDRAW_SUPPORT "build support for the Revvity ChemDraw document format" ON )
58
+ option(RDK_BUILD_FREESASA_SUPPORT "build the rdkit freesasa wrapper" OFF )
59
+ option(RDK_BUILD_COORDGEN_SUPPORT "build the rdkit coordgen wrapper" ON )
60
+ option(RDK_BUILD_MAEPARSER_SUPPORT "build the rdkit MAE parser wrapper" ON )
61
+ option(RDK_BUILD_MOLINTERCHANGE_SUPPORT "build in support for CommonChem molecule interchange" ON )
62
+ option(RDK_BUILD_YAEHMOP_SUPPORT "build support for the YAeHMOP wrapper" OFF)
63
+ option(RDK_BUILD_XYZ2MOL_SUPPORT "build in support for the RDKit's implementation of xyz2mol (in the DetermineBonds library)" OFF )
64
+ option(RDK_BUILD_STRUCTCHECKER_SUPPORT "build in support for the StructChecker alpha (not recommended, use the MolVS integration instead)" OFF )
65
+ option(RDK_BUILD_PUBCHEMSHAPE_SUPPORT "build the rdkit wrapper around pubchem-align3d" ON )
66
+ option(RDK_USE_URF "Build support for Florian Flachsenberg's URF library" ON)
67
+ option(RDK_INSTALL_DEV_COMPONENT "install libraries and headers" ON)
68
+ option(RDK_USE_BOOST_IOSTREAMS "use boost::iostreams" ON)
69
+ option(RDK_BUILD_MINIMAL_LIB "build the minimal RDKit wrapper (for the JS bindings)" OFF)
70
+ option(RDK_MINIMAL_LIB_SUPPORT_LEGACY_BROWSERS "build the minimal RDKit JS wrapper such that it supports legacy browsers" OFF)
71
+ option(RDK_BUILD_CFFI_LIB "build the CFFI wrapper (for use in other programming languges)" OFF)
72
+ option(RDK_CFFI_STATIC "statically link rdkit libraries into the cffi wrapper" ON)
73
+ option(RDK_BUILD_FUZZ_TARGETS "build the fuzz targets" OFF)
74
+ option(RDK_BUILD_MINIMAL_LIB_RXN "build support for reactions into MinimalLib" ON )
75
+ option(RDK_BUILD_MINIMAL_LIB_SUBSTRUCTLIBRARY "build support for SubstructLibrary into MinimalLib" ON )
76
+ option(RDK_BUILD_MINIMAL_LIB_MCS "build support for MCS into MinimalLib" OFF )
77
+ option(RDK_BUILD_MINIMAL_LIB_MOLZIP "build support for molzip into MinimalLib" OFF )
78
+ option(RDK_BUILD_MINIMAL_LIB_MMPA "build support for MMPA into MinimalLib" OFF )
79
+ option(RDK_BUILD_LONG_RUNNING_TESTS "build longer running tests" OFF )
80
+
81
+ set(RDK_BOOST_VERSION "1.81.0")
82
+
83
+ if(NOT MSVC AND RDK_OPTIMIZE_POPCNT)
84
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64|powerpc64)")
85
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcntd")
86
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|i*86)")
87
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
88
+ else()
89
+ message(STATUS "POPCNT hardware flag not supported or not required for ${CMAKE_SYSTEM_PROCESSOR} architecture")
90
+ endif()
91
+ endif()
92
+
93
+ # Detect clang, which masquerades as gcc. CMake 2.6 doesn't know how to
94
+ # detect it.
95
+ string(REGEX MATCH "clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER}")
96
+ # Detect emcc
97
+ string(REGEX MATCH "Emscripten" CMAKE_COMPILER_IS_EMCC "${CMAKE_SYSTEM_NAME}")
98
+
99
+ if(NOT UNIX OR APPLE OR CYGWIN OR CMAKE_COMPILER_IS_EMCC)
100
+ if(RDK_USE_BOOST_STACKTRACE)
101
+ MESSAGE("Disabling boost::stacktrace on non-linux and emscripten platforms")
102
+ set(RDK_USE_BOOST_STACKTRACE OFF)
103
+ endif(RDK_USE_BOOST_STACKTRACE)
104
+ endif()
105
+
106
+ if(NOT RDK_BUILD_SWIG_WRAPPERS)
107
+ set(RDK_BUILD_SWIG_JAVA_WRAPPER OFF)
108
+ set(RDK_BUILD_SWIG_CSHARP_WRAPPER OFF)
109
+ endif()
110
+
111
+ if(RDK_SWIG_STATIC AND RDK_BUILD_SWIG_WRAPPERS)
112
+ if(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
113
+ message("Enabling RDK_INSTALL_STATIC_LIBS because RDK_SWIG_STATIC is set.")
114
+ set(RDK_INSTALL_STATIC_LIBS ON CACHE BOOL "install the rdkit static libraries" FORCE)
115
+ endif(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
116
+ endif()
117
+ if ((MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) OR (WIN32 AND RDK_INSTALL_STATIC_LIBS) OR RDK_BUILD_MINIMAL_LIB)
118
+ set(RDK_BUILD_STATIC_LIBS_ONLY ON)
119
+ else()
120
+ set(RDK_BUILD_STATIC_LIBS_ONLY OFF)
121
+ endif()
122
+ if(NOT RDK_BUILD_STATIC_LIBS_ONLY)
123
+ add_definitions(-DRDKIT_DYN_LINK)
124
+ endif()
125
+
126
+ if(RDK_PGSQL_STATIC AND RDK_BUILD_PGSQL)
127
+ if(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
128
+ message("Enabling RDK_INSTALL_STATIC_LIBS because RDK_PGSQL_STATIC is set.")
129
+ set(RDK_INSTALL_STATIC_LIBS ON CACHE BOOL "install the rdkit static libraries" FORCE)
130
+ endif(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
131
+ endif()
132
+
133
+ if(RDK_CFFI_STATIC AND RDK_BUILD_CFFI_LIB)
134
+ if(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
135
+ message("Enabling RDK_INSTALL_STATIC_LIBS because RDK_CFFI_STATIC is set.")
136
+ set(RDK_INSTALL_STATIC_LIBS ON CACHE BOOL "install the rdkit static libraries" FORCE)
137
+ endif(NOT MSVC AND NOT RDK_INSTALL_STATIC_LIBS)
138
+ endif()
139
+
140
+
141
+ include(TestBigEndian)
142
+ TEST_BIG_ENDIAN(RDK_BIG_ENDIAN)
143
+
144
+ # At build time put runtime binaries in the bin subdirectory
145
+ set(RDK_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
146
+ set(RDK_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
147
+ set(RDK_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
148
+ # Also place the python extension where the source tree would expect them
149
+ set(RDK_PYTHON_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rdkit")
150
+
151
+ #-------
152
+ # Config variables:
153
+ set(RDKit_Year "2026")
154
+ set(RDKit_Month "03")
155
+ set(RDKit_Revision "1")
156
+ set(RDKit_RevisionModifier "pre")
157
+ set(RDKit_ABI "1")
158
+
159
+ # we need an integer version of the month later, so remove the zero padding
160
+ # if there is any
161
+ string(REGEX REPLACE "^0" "" RDKit_intMonth ${RDKit_Month} )
162
+
163
+ set(RDKit_CodeDir "${CMAKE_CURRENT_SOURCE_DIR}/Code")
164
+ set(RDKit_ExternalDir "${CMAKE_CURRENT_SOURCE_DIR}/External")
165
+ set(RDKit_DataDir "${CMAKE_CURRENT_SOURCE_DIR}/Data")
166
+
167
+ #include catch
168
+ find_package(Catch2 3 QUIET)
169
+ if(NOT Catch2_FOUND)
170
+ Include(FetchContent)
171
+
172
+ FetchContent_Declare(
173
+ Catch2
174
+ GIT_REPOSITORY https://github.com/catchorg/Catch2.git
175
+ GIT_TAG v3.4.0 # or a later release
176
+ )
177
+
178
+ FetchContent_MakeAvailable(Catch2)
179
+ endif()
180
+
181
+ # make sure we have better_enums
182
+ Include(FetchContent)
183
+
184
+ FetchContent_Declare(
185
+ better_enums
186
+ GIT_REPOSITORY https://github.com/aantron/better-enums.git
187
+ GIT_TAG c35576bed0295689540b39873126129adfa0b4c8 # 0.11.3
188
+ )
189
+
190
+ if(RDK_INSTALL_INTREE)
191
+ set(RDKit_BinDir "${CMAKE_SOURCE_DIR}/bin")
192
+ set(RDKit_LibDir "${CMAKE_SOURCE_DIR}/lib")
193
+ set(RDKit_HdrDir "Code") # used in rdkit-config.cmake, path prefix not needed.
194
+ set(RDKit_ShareDir "${CMAKE_SOURCE_DIR}")
195
+ else(RDK_INSTALL_INTREE)
196
+ set(RDKit_BinDir "bin")
197
+ set(RDKit_LibDir "lib${LIB_SUFFIX}")
198
+ set(RDKit_HdrDir "include/rdkit")
199
+ set(RDKit_ShareDir "share/RDKit")
200
+ endif(RDK_INSTALL_INTREE)
201
+
202
+ if(RDK_BUILD_RPATH_SUPPORT)
203
+ # use, i.e. don't skip the full RPATH for the build tree
204
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
205
+
206
+ # when building, don't use the install RPATH already
207
+ # (but later on when installing)
208
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
209
+
210
+ message("CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib")
211
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
212
+
213
+ # add the automatically determined parts of the RPATH
214
+ # which point to directories outside the build tree to the install RPATH
215
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
216
+
217
+ # the RPATH to be used when installing, but only if it's not a system
218
+ # directory
219
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
220
+ "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
221
+ IF("${isSystemDir}" STREQUAL "-1")
222
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
223
+ ENDIF("${isSystemDir}" STREQUAL "-1")
224
+ endif()
225
+
226
+
227
+
228
+ if(RDK_BUILD_SWIG_WRAPPERS)
229
+ set(RDKit_JavaLibDir "${RDKit_ExternalDir}/java_lib")
230
+ endif(RDK_BUILD_SWIG_WRAPPERS)
231
+
232
+
233
+ if(RDK_BUILD_COORDGEN_SUPPORT)
234
+ add_definitions(-DRDK_BUILD_COORDGEN_SUPPORT)
235
+ include_directories(${RDKit_ExternalDir})
236
+ endif()
237
+
238
+ if(RDK_BUILD_MAEPARSER_SUPPORT)
239
+ add_definitions(-DRDK_BUILD_MAEPARSER_SUPPORT)
240
+ include_directories(${RDKit_ExternalDir})
241
+ endif()
242
+
243
+ if(RDK_USE_URF)
244
+ add_definitions(-DRDK_USE_URF)
245
+ if((MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) OR ((NOT MSVC) AND WIN32 AND RDK_INSTALL_STATIC_LIBS))
246
+ add_definitions(-DRDL_WIN_STATIC)
247
+ endif()
248
+ include_directories(${RDKit_ExternalDir}/RingFamilies/RingDecomposerLib/src/RingDecomposerLib)
249
+ endif()
250
+
251
+ if(RDK_BUILD_XYZ2MOL_SUPPORT)
252
+ add_definitions(-DRDK_BUILD_XYZ2MOL_SUPPORT)
253
+ include_directories(${RDKit_ExternalDir})
254
+ endif()
255
+
256
+ if(RDK_BUILD_YAEHMOP_SUPPORT)
257
+ add_definitions(-DRDK_BUILD_YAEHMOP_SUPPORT)
258
+ endif()
259
+
260
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
261
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_32BIT_BUILD")
262
+ else()
263
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_64BIT_BUILD")
264
+ endif()
265
+
266
+ if(MINGW)
267
+ target_compile_definitions(rdkit_base INTERFACE "-DBOOST_SYSTEM_NO_DEPRECATED")
268
+ endif(MINGW)
269
+ # fallback on match to "Clang" where CMAKE_C_COMPILER=/usr/bin/cc
270
+ if (CMAKE_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_COMPILER_IS_EMCC)
271
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
272
+ target_compile_definitions(rdkit_base INTERFACE -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_NO_CXX98_FUNCTION_BASE -D_HAS_AUTO_PTR_ETC=0)
273
+ target_compile_options(rdkit_base INTERFACE -Wno-deprecated-builtins -Wno-deprecated-non-prototype -Wno-unused-parameter)
274
+ endif()
275
+ endif()
276
+
277
+ # defines macros: rdkit_python_extension, rdkit_test
278
+ include(RDKitUtils)
279
+
280
+ install(TARGETS rdkit_base EXPORT ${RDKit_EXPORTED_TARGETS}
281
+ COMPONENT dev )
282
+
283
+ # disable some warnings that we don't care about
284
+ if(MSVC)
285
+ # These should occasionally be enabled to check what's going on
286
+ # 4267 conversion with possible loss of data.
287
+ # 4305 truncation from 'double' to 'const float'
288
+ # 4244 conversion from 'uint64_t' to 'unsigned int', possible loss of data
289
+ target_compile_options(rdkit_base INTERFACE "/wd4267" "/wd4305" "/wd4244")
290
+ target_compile_definitions(rdkit_base INTERFACE "_CRT_SECURE_NO_WARNINGS")
291
+ endif(MSVC)
292
+
293
+
294
+ # extra boost versions
295
+ if(MSVC)
296
+ # FIX: do we still need this?
297
+ target_compile_definitions(rdkit_base INTERFACE "-DBOOST_ALL_NO_LIB")
298
+ if(RDK_INSTALL_DLLS_MSVC)
299
+ target_compile_definitions(rdkit_base INTERFACE "-DBOOST_ALL_DYN_LINK")
300
+ endif(RDK_INSTALL_DLLS_MSVC)
301
+ endif(MSVC)
302
+
303
+ if(RDK_BUILD_INCHI_SUPPORT)
304
+ find_package(Inchi)
305
+ endif(RDK_BUILD_INCHI_SUPPORT)
306
+
307
+ if(RDK_BUILD_PYTHON_WRAPPERS)
308
+ add_library(rdkit_py_base INTERFACE)
309
+
310
+ #-------
311
+ # pull in python:
312
+ find_package(Python3 COMPONENTS Interpreter Development.Module NumPy)
313
+ target_include_directories(rdkit_py_base INTERFACE ${Python3_INCLUDE_DIRS})
314
+ target_include_directories(rdkit_py_base INTERFACE ${Python3_NumPy_INCLUDE_DIRS})
315
+
316
+ # determine linkage of python
317
+ execute_process(
318
+ COMMAND
319
+ ${Python3_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('Py_ENABLE_SHARED'))"
320
+ OUTPUT_VARIABLE Py_ENABLE_SHARED
321
+ OUTPUT_STRIP_TRAILING_WHITESPACE
322
+ )
323
+
324
+ if(WIN32 OR "${Py_ENABLE_SHARED}" STREQUAL "1")
325
+ target_link_libraries(rdkit_py_base INTERFACE ${Python3_LIBRARIES} )
326
+ endif()
327
+
328
+
329
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" "numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" REQUIRED CONFIG)
330
+
331
+ target_link_libraries(rdkit_py_base INTERFACE "Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" "Boost::numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
332
+
333
+ if(RDK_INSTALL_INTREE)
334
+ set(RDKit_PythonDir "${CMAKE_SOURCE_DIR}/rdkit")
335
+ else(RDK_INSTALL_INTREE)
336
+ if (NOT PYTHON_INSTDIR)
337
+ # Determine correct installation directory for Python bindings
338
+ execute_process(
339
+ COMMAND
340
+ ${Python3_EXECUTABLE} -c "import sys; import sysconfig; \
341
+ base_key = 'base' if sys.platform == 'win32' else 'platbase'; \
342
+ schema = 'nt' if sys.platform == 'win32' else 'posix_prefix'; \
343
+ print(sysconfig.get_path('platlib', schema, vars={base_key: '${CMAKE_INSTALL_PREFIX}'}))"
344
+ OUTPUT_VARIABLE PYTHON_INSTDIR
345
+ OUTPUT_STRIP_TRAILING_WHITESPACE
346
+ )
347
+ endif (NOT PYTHON_INSTDIR)
348
+ string(REGEX REPLACE "\\\\" "/" PYTHON_INSTDIR ${PYTHON_INSTDIR})
349
+ message("Python Install directory ${PYTHON_INSTDIR}")
350
+ set(RDKit_PythonDir "${PYTHON_INSTDIR}/rdkit")
351
+ if(RDK_INSTALL_PYTHON_TESTS)
352
+ install(DIRECTORY rdkit DESTINATION ${PYTHON_INSTDIR}
353
+ COMPONENT python
354
+ PATTERN ".svn" EXCLUDE
355
+ PATTERN "CMake*" EXCLUDE
356
+ PATTERN "Basement" EXCLUDE
357
+ )
358
+ else(RDK_INSTALL_PYTHON_TESTS)
359
+ install(DIRECTORY rdkit DESTINATION ${PYTHON_INSTDIR}
360
+ COMPONENT python
361
+ PATTERN ".svn" EXCLUDE
362
+ PATTERN "test_data" EXCLUDE
363
+ PATTERN "testData" EXCLUDE
364
+ PATTERN "test_list*" EXCLUDE
365
+ PATTERN "CMake*" EXCLUDE
366
+ PATTERN "Basement" EXCLUDE
367
+ PATTERN "UnitTest*" EXCLUDE
368
+ )
369
+ endif(RDK_INSTALL_PYTHON_TESTS)
370
+
371
+ endif(RDK_INSTALL_INTREE)
372
+
373
+ if(NOT WIN32)
374
+ # See https://bugs.python.org/msg277944
375
+ # The "command to create shared modules". Used as variable in the "Makefile (and similar) templates to build python modules"
376
+ # for both in-python and third party modules. Initialized to hold the value which works for third party modules to link
377
+ # against the _installed_ python.
378
+ # We strip off the first word though (which will be the compiler name).
379
+ execute_process(
380
+ COMMAND
381
+ ${Python3_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('LDSHARED').lstrip().split(' ', 1)[1])"
382
+ OUTPUT_VARIABLE PYTHON_LDSHARED
383
+ OUTPUT_STRIP_TRAILING_WHITESPACE
384
+ )
385
+ endif()
386
+
387
+
388
+ install(TARGETS rdkit_py_base EXPORT ${RDKitPython_EXPORTED_TARGETS}
389
+ COMPONENT dev )
390
+
391
+ # check to see if we can find nbval,
392
+ execute_process(
393
+ COMMAND
394
+ ${Python3_EXECUTABLE} -c "import nbval"
395
+ ERROR_VARIABLE nbvalERR
396
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
397
+ if(NOT nbvalERR)
398
+ set(RDK_NBVAL_AVAILABLE ON)
399
+ else()
400
+ message("nbval not found, disabling the jupyter tests")
401
+ endif()
402
+
403
+ else(RDK_BUILD_PYTHON_WRAPPERS)
404
+ find_package(Boost ${RDK_BOOST_VERSION} REQUIRED CONFIG)
405
+ endif(RDK_BUILD_PYTHON_WRAPPERS)
406
+
407
+ find_package(Eigen3)
408
+ if(RDK_BUILD_DESCRIPTORS3D)
409
+ if(NOT EIGEN3_FOUND)
410
+ add_subdirectory(External/Eigen)
411
+ endif()
412
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_BUILD_DESCRIPTORS3D")
413
+ endif()
414
+
415
+ if(TARGET Eigen3::Eigen)
416
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_HAS_EIGEN3")
417
+ target_link_libraries(rdkit_base INTERFACE Eigen3::Eigen)
418
+ set(RDK_HAS_EIGEN ON)
419
+ endif()
420
+
421
+ if(RDK_BUILD_THREADSAFE_SSS)
422
+ find_package (Threads)
423
+ set(RDKit_THREAD_LIBS Threads::Threads)
424
+ target_compile_definitions(rdkit_base INTERFACE -DRDK_BUILD_THREADSAFE_SSS)
425
+ if(RDK_TEST_MULTITHREADED)
426
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_TEST_MULTITHREADED")
427
+ endif()
428
+ target_link_libraries(rdkit_base INTERFACE Threads::Threads)
429
+ else()
430
+ # otherwise boost flyweight links against pthreads and causes the
431
+ # RDK_BUILD_THREADSAFE_SSS=OFF build to fail
432
+ target_compile_definitions(rdkit_base INTERFACE "-DBOOST_DISABLE_THREADS")
433
+ if(RDK_TEST_MULTITHREADED)
434
+ message("RDK_TEST_MULTITHREADED does not make sense without RDK_BUILD_THREADSAFE_SSS, disabling it.")
435
+ set(RDK_TEST_MULTITHREADED OFF)
436
+ endif()
437
+ endif()
438
+
439
+ if(RDK_USE_BOOST_SERIALIZATION)
440
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS serialization iostreams REQUIRED CONFIG)
441
+ target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})
442
+ target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_SERIALIZATION)
443
+ if(NOT Boost_USE_STATIC_LIBS)
444
+ target_compile_definitions(rdkit_base INTERFACE -DBOOST_SERIALIZATION_DYN_LINK)
445
+ endif()
446
+ endif()
447
+
448
+ if(RDK_USE_BOOST_IOSTREAMS)
449
+ target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_IOSTREAMS)
450
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS iostreams REQUIRED CONFIG)
451
+ target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})
452
+
453
+ if (NOT Boost_USE_STATIC_LIBS)
454
+ target_compile_definitions(rdkit_base INTERFACE -DBOOST_IOSTREAMS_DYN_LINK)
455
+ endif()
456
+
457
+ # deal with zlib
458
+ if (WIN32)
459
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS zlib CONFIG)
460
+ if(Boost_zlib_FOUND)
461
+ set(zlib_lib Boost::zlib)
462
+ endif()
463
+ else()
464
+ if(Boost_USE_STATIC_LIBS)
465
+ # when we're doing static linkage of boost
466
+ # to also link against zlib (due to iostreams)
467
+ find_package(ZLIB)
468
+ set(zlib_lib ${ZLIB_LIBRARIES})
469
+ endif()
470
+ endif()
471
+ target_link_libraries(rdkit_base INTERFACE ${zlib_lib})
472
+ endif()
473
+
474
+
475
+ # set the boost include directories and linkage:
476
+ target_include_directories(rdkit_base INTERFACE
477
+ $<BUILD_INTERFACE:${RDKit_CodeDir}>
478
+ $<INSTALL_INTERFACE:${RDKit_HdrDir}>
479
+ )
480
+ # linking against Boost::boost will add Boost to the include directories without
481
+ # hard-coding Boost's path into the rdkit-targets.cmake that gets generated
482
+ target_link_libraries(rdkit_base INTERFACE ${BOOST_LIBRARIES} Boost::boost)
483
+
484
+
485
+ if(RDK_BUILD_PGSQL)
486
+ find_package(PostgreSQL REQUIRED)
487
+ endif(RDK_BUILD_PGSQL)
488
+
489
+ # setup our compiler flags:
490
+ if (RDK_TEST_COVERAGE)
491
+ if (NOT RDK_USE_FLEXBISON)
492
+ message(FATAL_ERROR, "Test coverage doesn't current work unless FLEX and BISON are run.")
493
+ endif(NOT RDK_USE_FLEXBISON)
494
+
495
+ message("====== Installing test coverage support ======")
496
+ message(" To run:")
497
+ message(" make install")
498
+ message(" make RDKit_coverage")
499
+ message("")
500
+ message(" open <build_dir>/coverage/index.html")
501
+ message("")
502
+ message(" If any of the RDKit tests fail, coverage will probably not be generated.")
503
+ message("====== Installing test coverage support ======")
504
+ message("")
505
+
506
+ INCLUDE(CodeCoverage)
507
+ SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
508
+ SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
509
+ message("== setup_target_for_coverage(${PROJECT_NAME}_coverage test coverage)")
510
+ setup_target_for_coverage(${PROJECT_NAME}_coverage ctest coverage)
511
+
512
+ else(RDK_TEST_COVERAGE)
513
+ if(CMAKE_COMPILER_IS_GNUCXX)
514
+ # We don't on C_FLAGS warnings to keep Avalon compiling quiet
515
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated -Wno-unused-function -fno-strict-aliasing")
516
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -Wall -Wextra")
517
+ if (NOT CYGWIN)
518
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
519
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
520
+ endif()
521
+ endif()
522
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # there's at least Clang and AppleClang
523
+ # We don't on C_FLAGS warnings to keep Avalon compiling quiet
524
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-bounds -fPIC -Wno-parentheses -Wno-logical-op-parentheses -Wno-format")
525
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -Wno-format -Wno-logical-op-parentheses -fPIC")
526
+ if(APPLE)
527
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
528
+ endif()
529
+ endif()
530
+ endif(RDK_TEST_COVERAGE)
531
+
532
+ if(NOT RDK_INSTALL_INTREE)
533
+ install(DIRECTORY Data DESTINATION
534
+ ${RDKit_ShareDir}
535
+ COMPONENT data
536
+ PATTERN ".svn" EXCLUDE
537
+ )
538
+ install(DIRECTORY Docs DESTINATION
539
+ ${RDKit_ShareDir}
540
+ COMPONENT docs
541
+ PATTERN ".svn" EXCLUDE
542
+ PATTERN "_build" EXCLUDE
543
+ )
544
+ install(DIRECTORY Contrib DESTINATION
545
+ ${RDKit_ShareDir}
546
+ COMPONENT extras
547
+ PATTERN ".svn" EXCLUDE
548
+ )
549
+ if(RDK_BUILD_PYTHON_WRAPPERS)
550
+ install(DIRECTORY Projects DESTINATION
551
+ ${RDKit_ShareDir}
552
+ COMPONENT extras
553
+ PATTERN ".svn" EXCLUDE
554
+ PATTERN "test_list*" EXCLUDE
555
+ PATTERN "CMake*" EXCLUDE
556
+ )
557
+ if(RDK_INSTALL_PYTHON_TESTS)
558
+ install(DIRECTORY Scripts DESTINATION
559
+ ${RDKit_ShareDir}
560
+ COMPONENT data
561
+ PATTERN ".svn" EXCLUDE
562
+ )
563
+ else(RDK_INSTALL_PYTHON_TESTS)
564
+ install(DIRECTORY Scripts DESTINATION
565
+ ${RDKit_ShareDir}
566
+ COMPONENT data
567
+ PATTERN ".svn" EXCLUDE
568
+ PATTERN "run_python_tests.py" EXCLUDE
569
+ )
570
+ endif(RDK_INSTALL_PYTHON_TESTS)
571
+
572
+
573
+ endif(RDK_BUILD_PYTHON_WRAPPERS)
574
+ install(FILES README.md license.txt
575
+ DESTINATION ${RDKit_ShareDir}
576
+ COMPONENT base
577
+ )
578
+ endif(NOT RDK_INSTALL_INTREE)
579
+
580
+ if (RDK_SQUASH_MVC_SECURE_WARNINGS)
581
+ MESSAGE("== Squashing MSVC Security warnings (do not use during development)")
582
+ target_compile_definitions(rdkit_base INTERFACE "-D_SCL_SECURE_NO_WARNINGS")
583
+ target_compile_definitions(rdkit_base INTERFACE "/wd4996")
584
+ endif(RDK_SQUASH_MVC_SECURE_WARNINGS)
585
+
586
+ if(RDK_USE_STRICT_ROTOR_DEFINITION)
587
+ MESSAGE("== Using strict rotor definition")
588
+ target_compile_definitions(rdkit_base INTERFACE "-DRDK_USE_STRICT_ROTOR_DEFINITION")
589
+ endif()
590
+
591
+ if (MSVC)
592
+ # disable warnings:
593
+ # - 4267: conversion from 'size_t' to 'unsigned int', possible loss of data
594
+ add_definitions( "/wd4267" )
595
+ endif(MSVC)
596
+
597
+ add_subdirectory(External)
598
+ add_subdirectory(Code)
599
+
600
+ if(RDK_BUILD_PYTHON_WRAPPERS)
601
+ add_subdirectory(Projects)
602
+ add_subdirectory(rdkit)
603
+ add_subdirectory(rdkit-stubs)
604
+ endif(RDK_BUILD_PYTHON_WRAPPERS)
605
+
606
+ if(RDK_BUILD_CONTRIB)
607
+ add_subdirectory(Contrib)
608
+ endif(RDK_BUILD_CONTRIB)
609
+
610
+ # export the project targets (to be included in the cmake package configuration)
611
+ include(CMakePackageConfigHelpers)
612
+
613
+ # first manage the targets for the base C++ toolkit
614
+ install(
615
+ EXPORT ${RDKit_EXPORTED_TARGETS}
616
+ FILE ${RDKit_EXPORTED_TARGETS}.cmake
617
+ NAMESPACE RDKit::
618
+ DESTINATION ${RDKit_LibDir}/cmake/rdkit
619
+ )
620
+
621
+ # create and install package configuration and version files
622
+ write_basic_package_version_file(
623
+ "${RDKit_BINARY_DIR}/rdkit-config-version.cmake"
624
+ VERSION ${RDKit_RELEASENAME}
625
+ COMPATIBILITY AnyNewerVersion
626
+ )
627
+
628
+ configure_file (
629
+ ${RDKit_SOURCE_DIR}/rdkit-config.cmake.in
630
+ ${RDKit_BINARY_DIR}/rdkit-config.cmake @ONLY)
631
+
632
+ install(FILES
633
+ ${RDKit_BINARY_DIR}/rdkit-config.cmake
634
+ ${RDKit_BINARY_DIR}/rdkit-config-version.cmake
635
+ DESTINATION ${RDKit_LibDir}/cmake/rdkit)
636
+
637
+ # then manage the targets for the python bindings
638
+ if(RDK_BUILD_PYTHON_WRAPPERS)
639
+ install(
640
+ EXPORT ${RDKitPython_EXPORTED_TARGETS}
641
+ FILE ${RDKitPython_EXPORTED_TARGETS}.cmake
642
+ NAMESPACE RDKit::
643
+ DESTINATION ${RDKit_LibDir}/cmake/rdkitpython
644
+ )
645
+
646
+ write_basic_package_version_file(
647
+ "${RDKit_BINARY_DIR}/rdkitpython-config-version.cmake"
648
+ VERSION ${RDKit_RELEASENAME}
649
+ COMPATIBILITY AnyNewerVersion
650
+ )
651
+
652
+ configure_file (
653
+ ${RDKit_SOURCE_DIR}/rdkitpython-config.cmake.in
654
+ ${RDKit_BINARY_DIR}/rdkitpython-config.cmake @ONLY)
655
+
656
+ install(FILES
657
+ ${RDKit_BINARY_DIR}/rdkitpython-config.cmake
658
+ ${RDKit_BINARY_DIR}/rdkitpython-config-version.cmake
659
+ DESTINATION ${RDKit_LibDir}/cmake/rdkitpython)
660
+ endif(RDK_BUILD_PYTHON_WRAPPERS)
661
+
662
+ # Memory testing setup
663
+ FIND_PROGRAM(MEMORYCHECK_COMMAND valgrind)
664
+ CONFIGURE_FILE(CTestCustom.ctest.in ${RDKit_BINARY_DIR}/CTestCustom.ctest)
665
+
666
+ # Packaging
667
+ SET(CPACK_GENERATOR "TGZ;DEB;RPM")
668
+ SET(CPACK_RPM_COMPONENT_INSTALL ON)
669
+ SET(CPACK_DEB_COMPONENT_INSTALL ON)
670
+ SET(CPACK_MONOLITHIC_INSTALL OFF)
671
+
672
+ SET(CPACK_COMPONENTS_ALL runtime base data docs dev python extras)
673
+ set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
674
+ set(CPACK_COMPONENT_BASE_GROUP "Runtime")
675
+ set(CPACK_COMPONENT_DATA_GROUP "Runtime")
676
+ set(CPACK_COMPONENT_DOCS_GROUP "Runtime")
677
+ set(CPACK_COMPONENT_DEV_GROUP "Development")
678
+ set(CPACK_COMPONENT_PYTHON_GROUP "Python")
679
+ set(CPACK_COMPONENT_EXTRAS_GROUP "Extras")
680
+ if(RDK_BUILD_PGSQL)
681
+ SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} pgsql)
682
+ set(CPACK_COMPONENT_PGSQL_GROUP "PgSQL")
683
+ endif()
684
+
685
+ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "RDKit")
686
+ SET(CPACK_PACKAGE_VENDOR "rdkit.org")
687
+ SET(CPACK_PACKAGE_CONTACT "greg.landrum@gmail.com")
688
+ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
689
+ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
690
+ SET(CPACK_PACKAGE_VERSION_MAJOR ${RDKit_Year})
691
+ SET(CPACK_PACKAGE_VERSION_MINOR ${RDKit_Month})
692
+ SET(CPACK_PACKAGE_VERSION_PATCH ${RDKit_Revision}${RDKit_RevisionModifier})
693
+ SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
694
+ #IF(WIN32 AND NOT UNIX)
695
+ # # There is a bug in NSI that does not handle full unix paths properly. Make
696
+ # # sure there is at least one set of four (4) backlasshes.
697
+ # SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
698
+ # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
699
+ # SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project")
700
+ # SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
701
+ # SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
702
+ # SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
703
+ # SET(CPACK_NSIS_MODIFY_PATH ON)
704
+ #ELSE(WIN32 AND NOT UNIX)
705
+ # SET(CPACK_STRIP_FILES "bin/MyExecutable")
706
+ # SET(CPACK_SOURCE_STRIP_FILES "")
707
+ #ENDIF(WIN32 AND NOT UNIX)
708
+ #SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable")
709
+
710
+
711
+ SET(CPACK_SET_DESTDIR ON)
712
+
713
+ INCLUDE(CPack)
rdkit/source/CONTRIBUTING ADDED
@@ -0,0 +1 @@
 
 
1
+ See Docs/Book/GettingStartedWithContributing.md
rdkit/source/CTestConfig.cmake ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # For some reason, MEMORYCHECK_SUPPRESSIONS_FILE is not being caught, so I hardcoded it here
2
+ SET(MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --error-exitcode=13 --time-stamp=yes --num-callers=20 --gen-suppressions=all --leak-check=full --show-reachable=no --trace-children=yes --suppressions=${RDKit_SOURCE_DIR}/Code/cmake/rdkit_valgrind.suppressions")
rdkit/source/CTestCustom.ctest.in ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Require us to have the $RDBASE env var set to run the tests
2
+ IF(NOT DEFINED ENV{RDBASE})
3
+ MESSAGE(FATAL_ERROR "\n\nPlease set your RDBASE env variable before running the tests.\n\n")
4
+ ENDIF(NOT DEFINED ENV{RDBASE})
5
+
6
+ SET(CTEST_CUSTOM_MEMCHECK_IGNORE
7
+ ${CTEST_CUSTOM_MEMCHECK_IGNORE}
8
+
9
+ # python tests are not memchecked: these are slow, and difficult to interpret
10
+ ${RDKIT_PYTEST_CACHE}
11
+ )
rdkit/source/Code/Bench/CMakeLists.txt ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ add_executable(bench EXCLUDE_FROM_ALL bench_common.cpp
2
+ descriptors.cpp
3
+ fingerprint.cpp
4
+ meta.cpp
5
+ mol.cpp
6
+ molops.cpp
7
+ pickle.cpp
8
+ smiles.cpp
9
+ stereo.cpp
10
+ substruct_match.cpp
11
+ )
12
+ target_link_libraries(bench rdkitCatch
13
+ CIPLabeler
14
+ Descriptors
15
+ Fingerprints
16
+ SmilesParse
17
+ )
18
+
19
+ if(RDK_BUILD_INCHI_SUPPORT)
20
+ target_link_libraries(bench RDInchiLib)
21
+ target_sources(bench PRIVATE inchi.cpp)
22
+ endif(RDK_BUILD_INCHI_SUPPORT)
23
+
24
+ if(RDK_BUILD_CPP_TESTS)
25
+ # add a fast version of the benchmarks to the default unit tests
26
+ # to protect the benchmarks from bit-rot
27
+ add_test(
28
+ NAME quickbench
29
+ COMMAND bench --benchmark-samples 1 --benchmark-warmup-time 0
30
+ )
31
+
32
+ # ctest does not automatically build test executables
33
+ # so, like with other unit tests in this repo, we need to manually
34
+ # build the target before running ctest. This usually gets done with
35
+ # an `all` or an `install` build. We re-add bench to he `all` group
36
+ # to keep it similar to the other unit tests
37
+ set_target_properties(bench PROPERTIES EXCLUDE_FROM_ALL FALSE)
38
+ endif(RDK_BUILD_CPP_TESTS)
rdkit/source/Code/Bench/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RDKit Benchmarks
2
+
3
+ To run:
4
+
5
+ ```bash
6
+ mkdir build
7
+ cd build
8
+ cmake ..
9
+ cmake --build . --target bench -j "$(nproc)"
10
+ # see `./Code/Bench/bench --help` for options
11
+ export RDBASE=".."
12
+ ./Code/Bench/bench
13
+ ```
rdkit/source/Code/Bench/bench_common.cpp ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+
3
+ #include <GraphMol/ROMol.h>
4
+ #include <GraphMol/SmilesParse/SmilesParse.h>
5
+
6
+ #include "bench_common.hpp"
7
+
8
+ namespace bench_common {
9
+
10
+ std::vector<RDKit::ROMol> load_samples() {
11
+ std::vector<RDKit::ROMol> ret;
12
+ for (auto smiles : SAMPLES) {
13
+ auto mol = RDKit::v2::SmilesParse::MolFromSmiles(smiles);
14
+ REQUIRE(mol);
15
+ ret.push_back(std::move(*mol));
16
+ }
17
+ return ret;
18
+ }
19
+
20
+ } // namespace bench_common
rdkit/source/Code/Bench/bench_common.hpp ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <cstdint>
4
+ #include <limits>
5
+ #include <vector>
6
+
7
+ #include <GraphMol/ROMol.h>
8
+
9
+ namespace bench_common {
10
+
11
+ constexpr const char *SAMPLES[] = {
12
+ // highly fused/bridged ring system
13
+ "O=C1N2[C@H]3N4CN5C(=O)N6C7C5N(C2)C(=O)N7CN2C(=O)N5CN1[C@@H]3N(CN1C5C2N(C1=O)C6)C4=O",
14
+
15
+ // multiple stereo groups
16
+ "OC[C@]12[C@](O)(CC[C@H]3[C@]4(O)[C@@](C)([C@@H](C5COC(=O)C5)CC4)C[C@@H](O)[C@H]13)C[C@@H](O[C@@H]1O[C@@H](C)[C@H](O)[C@@H](O)[C@H]1O)C[C@H]2O",
17
+
18
+ // randomly selected
19
+ "C[C@H](NS(/C=C/c1ccccc1)(=O)=O)C(OCC(N1CCC(C)CC1)=O)=O",
20
+ "COc1ccc(-n2cc(CNC(C)c3ncncc3)c(-c3cc(F)ccc3)n2)cc1",
21
+ "O=C1N=C([n+]2ccccc2)/C(=C/[O-])N1c1ccccc1",
22
+ "c1csc(CNC(=O)C2CCC(CNS(c3ccccc3)(=O)=O)CC2)c1",
23
+ "CC1=C2C(c3ccc(C)cc3)C3=C(N=C2NN1)CC(C)(C)CC3=O",
24
+ "NC(N)=NN/C=C1\\C=CC=C([N+]([O-])=O)C1=O",
25
+ "CCc1c2c(oc(=O)c1)c(CN1CCN(C)CC1)c(O)c(Cl)c2",
26
+ "COc1ccc(C2CC(C(F)(F)F)N3NC=C(C(Nc4c(C)n(C)n(-c5ccccc5)c4=O)=O)C3=N2)cc1",
27
+ "Cc1ccc(CC(=O)O/N=C(\\N)Cc2ccc([N+]([O-])=O)cc2)cc1",
28
+ "Br.COc1ccc(/N=C/C=C2/OC(C)(C)OC(c3ccccc3)=C2)cc1",
29
+ };
30
+
31
+ std::vector<RDKit::ROMol> load_samples();
32
+
33
+ constexpr uint64_t nth_random(uint64_t n) noexcept {
34
+ // https://xoshiro.di.unimi.it/splitmix64.c
35
+ // inlined here becuse <boost/random/splitmix64.hpp> is not always available
36
+ std::uint64_t seed = 1;
37
+ std::uint64_t z = seed + (n + 1) * 0x9E3779B97F4A7C15;
38
+ z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9;
39
+ z = (z ^ (z >> 27)) * 0x94D049BB133111EB;
40
+ return z ^ (z >> 31);
41
+ }
42
+
43
+ static_assert(0x910a2dec89025cc1 == nth_random(0));
44
+ static_assert(0xbeeb8da1658eec67 == nth_random(1));
45
+ static_assert(0xf893a2eefb32555e == nth_random(2));
46
+ static_assert(0x71c18690ee42c90b == nth_random(3));
47
+ static_assert(0x71bb54d8d101b5b9 == nth_random(4));
48
+ static_assert(0x7760003b54a685ae == nth_random(1000));
49
+ static_assert(0x28a1928f0674d152 == nth_random(1000000000000));
50
+ static_assert(0x5692161d100b05e5 ==
51
+ nth_random(std::numeric_limits<uint64_t>::max()));
52
+
53
+ } // namespace bench_common
rdkit/source/Code/Bench/descriptors.cpp ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/SmilesParse/SmilesParse.h>
7
+ #include <GraphMol/Descriptors/Lipinski.h>
8
+
9
+ using namespace RDKit;
10
+
11
+ TEST_CASE("Descriptors::calcNumSpiroAtoms", "[descriptors]") {
12
+ auto samples = bench_common::load_samples();
13
+ BENCHMARK("Descriptors::calcNumSpiroAtoms") {
14
+ auto sum = 0;
15
+ for (auto &mol : samples) {
16
+ sum += Descriptors::calcNumSpiroAtoms(mol);
17
+ }
18
+ return sum;
19
+ };
20
+ }
21
+
22
+ TEST_CASE("Descriptors::calcNumBridgeheadAtoms", "[descriptors]") {
23
+ auto samples = bench_common::load_samples();
24
+ BENCHMARK("Descriptors::calcNumBridgeheadAtoms") {
25
+ auto sum = 0;
26
+ for (auto &mol : samples) {
27
+ sum += Descriptors::calcNumBridgeheadAtoms(mol);
28
+ }
29
+ return sum;
30
+ };
31
+ }
rdkit/source/Code/Bench/fingerprint.cpp ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/SmilesParse/SmilesParse.h>
7
+ #include <GraphMol/Fingerprints/MorganGenerator.h>
8
+
9
+ using namespace RDKit;
10
+
11
+ TEST_CASE("MorganFingerprints::getFingerprint", "[fingerprint]") {
12
+ auto samples = bench_common::load_samples();
13
+ const auto radius = 2;
14
+ std::unique_ptr<FingerprintGenerator<uint64_t>> gen(
15
+ MorganFingerprint::getMorganGenerator<uint64_t>(radius));
16
+
17
+ BENCHMARK("MorganFingerprints::getFingerprint") {
18
+ auto sum = 0;
19
+ for (auto &mol : samples) {
20
+ std::unique_ptr<ExplicitBitVect> fp(gen->getFingerprint(mol));
21
+ sum += fp->getNumOnBits();
22
+ }
23
+ return sum;
24
+ };
25
+ }
rdkit/source/Code/Bench/inchi.cpp ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/ROMol.h>
7
+ #include <GraphMol/SmilesParse/SmilesParse.h>
8
+ #include <INCHI-API/inchi.h>
9
+
10
+ using namespace RDKit;
11
+
12
+ TEST_CASE("MolToInchi", "[inchi]") {
13
+ auto samples = bench_common::load_samples();
14
+ BENCHMARK("MolToInchi") {
15
+ std::vector<std::string> inchis;
16
+ for (auto &mol : samples) {
17
+ ExtraInchiReturnValues rv;
18
+ inchis.push_back(MolToInchi(mol, rv));
19
+ }
20
+ return inchis;
21
+ };
22
+ }
23
+
24
+ TEST_CASE("InchiToInchiKey", "[inchi]") {
25
+ auto samples = bench_common::load_samples();
26
+ std::vector<std::string> inchis;
27
+ for (auto &mol : samples) {
28
+ ExtraInchiReturnValues rv;
29
+ inchis.push_back(MolToInchi(mol, rv));
30
+ }
31
+ BENCHMARK("InchiToInchiKey") {
32
+ std::vector<std::string> inchikeys;
33
+ for (auto &inchi : inchis) {
34
+ inchikeys.push_back(InchiToInchiKey(inchi));
35
+ }
36
+ return inchikeys;
37
+ };
38
+ }
39
+
40
+ TEST_CASE("InchiToMol", "[inchi]") {
41
+ auto samples = bench_common::load_samples();
42
+ std::vector<std::string> inchis;
43
+ for (auto &mol : samples) {
44
+ ExtraInchiReturnValues rv;
45
+ inchis.push_back(MolToInchi(mol, rv));
46
+ }
47
+ BENCHMARK("InchiToMol") {
48
+ std::vector<std::unique_ptr<ROMol>> mols;
49
+ for (auto &inchi : inchis) {
50
+ ExtraInchiReturnValues rv_inner;
51
+ mols.emplace_back(InchiToMol(inchi, rv_inner));
52
+ }
53
+ return mols;
54
+ };
55
+ }
rdkit/source/Code/Bench/meta.cpp ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // benches about benches
2
+
3
+ #include <catch2/catch_all.hpp>
4
+ #include <string>
5
+
6
+ #include "bench_common.hpp"
7
+
8
+ TEST_CASE("bench_common::nth_random", "[meta]") {
9
+ BENCHMARK("bench_common::nth_random", i) {
10
+ return bench_common::nth_random(i);
11
+ };
12
+ }
rdkit/source/Code/Bench/mol.cpp ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/ROMol.h>
7
+ #include <GraphMol/SmilesParse/SmilesParse.h>
8
+
9
+ using namespace RDKit;
10
+
11
+ TEST_CASE("ROMol copy constructor", "[mol]") {
12
+ auto samples = bench_common::load_samples();
13
+ BENCHMARK_ADVANCED("ROMol copy constructor")(
14
+ Catch::Benchmark::Chronometer meter) {
15
+ std::vector<Catch::Benchmark::storage_for<ROMol>> storage(meter.runs() *
16
+ samples.size());
17
+ meter.measure([&](int i) {
18
+ for (size_t sample = 0; sample < samples.size(); ++sample) {
19
+ storage[i * samples.size() + sample].construct(samples[sample]);
20
+ }
21
+ });
22
+ };
23
+ }
24
+
25
+ TEST_CASE("ROMol destructor", "[mol]") {
26
+ auto samples = bench_common::load_samples();
27
+ BENCHMARK_ADVANCED("ROMol destructor")(Catch::Benchmark::Chronometer meter) {
28
+ std::vector<Catch::Benchmark::destructable_object<ROMol>> storage(
29
+ meter.runs() * samples.size());
30
+ for (size_t i = 0; i < storage.size(); ++i) {
31
+ storage[i].construct(samples[i % samples.size()]);
32
+ }
33
+ meter.measure([&](int i) {
34
+ for (size_t sample = 0; sample < samples.size(); ++sample) {
35
+ storage[i * samples.size() + sample].destruct();
36
+ }
37
+ });
38
+ };
39
+ }
40
+
41
+ TEST_CASE("memory pressure test", "[mol][size]") {
42
+ auto cases = bench_common::load_samples();
43
+ REQUIRE(!cases.empty());
44
+
45
+ const size_t N = 10400;
46
+ std::vector<ROMol> mols;
47
+ mols.reserve(N);
48
+ for (size_t i = 0; i < N; ++i) {
49
+ mols.emplace_back(cases[i % cases.size()]);
50
+ }
51
+ REQUIRE(mols.size() == N);
52
+
53
+ BENCHMARK("memory pressure test", i) {
54
+ // copy from one random location to another
55
+ auto a = bench_common::nth_random(i);
56
+ auto src_idx = a % mols.size();
57
+ auto dst_idx = (a / mols.size()) % mols.size();
58
+ ROMol temp(mols[src_idx]);
59
+ mols[dst_idx] = std::move(temp);
60
+ };
61
+ }
62
+
63
+ TEST_CASE("ROMol::getNumHeavyAtoms", "[mol]") {
64
+ auto samples = bench_common::load_samples();
65
+ BENCHMARK("ROMol::getNumHeavyAtoms") {
66
+ auto sum = 0;
67
+ for (auto &mol : samples) {
68
+ sum += mol.getNumHeavyAtoms();
69
+ }
70
+ return sum;
71
+ };
72
+ }
rdkit/source/Code/Bench/molops.cpp ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/SmilesParse/SmilesParse.h>
7
+ #include <GraphMol/MolOps.h>
8
+
9
+ using namespace RDKit;
10
+
11
+ TEST_CASE("MolOps::addHs", "[molops]") {
12
+ auto samples = bench_common::load_samples();
13
+ BENCHMARK("MolOps::addHs") {
14
+ auto total_atoms = 0;
15
+ for (auto &mol : samples) {
16
+ RWMol mol_copy(mol);
17
+ MolOps::addHs(mol_copy);
18
+ total_atoms += mol_copy.getNumAtoms();
19
+ }
20
+ return total_atoms;
21
+ };
22
+ }
23
+
24
+ TEST_CASE("MolOps::FindSSR", "[molops]") {
25
+ auto samples = bench_common::load_samples();
26
+ BENCHMARK("MolOps::FindSSR") {
27
+ auto total = 0;
28
+ for (auto &mol : samples) {
29
+ total += MolOps::findSSSR(mol);
30
+ }
31
+ return total;
32
+ };
33
+ }
34
+
35
+ TEST_CASE("MolOps::getMolFrags", "[molops]") {
36
+ auto samples = bench_common::load_samples();
37
+ BENCHMARK("MolOps::getMolFrags") {
38
+ auto total = 0;
39
+ for (auto &mol : samples) {
40
+ std::vector<std::unique_ptr<ROMol>> frags;
41
+ MolOps::getMolFrags(mol, frags);
42
+ for (auto &frag : frags) {
43
+ total += frag->getNumAtoms();
44
+ }
45
+ }
46
+ return total;
47
+ };
48
+ }
rdkit/source/Code/Bench/pickle.cpp ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+ #include <sstream>
4
+
5
+ #include "bench_common.hpp"
6
+
7
+ #include <GraphMol/MolPickler.h>
8
+ #include <GraphMol/SmilesParse/SmilesParse.h>
9
+
10
+ using namespace RDKit;
11
+
12
+ TEST_CASE("MolPickler::pickleMol", "[pickle]") {
13
+ auto samples = bench_common::load_samples();
14
+ BENCHMARK("MolPickler::pickleMol") {
15
+ std::stringstream buf;
16
+ for (auto &mol : samples) {
17
+ MolPickler::pickleMol(mol, buf);
18
+ }
19
+ return buf.str().size();
20
+ };
21
+ }
22
+
23
+ TEST_CASE("MolPickler::molFromPickle", "[pickle]") {
24
+ auto samples = bench_common::load_samples();
25
+ std::vector<std::string> pickles;
26
+ pickles.reserve(samples.size());
27
+ for (auto &mol : samples) {
28
+ std::string pickled;
29
+ MolPickler::pickleMol(mol, pickled);
30
+ pickles.push_back(std::move(pickled));
31
+ }
32
+ BENCHMARK("MolPickler::molFromPickle") {
33
+ auto total_atoms = 0;
34
+ for (auto &pickled : pickles) {
35
+ ROMol res(pickled);
36
+ total_atoms += res.getNumAtoms();
37
+ }
38
+ REQUIRE(total_atoms > 0);
39
+ return total_atoms;
40
+ };
41
+ }
rdkit/source/Code/Bench/smiles.cpp ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/ROMol.h>
7
+ #include <GraphMol/SmilesParse/SmilesParse.h>
8
+ #include <GraphMol/SmilesParse/SmilesWrite.h>
9
+
10
+ using namespace RDKit;
11
+
12
+ TEST_CASE("SmilesToMol", "[smiles]") {
13
+ BENCHMARK("SmilesToMol") {
14
+ auto total_atoms = 0;
15
+ for (auto smiles : bench_common::SAMPLES) {
16
+ auto mol = v2::SmilesParse::MolFromSmiles(smiles);
17
+ REQUIRE(mol);
18
+ total_atoms += mol->getNumAtoms();
19
+ }
20
+ return total_atoms;
21
+ };
22
+ }
23
+
24
+ TEST_CASE("MolToSmiles", "[smiles]") {
25
+ auto samples = bench_common::load_samples();
26
+ BENCHMARK("MolToSmiles") {
27
+ auto total_length = 0;
28
+ for (auto &mol : samples) {
29
+ auto smiles = MolToSmiles(mol);
30
+ total_length += smiles.size();
31
+ }
32
+ return total_length;
33
+ };
34
+ }
35
+
36
+ TEST_CASE("MolToCXSmiles", "[smiles]") {
37
+ auto samples = bench_common::load_samples();
38
+ BENCHMARK("MolToCXSmiles") {
39
+ auto total_length = 0;
40
+ for (auto &mol : samples) {
41
+ auto smiles = MolToCXSmiles(mol);
42
+ total_length += smiles.size();
43
+ }
44
+ return total_length;
45
+ };
46
+ }
rdkit/source/Code/Bench/stereo.cpp ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+
4
+ #include "bench_common.hpp"
5
+
6
+ #include <GraphMol/CIPLabeler/CIPLabeler.h>
7
+ #include <GraphMol/Chirality.h>
8
+ #include <GraphMol/ROMol.h>
9
+ #include <GraphMol/SmilesParse/SmilesParse.h>
10
+ #include <GraphMol/MolOps.h>
11
+ #include <GraphMol/test_fixtures.h>
12
+
13
+ using namespace RDKit;
14
+
15
+ TEST_CASE("Chirality::findPotentialStereo", "[stereo]") {
16
+ auto samples = bench_common::load_samples();
17
+
18
+ BENCHMARK("Chirality::findPotentialStereo") {
19
+ auto total = 0;
20
+
21
+ for (auto &mol : samples) {
22
+ auto stereo_infos = Chirality::findPotentialStereo(mol);
23
+
24
+ // workaround for https://github.com/rdkit/rdkit/issues/8880
25
+ mol.clearComputedProps();
26
+
27
+ for (auto &info : stereo_infos) {
28
+ total += info.controllingAtoms.size();
29
+ }
30
+ }
31
+
32
+ return total;
33
+ };
34
+ }
35
+
36
+ TEST_CASE("CIPLabeler::assignCIPLabels", "[stereo]") {
37
+ auto samples = bench_common::load_samples();
38
+ BENCHMARK("CIPLabeler::assignCIPLabels") {
39
+ for (auto &mol : samples) {
40
+ CIPLabeler::assignCIPLabels(mol);
41
+ }
42
+ };
43
+ }
44
+
45
+ TEST_CASE("MolOps::assignStereochemistry", "[stereo]") {
46
+ const auto cleanIt = true;
47
+ const auto force = true;
48
+ const auto flagPossibleStereoCenters = true;
49
+
50
+ auto samples = bench_common::load_samples();
51
+
52
+ const auto legacy = GENERATE(true, false);
53
+ UseLegacyStereoPerceptionFixture fx(legacy);
54
+ auto str_legacy = std::string(legacy ? "true" : "false");
55
+
56
+ BENCHMARK("MolOps::assignStereochemistry legacy=" + str_legacy) {
57
+ auto total = 0;
58
+
59
+ for (auto &mol : samples) {
60
+ MolOps::assignStereochemistry(mol, cleanIt, force,
61
+ flagPossibleStereoCenters);
62
+ for (auto &atom : mol.atoms()) {
63
+ total += atom->getChiralTag();
64
+ }
65
+
66
+ // workaround for https://github.com/rdkit/rdkit/issues/8880
67
+ mol.clearComputedProps();
68
+ }
69
+
70
+ return total;
71
+ };
72
+ }
rdkit/source/Code/Bench/substruct_match.cpp ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <catch2/catch_all.hpp>
2
+ #include <string>
3
+ #include <vector>
4
+ #include <istream>
5
+ #include <filesystem>
6
+
7
+ #include "bench_common.hpp"
8
+
9
+ #include <GraphMol/ROMol.h>
10
+ #include <GraphMol/SmilesParse/SmilesParse.h>
11
+ #include <GraphMol/Substruct/SubstructMatch.h>
12
+
13
+ using namespace RDKit;
14
+
15
+ namespace bench_substruct_match {
16
+
17
+ std::filesystem::path relative_to_rdbase(
18
+ const std::filesystem::path &relative) {
19
+ char *rdbase = std::getenv("RDBASE");
20
+ if (!rdbase) {
21
+ throw std::runtime_error("RDBASE environment variable not set");
22
+ }
23
+ std::filesystem::path path(rdbase);
24
+ path /= relative;
25
+ return path;
26
+ }
27
+
28
+ std::vector<std::string> parse_smarts_examples(std::istream &in) {
29
+ std::vector<std::string> examples;
30
+ std::string line;
31
+ while (std::getline(in, line)) {
32
+ if (line.starts_with("#") || line.starts_with(" ") || line.empty()) {
33
+ continue;
34
+ }
35
+ std::istringstream ss(line);
36
+ std::string smarts;
37
+ std::getline(ss, smarts, ' ');
38
+ examples.push_back(line);
39
+ }
40
+ return examples;
41
+ }
42
+
43
+ std::vector<std::string> load_smarts_examples(std::filesystem::path &path) {
44
+ std::ifstream file(path);
45
+ return parse_smarts_examples(file);
46
+ }
47
+
48
+ std::vector<ROMol> load_smarts_queries(const std::filesystem::path &relative) {
49
+ auto path = relative_to_rdbase(relative);
50
+ auto examples = load_smarts_examples(path);
51
+ std::vector<ROMol> queries;
52
+ for (const auto &example : examples) {
53
+ auto query = v2::SmilesParse::MolFromSmarts(example);
54
+ REQUIRE(query);
55
+ queries.push_back(std::move(*query));
56
+ }
57
+ return queries;
58
+ }
59
+
60
+ } // namespace bench_substruct_match
61
+
62
+ TEST_CASE("ROMol::GetSubstructMatch", "[substruct_match]") {
63
+ auto samples = bench_common::load_samples();
64
+
65
+ auto query = v2::SmilesParse::MolFromSmarts(
66
+ "[#6,#7]1:[#6,#7]:[#6](:[#6,#7]:[#6,#7]:[#6]:1-[#17,#35,#53,#9])-[#5](-[#8])-[#8]");
67
+ BENCHMARK("ROMol::GetSubstructMatch") {
68
+ auto total = 0;
69
+ for (auto &mol : samples) {
70
+ auto matches = SubstructMatch(mol, *query);
71
+ total += matches.size();
72
+ }
73
+ return total;
74
+ };
75
+ }
76
+
77
+ TEST_CASE("ROMol::GetSubstructMatch RLewis", "[substruct_match]") {
78
+ auto mols = bench_common::load_samples();
79
+ auto queries = bench_substruct_match::load_smarts_queries(
80
+ "Data/SmartsLib/RLewis_smarts.txt");
81
+
82
+ BENCHMARK("ROMol::GetSubstructMatch RLewis") {
83
+ auto total = 0;
84
+ for (const auto &mol : mols) {
85
+ for (const auto &query : queries) {
86
+ auto matches = SubstructMatch(mol, query);
87
+ total += matches.size();
88
+ }
89
+ }
90
+ return total;
91
+ };
92
+ }
93
+
94
+ TEST_CASE("ROMol::GetSubstructMatch patty", "[substruct_match]") {
95
+ auto mols = bench_common::load_samples();
96
+ auto queries = bench_substruct_match::load_smarts_queries(
97
+ "Data/SmartsLib/patty_rules.txt");
98
+
99
+ BENCHMARK("ROMol::GetSubstructMatch patty") {
100
+ auto total = 0;
101
+ for (const auto &mol : mols) {
102
+ for (const auto &query : queries) {
103
+ auto matches = SubstructMatch(mol, query);
104
+ total += matches.size();
105
+ }
106
+ }
107
+ return total;
108
+ };
109
+ }
rdkit/source/Code/CMakeLists.txt ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ createExportTestHeaders()
2
+ add_subdirectory(RDGeneral)
3
+ if(RDK_BUILD_PYTHON_WRAPPERS)
4
+ add_subdirectory(RDBoost)
5
+ endif(RDK_BUILD_PYTHON_WRAPPERS)
6
+ add_subdirectory(RDStreams)
7
+ add_subdirectory(DataStructs)
8
+ add_subdirectory(Geometry)
9
+
10
+ add_subdirectory(Numerics)
11
+ add_subdirectory(ForceField)
12
+ add_subdirectory(DistGeom)
13
+ add_subdirectory(Catalogs)
14
+
15
+ add_subdirectory(GraphMol)
16
+ add_subdirectory(Query)
17
+ add_subdirectory(Features)
18
+
19
+ add_subdirectory(DataManip)
20
+ if(RDK_BIG_ENDIAN)
21
+ message("Skipping build of SimDivPickers on big endian system")
22
+ else(RDK_BIG_ENDIAN)
23
+ add_subdirectory(SimDivPickers)
24
+ endif(RDK_BIG_ENDIAN)
25
+
26
+ add_subdirectory(ML)
27
+ add_subdirectory(ChemicalFeatures)
28
+
29
+ if(RDK_BUILD_SWIG_WRAPPERS)
30
+ add_subdirectory(JavaWrappers)
31
+ endif()
32
+
33
+ if(RDK_BUILD_PGSQL)
34
+ add_subdirectory(PgSQL/rdkit)
35
+ endif(RDK_BUILD_PGSQL)
36
+
37
+ add_subdirectory(MinimalLib)
38
+
39
+
40
+ if(RDK_BUILD_FUZZ_TARGETS)
41
+ add_subdirectory(Fuzz)
42
+ endif(RDK_BUILD_FUZZ_TARGETS)
43
+
44
+ add_subdirectory(Bench)
rdkit/source/Code/Catalogs/CMakeLists.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ rdkit_library(Catalogs
3
+ Catalog.cpp CatalogParams.cpp CatalogEntry.cpp
4
+ LINK_LIBRARIES RDGeneral)
5
+ target_compile_definitions(Catalogs PRIVATE RDKIT_CATALOGS_BUILD)
6
+
7
+ rdkit_headers(CatalogEntry.h
8
+ Catalog.h
9
+ CatalogParams.h DEST Catalogs)
10
+
11
+
rdkit/source/Code/Catalogs/Catalog.cpp ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // $Id$
2
+ //
3
+ // Copyright (C) 2003-2006 Rational Discovery LLC
4
+ //
5
+ // @@ All Rights Reserved @@
6
+ // This file is part of the RDKit.
7
+ // The contents are covered by the terms of the BSD license
8
+ // which is included in the file license.txt, found at the root
9
+ // of the RDKit source tree.
10
+ //
11
+ //
12
+
13
+ #include "Catalog.h"
14
+
15
+ namespace RDCatalog {}