|
| 1 | +# Copyright 2024 DeepMind Technologies Limited |
| 2 | +# |
| 3 | +# AlphaFold 3 source code is licensed under CC BY-NC-SA 4.0. To view a copy of |
| 4 | +# this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ |
| 5 | +# |
| 6 | +# To request access to the AlphaFold 3 model parameters, follow the process set |
| 7 | +# out at https://github.com/google-deepmind/alphafold3. You may only use these |
| 8 | +# if received directly from Google. Use is subject to terms of use available at |
| 9 | +# https://github.com/google-deepmind/alphafold3/blob/main/WEIGHTS_TERMS_OF_USE.md |
| 10 | + |
| 11 | +cmake_minimum_required(VERSION 3.28) |
| 12 | +project( |
| 13 | + "${SKBUILD_PROJECT_NAME}" |
| 14 | + LANGUAGES CXX |
| 15 | + VERSION "${SKBUILD_PROJECT_VERSION}") |
| 16 | + |
| 17 | +include(FetchContent) |
| 18 | +set(CMAKE_CXX_STANDARD 20) |
| 19 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 20 | +set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
| 21 | +set(ABSL_PROPAGATE_CXX_STD ON) |
| 22 | + |
| 23 | +# Remove support for scan deps, which is only useful when using C++ modules. |
| 24 | +unset(CMAKE_CXX_SCANDEP_SOURCE) |
| 25 | + |
| 26 | +FetchContent_Declare( |
| 27 | + abseil-cpp |
| 28 | + GIT_REPOSITORY https://github.com/abseil/abseil-cpp |
| 29 | + GIT_TAG d7aaad83b488fd62bd51c81ecf16cd938532cc0a # 20240116.2 |
| 30 | + EXCLUDE_FROM_ALL) |
| 31 | + |
| 32 | +FetchContent_Declare( |
| 33 | + pybind11 |
| 34 | + GIT_REPOSITORY https://github.com/pybind/pybind11 |
| 35 | + GIT_TAG 2e0815278cb899b20870a67ca8205996ef47e70f # v2.12.0 |
| 36 | + EXCLUDE_FROM_ALL) |
| 37 | + |
| 38 | +FetchContent_Declare( |
| 39 | + pybind11_abseil |
| 40 | + GIT_REPOSITORY https://github.com/pybind/pybind11_abseil |
| 41 | + GIT_TAG bddf30141f9fec8e577f515313caec45f559d319 # HEAD @ 2024-08-07 |
| 42 | + EXCLUDE_FROM_ALL) |
| 43 | + |
| 44 | +FetchContent_Declare( |
| 45 | + cifpp |
| 46 | + GIT_REPOSITORY https://github.com/pdb-redo/libcifpp |
| 47 | + GIT_TAG ac98531a2fc8daf21131faa0c3d73766efa46180 # v7.0.3 |
| 48 | + # Don't `EXCLUDE_FROM_ALL` as necessary for build_data. |
| 49 | +) |
| 50 | + |
| 51 | +FetchContent_Declare( |
| 52 | + dssp |
| 53 | + GIT_REPOSITORY https://github.com/PDB-REDO/dssp |
| 54 | + GIT_TAG 57560472b4260dc41f457706bc45fc6ef0bc0f10 # v4.4.7 |
| 55 | + EXCLUDE_FROM_ALL) |
| 56 | + |
| 57 | +FetchContent_MakeAvailable(pybind11 abseil-cpp pybind11_abseil cifpp dssp) |
| 58 | + |
| 59 | +find_package( |
| 60 | + Python3 |
| 61 | + COMPONENTS Interpreter Development NumPy |
| 62 | + REQUIRED) |
| 63 | + |
| 64 | +include_directories(${PYTHON_INCLUDE_DIRS}) |
| 65 | +include_directories(src/) |
| 66 | + |
| 67 | +file(GLOB_RECURSE cpp_srcs src/alphafold3/*.cc) |
| 68 | +list(FILTER cpp_srcs EXCLUDE REGEX ".*\(_test\|_main\|_benchmark\).cc$") |
| 69 | + |
| 70 | +add_compile_definitions(NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION) |
| 71 | + |
| 72 | +pybind11_add_module(cpp ${cpp_srcs}) |
| 73 | + |
| 74 | +target_link_libraries( |
| 75 | + cpp |
| 76 | + PRIVATE absl::check |
| 77 | + absl::flat_hash_map |
| 78 | + absl::node_hash_map |
| 79 | + absl::strings |
| 80 | + absl::status |
| 81 | + absl::statusor |
| 82 | + absl::log |
| 83 | + pybind11_abseil::absl_casters |
| 84 | + Python3::NumPy |
| 85 | + dssp::dssp |
| 86 | + cifpp::cifpp) |
| 87 | + |
| 88 | +target_compile_definitions(cpp PRIVATE VERSION_INFO=${PROJECT_VERSION}) |
| 89 | +install(TARGETS cpp LIBRARY DESTINATION alphafold3) |
| 90 | +install( |
| 91 | + FILES LICENSE |
| 92 | + OUTPUT_TERMS_OF_USE.md |
| 93 | + WEIGHTS_PROHIBITED_USE_POLICY.md |
| 94 | + WEIGHTS_TERMS_OF_USE.md |
| 95 | + DESTINATION alphafold3) |
0 commit comments