diff --git a/.gitignore b/.gitignore index 168b71e..5a0f95c 100644 --- a/.gitignore +++ b/.gitignore @@ -376,3 +376,4 @@ Testing/ *.bak ____*.* +CMakeFiles/ \ No newline at end of file diff --git a/README.md b/README.md index 7e49840..de4b1fa 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,21 @@ ## How to Build - Registered NuGet package was built using the following versions. - - [RDKit Release_2021_09_4](https://github.com/rdkit/rdkit/releases/tag/Release_2021_09_4) + - [RDKit Release_2023_09_6](https://github.com/rdkit/rdkit/releases/tag/Release_2023_09_6) - [Eigen 3.3.8](https://gitlab.com/libeigen/eigen/-/releases/3.3.8) - for Windows - [Boost 1.74.0](https://sourceforge.net/projects/boost/files/boost-binaries/1.74.0/) - [Cairo 1.16.0](https://www.cairographics.org/releases/cairo-1.16.0.tar.xz) - [libpng 1.6.37](https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz) - [pixman 0.40.0](https://www.cairographics.org/releases/pixman-0.40.0.tar.gz) - - [zlib 1.2.11](https://zlib.net/zlib1211.zip) - - [CMAKE 3.18.20081302-MSVC_2](https://cmake.org/) - - Visual Studio 2019 - - [Python 3.9](https://www.python.org/) + - [zlib 1.3.1](https://zlib.net/zlib131.zip) + - [CMAKE 33.30.5-msvc23](https://cmake.org/) + - Visual Studio 2022 + - [Python 3.12](https://www.python.org/) - [SWIG 3.0.12](http://www.swig.org/) - - dotnet-sdk-5.0 + - dotnet-sdk-8.0 - for Linux - - Ubuntu 18.04.6 LTS on WSL2 + - Ubuntu 24.04.2 LTS on WSL2 ### Build Instruction @@ -37,8 +37,8 @@ Do the following procedure. #### Build native binaries for Windows 10 (x64) - On Windows 10 (x64) -- Install Visual Studio 2019 enabling C++, C# and CMAKE. -- Install Python version greater than 3.8. +- Install Visual Studio 2022 enabling C++, C# and CMAKE. +- Install Python version greater than 3.12. - Install [SWIG](http://www.swig.org/). - IMPORTANT: SWIG-3.0 is required. SWIG-4.0 does not work. - Make sure Python and SWIG are executable. @@ -51,31 +51,26 @@ Do the following procedure. - [zlib](https://zlib.net/) to `zlib-#.#.##`. - [libpng 1.6](http://www.libpng.org/pub/png/libpng.html) to `lpng16##`. - [FreeType](https://www.freetype.org/) to `freetype-#.##.#`. -- Download binery archives of both 32-bit and 64-bit versions of Boost for Visual Studio 2019, ie, msvc-14.2. +- Download binery archives of both 32-bit and 64-bit versions of Boost for Visual Studio 2022, ie, msvc-14.2. - [https://sourceforge.net/projects/boost/files/boost-binaries/](https://sourceforge.net/projects/boost/files/boost-binaries/). - Execute EXE files to extract. Defaults to store to `C:\local`. - Copy `boost_#_##_#` directory here. - Only dll and lib, ie, the files in `lib64-msvc-14.#` and `lib32-msvc-14.#`, are used to build. - After above, `lib64-msvc-14.#` and `lib32-msvc-14.#` should be created under `boost_#_##_#` directory. - Customize `config.txt` file according to where above dependencies are installed. -- Open `Developer Command Prompt for VS 2019`. +- Open `Developer Command Prompt for VS 2022`. - Execute `bash build_win.bat` to create native binaries in `${RDKIT_DIR}/Code/JavaWrappers/csharp_wrapper/win/`. #### Build native binaries for Ubuntu 18.4 - Don't share with Windows build. -- Ubuntu 18.4 is recommended. -- Install python 3.8 or greater, swig 3.0, and eigen3. -- Install dotnet-sdk-5.0 and Mono. +- Ubuntu 24.04 is recommended. +- Install python 3.12 or greater, swig 3.0, and eigen3. +- Install dotnet-sdk-8.0 and Mono. ```bash -sudo wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ - sudo dpkg -i packages-microsoft-prod.deb && \ - sudo rm packages-microsoft-prod.deb && \ - sudo apt-get update && \ - sudo apt-get install -y apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get install -y dotnet-sdk-5.0 && \ - sudo apt-get install -y mono-mcs + sudo apt-get update && \ + sudo apt-get install -y dotnet-sdk-8.0 && \ + sudo apt-get install -y mono-mcs ``` - Clone this repository. - Download the following source archives and extract them here. @@ -86,18 +81,18 @@ sudo wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft- #### Build .NET wrapper - On Windows 10 (x64) -- Open `Developer Command Prompt for VS 2019`. +- Open `Developer Command Prompt for VS 2022`. - Execute `python ./build_rdkit_csharp.py --build_wrapper` to create assembry files named `RDKit2DotNet.dll` in `${RDKIT_DIR}\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet\bin\Release\`. #### Build and create NuGet package -- Open `Developer Command Prompt for VS 2019`. +- Open `Developer Command Prompt for VS 2022`. - Copy native binaries for Linux to `${RDKIT_DIR}/Code/JavaWrappers/csharp_wrapper/linux/`. - Execute `python ./build_rdkit_csharp.py --build_nuget` to create NuGet package on `${RDKIT_DIR}\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet\bin\Release\`. #### Copy created NuGet package to myApp -- Open `Developer Command Prompt for VS 2019`. +- Open `Developer Command Prompt for VS 2022`. - Execute `nmake -f Makefile.win copy_to_myapp`. ### Install SWIG-3.0.12 diff --git a/build_linux.sh b/build_linux.sh index 1c1e225..c827574 100644 --- a/build_linux.sh +++ b/build_linux.sh @@ -4,9 +4,9 @@ if [ "$?" != "0" ] ; then exit 1 fi -python --version | grep -E "Python 3\.(8|9|10)\." > /dev/null +python --version | grep -E "Python 3\.(8|9|10|11|12)\." > /dev/null if [ "$?" != "0" ] ; then - echo Python version is 3.8, 3.9, or 3.10. + echo Python version is lower than 3.8. exit 1 fi diff --git a/build_rdkit_csharp.py b/build_rdkit_csharp.py index 7fa9f0e..9519579 100644 --- a/build_rdkit_csharp.py +++ b/build_rdkit_csharp.py @@ -3,7 +3,7 @@ Notes: This is developed with rdkit-Release_2021_09_4. """ -from enum import Enum + import argparse import glob import logging @@ -15,6 +15,7 @@ import sys import typing import xml.etree.ElementTree as ET +from enum import Enum from os import PathLike from pathlib import Path from subprocess import PIPE @@ -38,7 +39,7 @@ logging.basicConfig(level=logging.DEBUG) project_name: str = "RDKit.DotNetWrap" -VisualStudioVersion = Literal["15.0", "16.0"] +VisualStudioVersion = Literal["15.0", "16.0", "17.0"] CpuModel = Literal["x86", "x64"] MSPlatform = Literal["Win32", "x64"] AddressModel = Literal[32, 64] @@ -47,17 +48,19 @@ here = Path(__file__).parent.resolve() + class LangType(Enum): CPlusPlus = 1 Java = 2 CSharp = 3 Python = 4 -_LangType_to_str: Mapping[LangType, str] ={ + +_LangType_to_str: Mapping[LangType, str] = { LangType.CPlusPlus: "cpp", LangType.Java: "java", LangType.CSharp: "CSharp", - LangType.Python : "python", + LangType.Python: "python", } @@ -75,6 +78,10 @@ class LangType(Enum): "x86": ['-G"Visual Studio 16 2019"', "-AWin32"], "x64": ['-G"Visual Studio 16 2019"'], }, + "17.0": { + "x86": ['-G"Visual Studio 17 2022"', "-AWin32"], + "x64": ['-G"Visual Studio 17 2022"'], + }, } _platform_to_ms_form: Mapping[CpuModel, MSPlatform] = { "x86": "Win32", @@ -87,6 +94,7 @@ class LangType(Enum): _vs_to_msvc_internal_ver: Mapping[VisualStudioVersion, MSVCInternalVersion] = { "15.0": "14.1", "16.0": "14.2", + "17.0": "14.3", } @@ -207,6 +215,7 @@ def remove_if_exist(path: Path) -> None: elif path.is_dir(): shutil.rmtree(path) + def remove_by_pattern(parent: Path, re_pattern: str, delete_on_match: bool) -> None: pat = re.compile(re_pattern) for p in parent.iterdir(): @@ -217,6 +226,7 @@ def remove_by_pattern(parent: Path, re_pattern: str, delete_on_match: bool) -> N if not pat.match(p.name): remove_if_exist(p) + def makefile_to_lines(filename: PathLike) -> Iterable[str]: lines: List[str] = [] with open(filename, "r") as f: @@ -724,41 +734,6 @@ def bakable_files(self) -> Iterable[Path]: def path_RDKit2DotNet_folder(self): return self.rdkit_wrapper_path / "RDKit2DotNet" - def build_cmake_rdkit(self) -> Sequence[str]: - self.rdkit_build_path.mkdir(exist_ok=True) - _curdir = os.path.abspath(os.curdir) - os.chdir(self.rdkit_build_path) - try: - self._patch_i_files() - cmd = self._make_rdkit_cmake() - return cmd - finally: - os.chdir(_curdir) - - def build_rdkit(self) -> None: - self.rdkit_build_path.mkdir(exist_ok=True) - _curdir = os.path.abspath(os.curdir) - os.chdir(self.rdkit_build_path) - try: - if get_os() == "win": - self.run_msbuild("RDKit.sln") - else: - cmd = ["make", "-j"] - if self.config.target_lang in (LangType.CPlusPlus,): - pass - elif self.config.target_lang in (LangType.CSharp,): - cmd += ["RDKFuncs"] - elif self.config.target_lang in (LangType.Java,): - cmd += ["install"] - else: - raise AssertionError - call_subprocess(cmd) - finally: - os.chdir(_curdir) - - def copy_rdkit_dlls(self) -> None: - self._copy_dlls() - def _patch_GraphMolCSharp_i(self): dic: Dict[str, str] = dict() _line = r"%shared_ptr(RDKit::QueryOps)" @@ -818,10 +793,10 @@ def _patch_MolDescriptors_h(self) -> None: _line = r"SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/swig_csharp )" _inserts = [ "if(RDK_BUILD_DESCRIPTORS3D)" - "SET(CMAKE_SWIG_FLAGS \"-DRDK_BUILD_DESCRIPTORS3D\" \"-DRDK_HAS_EIGEN3\" ${CMAKE_SWIG_FLAGS} )", + 'SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_DESCRIPTORS3D" "-DRDK_HAS_EIGEN3" ${CMAKE_SWIG_FLAGS} )', "endif()", "if(RDK_BUILD_CAIRO_SUPPORT)", - "SET(CMAKE_SWIG_FLAGS \"-DRDK_BUILD_CAIRO_SUPPORT\" ${CMAKE_SWIG_FLAGS} )", + 'SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_CAIRO_SUPPORT" ${CMAKE_SWIG_FLAGS} )', "endif()", ] _insert = "\n" + "\n".join(_inserts) + "\n" @@ -904,13 +879,6 @@ def _patch_i_files(self): self._patch_MolSupplier_i() self._patch_Streams_i() - def _make_rdkit_cmake(self) -> Sequence[str]: - cmd: List[str] = self._get_cmake_rdkit_cmd_line() - if get_os() == "win": - cmd = [a.replace("\\", "/") for a in cmd] - call_subprocess(cmd) - return cmd - def _get_cmake_rdkit_cmd_line(self) -> List[str]: def f_test() -> str: return to_on_off(self.config.test_enabled) @@ -950,7 +918,7 @@ def f_no_limit_external() -> str: if self.config.boost_path: args += [ f"-DBOOST_ROOT={str(self.boost_path)}", - f"-DBOOST_INCLUDEDIR={str(self.boost_path)}", + f"-DBoost_INCLUDE_DIR={str(self.boost_path)}", f"-DBOOST_LIBRARYDIR={str(self.boost_bin_path)}", ] if self.config.eigen_path: @@ -1047,16 +1015,44 @@ def f_no_limit_external() -> str: ] return ["cmake"] + args - def get_RDKFuncs_dll_path(self) -> Path: - a: Path - a = self.rdkit_build_path / "Code" / "JavaWrappers" / "csharp_wrapper" + def _make_rdkit_cmake(self) -> Sequence[str]: + cmd: List[str] = self._get_cmake_rdkit_cmd_line() if get_os() == "win": - a = a / "Release" / "RDKFuncs.dll" - elif get_os() == "linux": - a = a / "RDKFuncs.so" - else: - raise RuntimeError - return a + cmd = [a.replace("\\", "/") for a in cmd] + call_subprocess(cmd) + return cmd + + def build_cmake_rdkit(self) -> Sequence[str]: + self.rdkit_build_path.mkdir(exist_ok=True) + _curdir = os.path.abspath(os.curdir) + os.chdir(self.rdkit_build_path) + try: + self._patch_i_files() + cmd = self._make_rdkit_cmake() + return cmd + finally: + os.chdir(_curdir) + + def build_rdkit(self) -> None: + self.rdkit_build_path.mkdir(exist_ok=True) + _curdir = os.path.abspath(os.curdir) + os.chdir(self.rdkit_build_path) + try: + if get_os() == "win": + self.run_msbuild("RDKit.sln") + else: + cmd = ["make", "-j"] + if self.config.target_lang in (LangType.CPlusPlus,): + pass + elif self.config.target_lang in (LangType.CSharp,): + cmd += ["RDKFuncs"] + elif self.config.target_lang in (LangType.Java,): + cmd += ["install"] + else: + raise AssertionError + call_subprocess(cmd) + finally: + os.chdir(_curdir) def _copy_dlls(self) -> None: assert self.build_platform @@ -1126,22 +1122,19 @@ def _copy_dlls(self) -> None: for path in files_to_copy: shutil.copy2(path, dll_dest_path) - def build_wrapper(self) -> None: - if self.config.target_lang == LangType.CSharp: - self._patch_rdkit_swig_created_files() - self._prepare_RDKitDotNet_folder() - self._copy_test_projects() - self._build_RDKit2DotNet() - elif self.config.target_lang == LangType.Java: - _curdir = os.path.abspath(os.curdir) - os.chdir(self.rdkit_build_path) - try: - cmd = ["make", "-j", "GraphMolWrapJar"] - call_subprocess(cmd) - finally: - os.chdir(_curdir) + def copy_rdkit_dlls(self) -> None: + self._copy_dlls() + + def get_RDKFuncs_dll_path(self) -> Path: + a: Path + a = self.rdkit_build_path / "Code" / "JavaWrappers" / "csharp_wrapper" + if get_os() == "win": + a = a / "Release" / "RDKFuncs.dll" + elif get_os() == "linux": + a = a / "RDKFuncs.so" else: - pass + raise RuntimeError + return a def _patch_rdkit_swig_created_files(self) -> None: # Customize the followings if required. @@ -1238,22 +1231,6 @@ def _prepare_RDKitDotNet_folder(self): copy_to_output_directory.text = "PreserveNewest" tree.write(path_RDKit2DotNet_csproj, "utf-8", True) - @property - def test_csprojects(self) -> Collection[str]: - return ( - "RDKit2DotNetTest", - "RDKit2DotNetTest2", - "NuGetExample", - "NuGetExample2", - ) - - @property - def test_sln_names(self) -> Collection[str]: - return ( - "RDKit2DotNet.sln", - "NuGetExample.sln", - ) - def _copy_test_projects(self) -> None: path_rdkit_files = self.this_path / "files" / "rdkit" for name in self.test_csprojects: @@ -1293,11 +1270,38 @@ def _build_RDKit2DotNet(self) -> None: finally: os.chdir(_pushd_build_wrapper) - def build_nuget_package(self) -> None: - dll_basenames_dic = self._make_dll_basenames_dic() - self._prepare_nuspec_file(dll_basenames_dic) - self._prepare_targets_file(dll_basenames_dic) - self._build_nupkg() + def build_wrapper(self) -> None: + if self.config.target_lang == LangType.CSharp: + self._patch_rdkit_swig_created_files() + self._prepare_RDKitDotNet_folder() + self._copy_test_projects() + self._build_RDKit2DotNet() + elif self.config.target_lang == LangType.Java: + _curdir = os.path.abspath(os.curdir) + os.chdir(self.rdkit_build_path) + try: + cmd = ["make", "-j", "GraphMolWrapJar"] + call_subprocess(cmd) + finally: + os.chdir(_curdir) + else: + pass + + @property + def test_csprojects(self) -> Collection[str]: + return ( + "RDKit2DotNetTest", + "RDKit2DotNetTest2", + "NuGetExample", + "NuGetExample2", + ) + + @property + def test_sln_names(self) -> Collection[str]: + return ( + "RDKit2DotNet.sln", + "NuGetExample.sln", + ) def _make_dll_basenames_dic(self) -> Mapping[str, Mapping[str, Sequence[str]]]: dll_basenames_dic: Dict[str, Dict[str, List[str]]] = dict() @@ -1318,40 +1322,6 @@ def _make_dll_basenames_dic(self) -> Mapping[str, Mapping[str, Sequence[str]]]: assert not dll_basenames_dic["linux"]["x86"] return dll_basenames_dic - def get_description_for_nuget(self) -> str: - s = f".NET binding of RDKit Release_{self.get_version_for_rdkit()}." - if get_os() == "linux": - s += " Supports Linux (x64)." - else: - s += " Supports Windows (x86 and x64) and Linux (x64)." - return s - - def get_lib_versios(self) -> Sequence[str]: - lib_versions: List[str] = [] - lib_versions.append(f"Eigen {self.get_version_for_eigen()}") - if get_os() == "win": - lib_versions.append(f"zlib {self.get_version_for_zlib()}") - if self.config.use_boost: - lib_versions.append(f"Boost {self.get_version_for_boost()}") - if self.config.freetype_support: - lib_versions.append(f"FreeType {self.get_version_for_freetype()}") - if self.config.cairo_support: - lib_versions += [ - f"libpng {self.get_version_for_libpng()}", - f"pixman {self.get_version_for_pixman()}", - f"cairo {self.get_version_for_cairo()}", - ] - return lib_versions - - def get_releaseNotes(self) -> str: - s: str = "This release uses " - s += ", ".join(self.get_lib_versios()) - if get_os() != "win": - s += f" built using Visual Studio {self.get_version_for_rdkit()}" - s += " for Windows build" - s += "." - return s - def _prepare_nuspec_file( self, dll_basenames_dic: Mapping[str, Mapping[str, Sequence[str]]] ) -> None: @@ -1376,9 +1346,9 @@ def _prepare_nuspec_file( for dll_basename in dll_basenames_dic[_os][cpu_model]: file_element = SubElement(files, "file") file_element.attrib["src"] = f"../{_os}/{cpu_model}/{dll_basename}" - file_element.attrib[ - "target" - ] = f"runtimes/{_os}-{cpu_model}/native/{dll_basename}" + file_element.attrib["target"] = ( + f"runtimes/{_os}-{cpu_model}/native/{dll_basename}" + ) tree.write(nuspec_file, "utf-8", True) @@ -1404,9 +1374,9 @@ def _prepare_targets_file( ig.attrib["Condition"] = f"{non_net} And '$(Platform)' == '{cpu_model}'" for dllname in dll_basenames_dic[_os][cpu_model]: none = SubElement(ig, "None") - none.attrib[ - "Include" - ] = f"$(MSBuildThisFileDirectory)../runtimes/{_os}-{cpu_model}/native/{dllname}" + none.attrib["Include"] = ( + f"$(MSBuildThisFileDirectory)../runtimes/{_os}-{cpu_model}/native/{dllname}" + ) link = SubElement(none, "Link") link.text = dllname copy_to = SubElement(none, "CopyToOutputDirectory") @@ -1417,9 +1387,9 @@ def _prepare_targets_file( for cpu_model in typing.get_args(CpuModel): for dllname in dll_basenames_dic[_os][cpu_model]: none = SubElement(ig, "None") - none.attrib[ - "Include" - ] = f"$(MSBuildThisFileDirectory)../runtimes/{_os}-{cpu_model}/native/{dllname}" + none.attrib["Include"] = ( + f"$(MSBuildThisFileDirectory)../runtimes/{_os}-{cpu_model}/native/{dllname}" + ) link = SubElement(none, "Link") link.text = f"runtimes/{_os}-{cpu_model}/native/{dllname}" copy_to = SubElement(none, "CopyToOutputDirectory") @@ -1442,6 +1412,46 @@ def _build_nupkg(self) -> None: finally: os.chdir(_curr_dir) + def build_nuget_package(self) -> None: + dll_basenames_dic = self._make_dll_basenames_dic() + self._prepare_nuspec_file(dll_basenames_dic) + self._prepare_targets_file(dll_basenames_dic) + self._build_nupkg() + + def get_description_for_nuget(self) -> str: + s = f".NET binding of RDKit Release_{self.get_version_for_rdkit()}." + if get_os() == "linux": + s += " Supports Linux (x64)." + else: + s += " Supports Windows (x86 and x64) and Linux (x64)." + return s + + def get_lib_versios(self) -> Sequence[str]: + lib_versions: List[str] = [] + lib_versions.append(f"Eigen {self.get_version_for_eigen()}") + if get_os() == "win": + lib_versions.append(f"zlib {self.get_version_for_zlib()}") + if self.config.use_boost: + lib_versions.append(f"Boost {self.get_version_for_boost()}") + if self.config.freetype_support: + lib_versions.append(f"FreeType {self.get_version_for_freetype()}") + if self.config.cairo_support: + lib_versions += [ + f"libpng {self.get_version_for_libpng()}", + f"pixman {self.get_version_for_pixman()}", + f"cairo {self.get_version_for_cairo()}", + ] + return lib_versions + + def get_releaseNotes(self) -> str: + s: str = "This release uses " + s += ", ".join(self.get_lib_versios()) + if get_os() != "win": + s += f" built using Visual Studio {self.get_version_for_rdkit()}" + s += " for Windows build" + s += "." + return s + def clean_zlib(self) -> None: if self.config.zlib_path: for p in typing.get_args(CpuModel): @@ -1491,12 +1501,19 @@ def clean_rdkit(self) -> None: dir = self.rdkit_path / "Code" / "JavaWrappers" / "gmwrapper" / name remove_if_exist(dir) for name in ("src", "src-test"): - dir = self.rdkit_path / "Code" / "JavaWrappers" / "gmwrapper" / name / "org" / "RDKit" + dir = ( + self.rdkit_path + / "Code" + / "JavaWrappers" + / "gmwrapper" + / name + / "org" + / "RDKit" + ) remove_by_pattern(dir, "\\.gitignore", delete_on_match=False) dir = self.rdkit_path / "Code" / "JavaWrappers" / "gmwrapper" remove_by_pattern(dir, ".*\\.jar$", delete_on_match=True) - def clean(self) -> None: self.clean_rdkit() if self.config.freetype_path: @@ -1526,14 +1543,62 @@ def config_file_to_map(path: Path) -> Mapping[str, str]: return dic +def create_config(args: argparse.Namespace, config_info: Mapping[str, str]) -> Config: + def get_value(env: str) -> Optional[str]: + value: Optional[str] + if env in config_info: + value = config_info[env] + else: + value = get_value_from_env(env) + return value + + def path_from_ini(env: str) -> Optional[Path]: + value: Optional[str] = get_value(env) + if value is None: + return None + path = Path(value) + if not path.is_absolute(): + path = here / value + return path + + def int_from_int(env: str, default: int) -> int: + value: Optional[str] = get_value(env) + if value is None: + return default + return int(value) + + config = Config() + config.minor_version = int_from_int("MINOR_VERSION", 1) + config.swig_patch_enabled = not args.disable_swig_patch + config.use_boost = args.use_boost + config.cairo_support = not args.no_cairo + config.freetype_support = not args.no_freetype + config.limit_external = args.limit_external + if config.limit_external: + config.cairo_support = False + config.freetype_support = False + config.this_path = here + config.use_static_libs = args.use_static_libs + config.rdkit_path = path_from_ini("RDKIT_DIR") + if get_os() == "win": + # These pathes are only for Windows. + config.boost_path = path_from_ini("BOOST_DIR") + config.zlib_path = path_from_ini("ZLIB_DIR") + config.libpng_path = path_from_ini("LIBPNG_DIR") + config.pixman_path = path_from_ini("PIXMAN_DIR") + config.freetype_path = path_from_ini("FREETYPE_DIR") + config.cairo_path = path_from_ini("CAIRO_DIR") + config.eigen_path = path_from_ini("EIGEN_DIR") + config.test_enabled = False + return config + + def main() -> None: parser = argparse.ArgumentParser() parser.add_argument( "--build_platform", default="all", choices=list(typing.get_args(CpuModel)) + ["all"] ) - parser.add_argument( - "--target_lang", default="csharp", choices=("csharp", "java", "cpp") - ) + parser.add_argument("--target_lang", default="csharp", choices=("csharp", "java", "cpp")) for opt in ( "build_zlib", "build_libpng", @@ -1626,55 +1691,5 @@ def main() -> None: os.chdir(curr_dir) -def create_config(args: argparse.Namespace, config_info: Mapping[str, str]) -> Config: - def get_value(env: str) -> Optional[str]: - value: Optional[str] - if env in config_info: - value = config_info[env] - else: - value = get_value_from_env(env) - return value - - def path_from_ini(env: str) -> Optional[Path]: - value: Optional[str] = get_value(env) - if value is None: - return None - path = Path(value) - if not path.is_absolute(): - path = here / value - return path - - def int_from_int(env: str, default: int) -> int: - value: Optional[str] = get_value(env) - if value is None: - return default - return int(value) - - config = Config() - config.minor_version = int_from_int("MINOR_VERSION", 1) - config.swig_patch_enabled = not args.disable_swig_patch - config.use_boost = args.use_boost - config.cairo_support = not args.no_cairo - config.freetype_support = not args.no_freetype - config.limit_external = args.limit_external - if config.limit_external: - config.cairo_support = False - config.freetype_support = False - config.this_path = here - config.use_static_libs = args.use_static_libs - config.rdkit_path = path_from_ini("RDKIT_DIR") - if get_os() == "win": - # These pathes are only for Windows. - config.boost_path = path_from_ini("BOOST_DIR") - config.zlib_path = path_from_ini("ZLIB_DIR") - config.libpng_path = path_from_ini("LIBPNG_DIR") - config.pixman_path = path_from_ini("PIXMAN_DIR") - config.freetype_path = path_from_ini("FREETYPE_DIR") - config.cairo_path = path_from_ini("CAIRO_DIR") - config.eigen_path = path_from_ini("EIGEN_DIR") - config.test_enabled = False - return config - - if __name__ == "__main__": main() diff --git a/config.txt b/config.txt index 1d49ea9..8ac608b 100644 --- a/config.txt +++ b/config.txt @@ -1,9 +1,9 @@ -MINOR_VERSION=2 -RDKIT_DIR=rdkit-Release_2021_09_4 +MINOR_VERSION=0 +RDKIT_DIR=rdkit-Release_2023_09_6 BOOST_DIR=boost_1_74_0 EIGEN_DIR=eigen-3.3.8 FREETYPE_DIR=freetype-2.10.4 CAIRO_DIR=cairo-1.16.0 -ZLIB_DIR=zlib-1.2.11 +ZLIB_DIR=zlib-1.3.1 LIBPNG_DIR=lpng1637 PIXMAN_DIR=pixman-0.40.0