CI build fix

Updated cmake files to have find_package with Devlopment.Module to
             make build work both locally and from cibuildwheel.
        Added set Python_LIBRARIES="-Wl,--unresolved-symbols=ignore-all"
             in case when it is not set (in manylinux) as lipython not found.
        Added RPATH to be '$ORIGIN/libs:$ORIGIN' for all shared library
             be discoverable.
This commit is contained in:
Serge Rabyking 2023-05-30 21:02:07 +01:00
parent 4a547a1ade
commit 26f054eafa
35 changed files with 67 additions and 80 deletions

View File

@ -12,24 +12,40 @@ set(CORIOLIS_TMP_INSTALL_DIR ${CMAKE_BINARY_DIR}/install)
set(ENV{CORIOLIS_TOP} ${CORIOLIS_TMP_INSTALL_DIR})
function (build_coriolis_module target)
message("---------- Start building ${target} ----------")
set(build_dir ${CMAKE_BINARY_DIR}/build_${target})
file(MAKE_DIRECTORY ${build_dir} ${build_dir}/build)
file(WRITE ${build_dir}/CMakeLists.txt "
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(build_${target})
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module)
if(NOT Python_LIBRARIES)
set(Python_LIBRARIES \"-Wl,--unresolved-symbols=ignore-all\")
endif()
set(CXX_STANDARD \"-fPIC\")
if(NOT Python3_LIBRARIES)
set(Python3_LIBRARIES \"\${Python_LIBRARIES}\")
endif()
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/cmake_modules)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${target} ${build_dir})
")
execute_process(COMMAND ${CMAKE_COMMAND} ${build_dir}
-D CMAKE_BUILD_TYPE=Release
execute_process(
COMMAND ${CMAKE_COMMAND} ${build_dir}
-D CMAKE_BUILD_TYPE:STRING=Release
-D CMAKE_INSTALL_PREFIX:PATH=${CORIOLIS_TMP_INSTALL_DIR}
-D "PYTHON_INCLUDE_DIR=\$(python -c \"from distutils.sysconfig import get_python_inc\; print(get_python_inc())\")"
-D "PYTHON_LIBRARY=\$(python -c \"import distutils.sysconfig as sysconfig\; print(sysconfig.get_config_var('LIBDIR'))\")"
-D PYTHON_EXECUTABLE:FILEPATH=`which python`
-D CMAKE_BUILD_RPATH_USE_ORIGIN:BOOL=TRUE
-D CMAKE_SKIP_BUILD_RPATH:BOOL=FALSE
-D CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=FALSE
-D CMAKE_INSTALL_RPATH:STRING='$ORIGIN/libs:$ORIGIN'
-D CMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=TRUE
-G "${CMAKE_GENERATOR}"
WORKING_DIRECTORY ${build_dir}/build
RESULT_VARIABLE ${target}_setup_result
@ -95,35 +111,6 @@ endfunction()
set(CORIOLIS_EXTRAS_DIR ${CMAKE_BINARY_DIR}/extras)
file(MAKE_DIRECTORY ${CORIOLIS_EXTRAS_DIR})
file(WRITE ${CORIOLIS_EXTRAS_DIR}/__init__.py
"import .libs
"
)
file(READ ${CORIOLIS_PACKAGE_SRCDIR}/__init__.py CORIOLIS_INIT_PY)
file(APPEND ${CORIOLIS_EXTRAS_DIR}/__init__.py "${CORIOLIS_INIT_PY}")
file(WRITE ${CORIOLIS_EXTRAS_DIR}/libs/__init__.py
"import os, os.path, ctypes
__libs=[]
def _preload_shared_libraries(dirname):
libs = []
for name in os.listdir(dirname):
if name.endswith('.so'):
libs.append(os.path.join(dirname,name))
nload = len(libs)
while nload > 0:
name=libs.pop(0)
try:
lib=ctypes.CDLL(name)
__libs.append(lib)
nload = len(libs)
except OSError:
libs.append(name)
nload -= 1
_preload_shared_libraries(os.path.dirname(os.path.realpath(__file__)))
"
)
# Put all extra python things into ${CORIOLIS_EXTRAS_DIR} directory
coriolis_install_all(${CORIOLIS_PACKAGE_SRCDIR} ${CORIOLIS_EXTRAS_DIR})

View File

@ -20,7 +20,7 @@
setup_qt()
find_package(Libexecinfo REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(FLUTE REQUIRED)

View File

@ -19,7 +19,7 @@
setup_boost()
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(FLUTE REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -14,7 +14,7 @@ endif ( CHECK_DETERMINISM )
${QtX_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
set( includes anabatic/Constants.h
anabatic/Configuration.h
anabatic/Matrix.h
@ -91,7 +91,7 @@ endif ( CHECK_DETERMINISM )
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
${Python3_LIBRARIES}
${Python_LIBRARIES}
-lutil
)

View File

@ -12,7 +12,7 @@
list(INSERT CMAKE_MODULE_PATH 0 "${Bootstrap_SOURCE_DIR}/cmake_modules/")
find_package(Bootstrap REQUIRED)
# find_package(Python 3 REQUIRED COMPONENTS Interpreter Development )
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development )
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
print_cmake_module_path()

View File

@ -84,10 +84,10 @@
set(DEBUG_FLAGS "-g")
if(CYGWIN)
set(ADDITIONAL_FLAGS "-D_GLIBCXX_USE_C99")
set(CXX_STANDARD "gnu++11 -fPIC")
set(CXX_STANDARD "gnu++11 ${CXX_STANDARD}")
else()
set(ADDITIONAL_FLAGS "-Wl,--no-undefined")
set(CXX_STANDARD "c++11 -fPIC")
set(CXX_STANDARD "c++11 ${CXX_STANDARD}")
endif()
#set(CMAKE_C_FLAGS_DEBUG " -Wall -fsanitize=address ${ADDITIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
set(CMAKE_C_FLAGS_DEBUG " -Wall ${ADDITIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)

View File

@ -20,7 +20,7 @@
setup_qwt()
find_package(Libexecinfo REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(FLUTE REQUIRED)

View File

@ -28,7 +28,7 @@
find_package(Libbfd)
endif()
find_package(BZip2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)

View File

@ -1,6 +1,6 @@
# -*- explicit-buffer-name: "CMakeLists.txt<crlcore/src/ccore/cyclop>" -*-
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
include_directories ( ${CRLCORE_SOURCE_DIR}/src/ccore
${HURRICANE_INCLUDE_DIR}
${UTILITIES_INCLUDE_DIR}
@ -32,7 +32,7 @@
${OA_LIBRARIES}
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${Python_LIBRARIES}
${Python_LIBRARIES}
-lutil
${LIBXML2_LIBRARIES}
${BZIP2_LIBRARIES}

View File

@ -32,7 +32,7 @@
-lutil
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
add_definitions( -DCORIOLIS_TOP="${CORIOLIS_TOP}"
-DSYS_CONF_DIR="${SYS_CONF_DIR}"
@ -98,7 +98,7 @@
${HURRICANE_LIBRARIES}
${LEFDEF_LIBRARIES}
${QtX_LIBRARIES}
${Python3_LIBRARIES}
${Python_LIBRARIES}
-lutil
)

View File

@ -1,7 +1,7 @@
# -*- explicit-buffer-name: "CMakeLists.txt<crlcore/src/x2y> -*-
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
include_directories ( ${CRLCORE_SOURCE_DIR}/src/ccore
${HURRICANE_INCLUDE_DIR}
${UTILITIES_INCLUDE_DIR}
@ -22,7 +22,7 @@
${OA_LIBRARIES}
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${Python_LIBRARIES}
${Python_LIBRARIES}
-lutil
${LIBXML2_LIBRARIES}
${BZIP2_LIBRARIES}

View File

@ -15,7 +15,7 @@
set_cmake_policies()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -19,7 +19,7 @@
setup_boost(program_options)
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(FLUTE REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -19,7 +19,7 @@
setup_boost(program_options)
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(FLUTE REQUIRED)
find_package(LEFDEF REQUIRED)

View File

@ -15,7 +15,7 @@
setup_boost(program_options)
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -14,7 +14,7 @@
set_cmake_policies()
setup_boost()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -14,7 +14,7 @@
setup_boost(program_options)
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -18,7 +18,7 @@
setup_boost(program_options python)
find_package(LibXml2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)

View File

@ -18,7 +18,7 @@
set_cmake_policies()
setup_boost(program_options)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
#find_package(KATABATIC REQUIRED)

View File

@ -10,7 +10,7 @@
${Boost_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
set( includes etesian/Configuration.h
etesian/Placement.h
etesian/FeedCells.h
@ -59,7 +59,7 @@
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
${Python3_LIBRARIES}
${Python_LIBRARIES}
-lutil
${LIBEXECINFO_LIBRARIES}
)

View File

@ -17,7 +17,7 @@
check_distribution()
setup_sysconfdir( "${CMAKE_INSTALL_PREFIX}" )
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -6,7 +6,7 @@
${CONFIGURATION_INCLUDE_DIR}
${Python_INCLUDE_DIRS}
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
set( includes flute.h
dl.h
@ -34,7 +34,7 @@
${HURRICANE_PYTHON_LIBRARIES}
${HURRICANE_LIBRARIES}
${UTILITIES_LIBRARY}
${Python3_LIBRARIES}
${Python_LIBRARIES}
-lutil
)

View File

@ -20,7 +20,7 @@
setup_qt()
find_package(Libexecinfo REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(FLUTE REQUIRED)

View File

@ -24,7 +24,7 @@
find_package(BZip2 REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development )
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(Libexecinfo REQUIRED)
if (USE_LIBBFD)

View File

@ -8,7 +8,7 @@
${Boost_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
set( pyCpps ProxyProperty.cpp
PythonAttributes.cpp
PyBreakpoint.cpp
@ -168,7 +168,7 @@
)
set( depLibs hurricane
${Python3_LIBRARIES}
${Python_LIBRARIES}
${Boost_LIBRARIES}
)

View File

@ -17,7 +17,7 @@
set(QT_USE_QTXML "true")
find_package(Qt4 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -15,7 +15,7 @@
check_distribution()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -20,7 +20,7 @@
setup_qt()
find_package(Libexecinfo REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(FLUTE REQUIRED)

View File

@ -12,7 +12,7 @@
${Boost_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
)
find_package (Python3 COMPONENTS Interpreter Development)
find_package (Python 3 COMPONENTS Interpreter Development.Module )
set( includes katana/Constants.h
katana/Block.h
katana/TrackCost.h
@ -110,7 +110,7 @@
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
${Python3_LIBRARIES}
${Python_LIBRARIES}
-lutil
${LIBEXECINFO_LIBRARIES}
)

View File

@ -18,7 +18,7 @@
if (USE_LIBBFD)
find_package(Libbfd)
endif()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -50,7 +50,7 @@ build-backend = "scikit_build_core.build"
[tool.scikit-build]
# The PEP 517 build hooks will add ninja and/or cmake if the versions on the
# system are not at least these versions. Disabled by an empty string.
cmake.minimum-version = "3.15"
cmake.minimum-version = "3.16"
ninja.minimum-version = "1.5"
# Fallback on gmake/make if available and ninja is missing (Unix). Will only
@ -105,7 +105,7 @@ wheel.license-files = ["LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*"]
# This will backport an internal copy of FindPython if CMake is less than this
# value. Set to 0 or the empty string to disable. The default will be kept in
# sync with the version of FindPython stored in scikit-build-core.
backport.find-python = "3.26.1"
backport.find-python = ""
# This is the only editable mode currently
editable.mode = "redirect"

View File

@ -19,7 +19,7 @@
cmake_policy(SET CMP0002 OLD)
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -19,7 +19,7 @@
setup_qt()
find_package(Libexecinfo REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -24,7 +24,7 @@
find_package(Libbfd)
endif()
find_package(BZip2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(COLOQUINTE)

View File

@ -27,7 +27,7 @@
endif()
find_package(Libexecinfo REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module )
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF)
find_package(HURRICANE REQUIRED)