From 9eaaf901f34eb6aeb8ae3f79542fb69b6cfbb6e0 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Sun, 8 May 2022 16:06:36 -0700 Subject: [PATCH] Fix compilation of test wrapper --- CMakeLists.txt | 9 ++++++++- setup.py | 20 ++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bd1c44..7f26a43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,14 @@ include(tools/CompilerWarnings.cmake) project(quicktex) # Find dependencies -find_package(Python COMPONENTS Interpreter Development.Module) +if (DEFINED QUICKTEX_MODULE_ONLY) + # Not all python installs include the headers necessary for embedding. If we are only building the module, + # we can ignore the embed headers + find_package(Python COMPONENTS Interpreter Development.Module) +else () + find_package(Python COMPONENTS Interpreter Development) +endif () + find_package(pybind11 CONFIG REQUIRED) find_package(OpenMP) diff --git a/setup.py b/setup.py index c7af897..b5d9f98 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,9 @@ import os import re -import sys import subprocess -import pybind11 +import sys +import pybind11 from setuptools import setup, Extension from setuptools.command.build_ext import build_ext @@ -43,7 +43,8 @@ class CMakeBuild(build_ext): "-Dpybind11_DIR={}".format(pybind11.get_cmake_dir()), "-DPython_EXECUTABLE={}".format(sys.executable), "-DPython_ROOT_DIR={}".format(os.path.dirname(sys.executable)), - "-DQUICKTEX_VERSION_INFO={}".format(version), + "-DQUICKTEX_VERSION_INFO={}".format(version), # include version info in module + "-DQUICKTEX_MODULE_ONLY=TRUE", # only build the module, not the wrapper "-DCMAKE_BUILD_TYPE={}".format(cfg), # not used on MSVC, but no harm # clear cached make program binary, see https://github.com/pypa/setuptools/issues/2912 "-U", @@ -68,12 +69,7 @@ class CMakeBuild(build_ext): contains_arch = any(x in cmake_generator for x in {"ARM", "Win64"}) # Convert distutils Windows platform specifiers to CMake -A arguments - plat_to_cmake = { - "win32": "Win32", - "win-amd64": "x64", - "win-arm32": "ARM", - "win-arm64": "ARM64", - } + plat_to_cmake = {"win32": "Win32", "win-amd64": "x64", "win-arm32": "ARM", "win-arm64": "ARM64"} # Specify the arch if using MSVC generator, but only if it doesn't # contain a backward-compatibility arch spec already in the @@ -110,8 +106,4 @@ class CMakeBuild(build_ext): # The information here can also be placed in setup.cfg - better separation of # logic and declaration, and simpler if you include description/version in a file. -setup( - use_scm_version=True, - ext_modules=[CMakeExtension("_quicktex")], - cmdclass={"build_ext": CMakeBuild}, -) +setup(use_scm_version=True, ext_modules=[CMakeExtension("_quicktex")], cmdclass={"build_ext": CMakeBuild})