From b577099e9215ebde9daedc3b6a60e3b1fa2b8c35 Mon Sep 17 00:00:00 2001 From: "Frank T. Bergmann" Date: Mon, 15 Apr 2024 10:52:18 +0000 Subject: [PATCH] - ensure crosscompiling works with libsedml --- .gitignore | 1 + CMakeModules/FindEXPAT.cmake | 12 ++++++++---- CMakeModules/FindLIBNUML.cmake | 7 +++++-- CMakeModules/FindLIBSBML.cmake | 17 +++++++++++++++-- dev/create-source-package.sh | 11 +++++++++++ src/bindings/python/setup.py | 17 ++++++++++------- submodules/NuML | 2 +- submodules/libSBML | 2 +- submodules/libSBML-dependencies | 2 +- 9 files changed, 53 insertions(+), 18 deletions(-) create mode 100755 dev/create-source-package.sh diff --git a/.gitignore b/.gitignore index 49b2efcf..57f3e075 100644 --- a/.gitignore +++ b/.gitignore @@ -173,6 +173,7 @@ libsedml/_* examples/python/*.xml dev/temp_deviser_file.xml setup.py +MANIFEST.in # documentation /doc/html/ diff --git a/CMakeModules/FindEXPAT.cmake b/CMakeModules/FindEXPAT.cmake index 4edad006..e3be96f2 100644 --- a/CMakeModules/FindEXPAT.cmake +++ b/CMakeModules/FindEXPAT.cmake @@ -48,11 +48,13 @@ find_path(EXPAT_INCLUDE_DIR expat.h /opt/csw/include # Blastwave /opt/include /usr/freeware/include - NO_DEFAULT_PATH) + NO_DEFAULT_PATH + CMAKE_FIND_ROOT_PATH_BOTH) endif () if (NOT EXPAT_INCLUDE_DIR) - find_path(EXPAT_INCLUDE_DIR expat.h) + find_path(EXPAT_INCLUDE_DIR expat.h + CMAKE_FIND_ROOT_PATH_BOTH) endif () find_library(EXPAT_LIBRARY @@ -81,11 +83,13 @@ find_library(EXPAT_LIBRARY /opt/csw/lib # Blastwave /opt/lib /usr/freeware/lib64 - NO_DEFAULT_PATH) + NO_DEFAULT_PATH + CMAKE_FIND_ROOT_PATH_BOTH) endif() if (NOT EXPAT_LIBRARY) - find_library(EXPAT_LIBRARY NAMES libexpat expat) + find_library(EXPAT_LIBRARY NAMES libexpat expat + CMAKE_FIND_ROOT_PATH_BOTH ) endif () mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) diff --git a/CMakeModules/FindLIBNUML.cmake b/CMakeModules/FindLIBNUML.cmake index 41107530..95898dc4 100644 --- a/CMakeModules/FindLIBNUML.cmake +++ b/CMakeModules/FindLIBNUML.cmake @@ -34,6 +34,7 @@ if (NOT ${LIBNUML_LIBRARY_NAME}_FOUND) ${CONAN_LIB_DIRS_LIBNUML}/cmake ${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake ${${_PROJECT_DEPENDENCY_DIR}}/lib64/cmake + CMAKE_FIND_ROOT_PATH_BOTH ) endif() @@ -90,7 +91,8 @@ find_path(LIBNUML_INCLUDE_DIR numl/NMBase.h /opt/csw/include # Blastwave /opt/include /usr/freeware/include - NO_DEFAULT_PATH) + NO_DEFAULT_PATH + CMAKE_FIND_ROOT_PATH_BOTH) if (NOT LIBNUML_INCLUDE_DIR) find_path(LIBNUML_INCLUDE_DIR numl/NMBase.h) @@ -117,7 +119,8 @@ find_library(LIBNUML_LIBRARY /opt/csw/lib # Blastwave /opt/lib /usr/freeware/lib64 - NO_DEFAULT_PATH) + NO_DEFAULT_PATH + CMAKE_FIND_ROOT_PATH_BOTH) if (NOT LIBNUML_LIBRARY) find_library(LIBNUML_LIBRARY diff --git a/CMakeModules/FindLIBSBML.cmake b/CMakeModules/FindLIBSBML.cmake index 580626fd..4dc922a7 100644 --- a/CMakeModules/FindLIBSBML.cmake +++ b/CMakeModules/FindLIBSBML.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the +# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the # University of Virginia, University of Heidelberg, and University # of Connecticut School of Medicine. # All rights reserved. @@ -33,11 +33,21 @@ endif() message (VERBOSE "Looking for ${LIBSBML_LIBRARY_NAME}") -find_package(${LIBSBML_LIBRARY_NAME} CONFIG QUIET) string(TOUPPER ${PROJECT_NAME} _UPPER_PROJECT_NAME) set(_PROJECT_DEPENDENCY_DIR ${_UPPER_PROJECT_NAME}_DEPENDENCY_DIR) +find_package(${LIBSBML_LIBRARY_NAME} CONFIG QUIET + PATHS ${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake + ${${_PROJECT_DEPENDENCY_DIR}}/lib64/cmake + ${CONAN_LIB_DIRS_LIBSBML}/cmake + CMAKE_FIND_ROOT_PATH_BOTH + NO_DEFAULT_PATH) + +if (NOT ${LIBSBML_LIBRARY_NAME}_FOUND) + find_package(${LIBSBML_LIBRARY_NAME} CONFIG QUIET) +endif() + if (NOT ${LIBSBML_LIBRARY_NAME}_FOUND) find_package(${LIBSBML_LIBRARY_NAME} CONFIG QUIET PATHS /usr/lib/cmake @@ -48,6 +58,7 @@ if (NOT ${LIBSBML_LIBRARY_NAME}_FOUND) ${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake ${${_PROJECT_DEPENDENCY_DIR}}/lib64/cmake ${CONAN_LIB_DIRS_LIBSBML}/cmake + CMAKE_FIND_ROOT_PATH_BOTH ) endif() @@ -111,6 +122,7 @@ find_path(LIBSBML_INCLUDE_DIR sbml/SBase.h /opt/csw/include # Blastwave /opt/include /usr/freeware/include + CMAKE_FIND_ROOT_PATH_BOTH NO_DEFAULT_PATH) if (NOT LIBSBML_INCLUDE_DIR) @@ -140,6 +152,7 @@ find_library(LIBSBML_LIBRARY /opt/csw/lib # Blastwave /opt/lib /usr/freeware/lib64 + CMAKE_FIND_ROOT_PATH_BOTH NO_DEFAULT_PATH) if (NOT LIBSBML_LIBRARY) diff --git a/dev/create-source-package.sh b/dev/create-source-package.sh new file mode 100755 index 00000000..befa0d85 --- /dev/null +++ b/dev/create-source-package.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# this script creates the python source package +cp ./src/bindings/python/setup.py . +cp ./src/bindings/python/MANIFEST.in . + +# remove old source packages +rm ./dist/*.tar.gz + +# create the source package +python3 setup.py sdist \ No newline at end of file diff --git a/src/bindings/python/setup.py b/src/bindings/python/setup.py index dfbd2fac..5fa77921 100644 --- a/src/bindings/python/setup.py +++ b/src/bindings/python/setup.py @@ -36,15 +36,18 @@ from setuptools import setup, Extension from setuptools.command.build_ext import build_ext -def get_python_include(): - dir = sysconfig.get_paths()['include'] - if exists(dir): - return dir - dir = dir.replace('/local', '/') - if exists(dir): - return dir +def get_python_include(): + temp = os.getenv('PYTHON_INCLUDE_DIR') + if temp: + return temp + + path = sysconfig.get_paths()['include'] + if exists(path): + return path + # for whatever reason 2.7 on centos returns a wrong path here return sysconfig.get_config_vars()['INCLUDEPY'] + def get_win_python_lib(): vars = sysconfig.get_config_vars() for k in ['prefix', 'installed_base', 'installed_platbase']: diff --git a/submodules/NuML b/submodules/NuML index 4c0f69d3..ac00cd34 160000 --- a/submodules/NuML +++ b/submodules/NuML @@ -1 +1 @@ -Subproject commit 4c0f69d395a11374d49f3c328229cd09a65abc4f +Subproject commit ac00cd349da12819eeb6b54a22e569374ff108d8 diff --git a/submodules/libSBML b/submodules/libSBML index 3a907f0e..6f35dde9 160000 --- a/submodules/libSBML +++ b/submodules/libSBML @@ -1 +1 @@ -Subproject commit 3a907f0e7d60a02dbf9809a682ff90a959d1437a +Subproject commit 6f35dde91649b3423225a51607bec888ef65d084 diff --git a/submodules/libSBML-dependencies b/submodules/libSBML-dependencies index 3b069caf..4fcc0de0 160000 --- a/submodules/libSBML-dependencies +++ b/submodules/libSBML-dependencies @@ -1 +1 @@ -Subproject commit 3b069caf743a0e2b3f916eddb5bc7889d2a4a96d +Subproject commit 4fcc0de0e5c24e8d0e36d9c85be6e2b78410273d