From 21e54a234fe8b08180dba1713712442daf75edc8 Mon Sep 17 00:00:00 2001 From: laggykiller Date: Sun, 10 Sep 2023 01:28:27 +0800 Subject: [PATCH] Fix build --- CMakeLists.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f372fcb..017647f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,23 @@ if (WIN32) set(Boost_USE_STATIC_RUNTIME ON) endif() +project(apngasm-python VERSION 1.0.6) +set(PY_VERSION_SUFFIX "") +set(PY_FULL_VERSION ${PROJECT_VERSION}${PY_VERSION_SUFFIX}) + +# Make sure that the Python and CMake versions match +if (DEFINED PY_BUILD_CMAKE_PACKAGE_VERSION) + if (NOT "${PY_BUILD_CMAKE_PACKAGE_VERSION}" MATCHES "^${PY_FULL_VERSION}$") + message(FATAL_ERROR "Version number does not match " + "(${PY_BUILD_CMAKE_PACKAGE_VERSION} - ${PY_FULL_VERSION}).") + endif() +endif() + +# Find the nanobind package +include(cmake/QueryPythonForNanobind.cmake) +find_nanobind_python_first() + +# Add conan packages if ("${APNGASM_COMPILE_TARGET}" STREQUAL "universal2") set(CONAN_TOOLCHAIN_1 ${CMAKE_SOURCE_DIR}/conan_output/x86_64/conan_toolchain.cmake) if (EXISTS ${CONAN_TOOLCHAIN_1}) @@ -49,7 +66,7 @@ if ("${APNGASM_COMPILE_TARGET}" STREQUAL "universal2") else() message(WARNING "The conan_toolchain file could not be found: ${CONAN_TOOLCHAIN_1}") endif() - + set(CONAN_TOOLCHAIN_2 ${CMAKE_SOURCE_DIR}/conan_output/armv8/conan_toolchain.cmake) if (EXISTS ${CONAN_TOOLCHAIN_2}) include(${CONAN_TOOLCHAIN_2}) @@ -65,23 +82,6 @@ else() endif() endif() - -project(apngasm-python VERSION 1.0.6) -set(PY_VERSION_SUFFIX "") -set(PY_FULL_VERSION ${PROJECT_VERSION}${PY_VERSION_SUFFIX}) - -# Make sure that the Python and CMake versions match -if (DEFINED PY_BUILD_CMAKE_PACKAGE_VERSION) - if (NOT "${PY_BUILD_CMAKE_PACKAGE_VERSION}" MATCHES "^${PY_FULL_VERSION}$") - message(FATAL_ERROR "Version number does not match " - "(${PY_BUILD_CMAKE_PACKAGE_VERSION} - ${PY_FULL_VERSION}).") - endif() -endif() - -# Find the nanobind package -include(cmake/QueryPythonForNanobind.cmake) -find_nanobind_python_first() - # Compile the Python module nanobind_add_module(_apngasm_python "src/apngasm_python.cpp" NB_STATIC STABLE_ABI) if (WIN32)