mirror of
https://github.com/IRBorisov/ConceptCore.git
synced 2025-06-26 01:00:36 +03:00
Prepare pyconcept Windows package build
This commit is contained in:
parent
843718b4a3
commit
a20102800e
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -16,6 +16,7 @@
|
|||
"cmake.ctestArgs": ["--test-dir build", "--output-on-failure"],
|
||||
"cmake.installPrefix": "output",
|
||||
"cSpell.words": [
|
||||
"conanfile",
|
||||
"coredll",
|
||||
"DCMAKE",
|
||||
"debool",
|
||||
|
|
|
@ -15,12 +15,6 @@ option(CC_UseSanitizers "Use sanitizers" FALSE)
|
|||
## Compiler options
|
||||
include(cmake/CXXTargets.cmake)
|
||||
|
||||
## Import internal targets
|
||||
add_subdirectory(cclCommons)
|
||||
add_subdirectory(cclGraph)
|
||||
add_subdirectory(cclLang)
|
||||
add_subdirectory(rslang)
|
||||
|
||||
##
|
||||
## Project Setup
|
||||
##
|
||||
|
@ -92,6 +86,11 @@ install(TARGETS ${PROJECT_NAME}
|
|||
install(DIRECTORY core/include/ DESTINATION include)
|
||||
|
||||
if(CC_BuildTests)
|
||||
add_subdirectory(cclCommons)
|
||||
add_subdirectory(cclGraph)
|
||||
add_subdirectory(cclLang)
|
||||
add_subdirectory(rslang)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory("core/test")
|
||||
endif()
|
|
@ -5,4 +5,5 @@ graft tests
|
|||
graft cmake
|
||||
|
||||
include CMakeLists.txt
|
||||
include conanfile.txt
|
||||
recursive-include ccl *
|
|
@ -1,4 +1,3 @@
|
|||
# pyconcept
|
||||
|
||||
Python wrapepr for C++ library for manipulating concepts in formal language of advanced set theory
|
||||
|
||||
Python wrapper for C++ library for manipulating concepts in formal language of advanced set theory
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.4.0
|
||||
0.1.0
|
|
@ -3,6 +3,7 @@ requires = [
|
|||
"setuptools",
|
||||
"wheel",
|
||||
"ninja",
|
||||
"cmake"
|
||||
"cmake",
|
||||
"conan"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
BIN
pyconcept/requirements-dev.txt
Normal file
BIN
pyconcept/requirements-dev.txt
Normal file
Binary file not shown.
|
@ -3,14 +3,13 @@ Set-Location $PSScriptRoot\..
|
|||
$packageName = 'pyconcept'
|
||||
$output = "${PSScriptRoot}\..\..\output\py\${packageName}"
|
||||
$python = '.\venv\Scripts\python.exe'
|
||||
$conan = '.\venv\Scripts\conan.exe'
|
||||
|
||||
$ccl_source = "${PSScriptRoot}\..\..\ccl"
|
||||
$ccl_destination = "${PSScriptRoot}\..\ccl"
|
||||
$ccl_exclude = @('*.vcxproj*','*packages.config','CMakeUserPresets.json')
|
||||
$ccl_include = ('*.cpp','*.hpp','*.h')
|
||||
|
||||
function Build {
|
||||
# PrepareEnv
|
||||
PrepareEnv
|
||||
PrepareImports
|
||||
PrepareOutput
|
||||
BuildProject
|
||||
|
@ -28,7 +27,7 @@ function PrepareEnv {
|
|||
if (-not (Test-Path -Path ${python} -PathType Leaf)) {
|
||||
& 'python' -m venv .\venv
|
||||
& $python -m pip install --upgrade pip
|
||||
& $python -m pip install -r requirements-build.txt
|
||||
& $python -m pip install -r requirements-dev.txt
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,9 +39,20 @@ function PrepareImports {
|
|||
New-Item -Path ${ccl_destination} -ItemType Directory | Out-Null
|
||||
$source = Resolve-Path(${ccl_source})
|
||||
$destination = Resolve-Path(${ccl_destination})
|
||||
Get-ChildItem ${source} -Recurse -Exclude ${ccl_exclude} `
|
||||
| Where-Object -Property 'FullName' -CNotLike '*build*' `
|
||||
| Copy-Item -Destination {Join-Path ${destination}.Path $_.FullName.Substring(${source}.Path.length)}
|
||||
Get-ChildItem ${source} -Recurse -Include ${ccl_include} `
|
||||
| Where-Object { `
|
||||
$_.FullName -CNotLike '*build*' -And `
|
||||
$_.FullName -CNotLike '*test*' `
|
||||
} `
|
||||
| ForEach-Object -Begin{} -End{} -Process{
|
||||
$destinationFile = Join-Path ${destination}.Path $_.FullName.Substring(${source}.Path.length)
|
||||
New-Item -ItemType File -Path ${destinationFile} -Force | Out-Null
|
||||
Copy-Item -Path $_.FullName -Destination ${destinationFile} -Force
|
||||
}
|
||||
|
||||
Copy-Item -Path "${source}/CMakeLists.txt" -Destination ${destination}
|
||||
Copy-Item -Path "${source}/conanfile.txt" -Destination ${destination}
|
||||
Copy-Item -Path "${source}/cmake" -Destination ${destination} -Recurse
|
||||
}
|
||||
|
||||
function PrepareOutput {
|
||||
|
@ -53,11 +63,9 @@ function PrepareOutput {
|
|||
}
|
||||
|
||||
function BuildProject {
|
||||
Write-Host 'Configuring Conan...' -ForegroundColor DarkGreen
|
||||
& ${conan} profile detect --force
|
||||
& ${conan} install .
|
||||
Write-Host 'Building project...' -ForegroundColor DarkGreen
|
||||
& $python -m build --wheel --no-isolation --outdir="${output}"
|
||||
& $python -m build --sdist --no-isolation --outdir="${output}"
|
||||
}
|
||||
|
||||
function TestWheel([string] $wheelPath) {
|
||||
|
|
|
@ -4,19 +4,19 @@ version = file: VERSION
|
|||
author = CIHT CONCEPT, IRBorisov
|
||||
author_email = iborisov@acconcept.ru
|
||||
description = Concept core Python wrapper
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
url = https://github.com/IRBorisov/ConceptCore/tree/main/pyconcept
|
||||
license = MIT
|
||||
classifiers =
|
||||
Development Status :: 3 - Alpha
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: Science/Research
|
||||
License :: OSI Approved :: MIT License
|
||||
Natural Language :: Russian
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.12
|
||||
Topic :: Software Development :: Libraries :: Python Modules
|
||||
Topic :: Scientific/Engineering :: Information Analysis
|
||||
Topic :: Text Processing :: Linguistic
|
||||
|
||||
[options]
|
||||
packages = find:
|
|
@ -22,15 +22,15 @@ class CMakeExtension(Extension):
|
|||
'''
|
||||
def __init__(self, name: str, source: str = '') -> None:
|
||||
super().__init__(name, sources=[])
|
||||
self.sourcedir = os.fspath(Path(source).resolve())
|
||||
self.source_dir = os.fspath(Path(source).resolve())
|
||||
|
||||
|
||||
class CMakeBuild(build_ext):
|
||||
'''CMake builder extension.'''
|
||||
|
||||
def build_extension(self, ext: CMakeExtension) -> None:
|
||||
ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name)
|
||||
output_folder = ext_fullpath.parent.resolve()
|
||||
def build_extension(self, target: CMakeExtension) -> None:
|
||||
target_fullpath = Path.cwd() / self.get_ext_fullpath(target.name)
|
||||
output_folder = target_fullpath.parent.resolve()
|
||||
|
||||
debug_flag = int(os.environ.get('DEBUG', 0)) if self.debug is None else self.debug
|
||||
build_type = 'Debug' if debug_flag else 'Release'
|
||||
|
@ -58,7 +58,7 @@ class CMakeBuild(build_ext):
|
|||
pass
|
||||
else:
|
||||
# Single config generators are handled "normally"
|
||||
single_config = any(x in cmake_generator for x in ['NMake', 'Ninja'])
|
||||
single_config = any(x in cmake_generator for x in ['N~Make', 'Ninja'])
|
||||
|
||||
# CMake allows an arch-in-generator style for backward compatibility
|
||||
contains_arch = any(x in cmake_generator for x in ['ARM', 'Win64'])
|
||||
|
@ -80,14 +80,10 @@ class CMakeBuild(build_ext):
|
|||
if hasattr(self, 'parallel') and self.parallel:
|
||||
build_args += [f"-j{self.parallel}"]
|
||||
|
||||
subprocess.run(
|
||||
['cmake', ext.sourcedir, *cmake_args],
|
||||
check=True
|
||||
)
|
||||
subprocess.run(
|
||||
['cmake', '--build', '.', *build_args],
|
||||
check=True
|
||||
)
|
||||
subprocess.run(['conan', 'profile', 'detect', '--force'], check=True)
|
||||
subprocess.run(['conan', 'install', '.'], check=True)
|
||||
subprocess.run(['cmake', target.source_dir, *cmake_args], check=True)
|
||||
subprocess.run(['cmake', '--build', '.', *build_args], check=True)
|
||||
|
||||
|
||||
setup(
|
||||
|
|
Loading…
Reference in New Issue
Block a user