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.ctestArgs": ["--test-dir build", "--output-on-failure"],
|
||||||
"cmake.installPrefix": "output",
|
"cmake.installPrefix": "output",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"conanfile",
|
||||||
"coredll",
|
"coredll",
|
||||||
"DCMAKE",
|
"DCMAKE",
|
||||||
"debool",
|
"debool",
|
||||||
|
|
|
@ -15,12 +15,6 @@ option(CC_UseSanitizers "Use sanitizers" FALSE)
|
||||||
## Compiler options
|
## Compiler options
|
||||||
include(cmake/CXXTargets.cmake)
|
include(cmake/CXXTargets.cmake)
|
||||||
|
|
||||||
## Import internal targets
|
|
||||||
add_subdirectory(cclCommons)
|
|
||||||
add_subdirectory(cclGraph)
|
|
||||||
add_subdirectory(cclLang)
|
|
||||||
add_subdirectory(rslang)
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## Project Setup
|
## Project Setup
|
||||||
##
|
##
|
||||||
|
@ -92,6 +86,11 @@ install(TARGETS ${PROJECT_NAME}
|
||||||
install(DIRECTORY core/include/ DESTINATION include)
|
install(DIRECTORY core/include/ DESTINATION include)
|
||||||
|
|
||||||
if(CC_BuildTests)
|
if(CC_BuildTests)
|
||||||
|
add_subdirectory(cclCommons)
|
||||||
|
add_subdirectory(cclGraph)
|
||||||
|
add_subdirectory(cclLang)
|
||||||
|
add_subdirectory(rslang)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory("core/test")
|
add_subdirectory("core/test")
|
||||||
endif()
|
endif()
|
|
@ -5,4 +5,5 @@ graft tests
|
||||||
graft cmake
|
graft cmake
|
||||||
|
|
||||||
include CMakeLists.txt
|
include CMakeLists.txt
|
||||||
|
include conanfile.txt
|
||||||
recursive-include ccl *
|
recursive-include ccl *
|
|
@ -1,4 +1,3 @@
|
||||||
# pyconcept
|
# 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",
|
"setuptools",
|
||||||
"wheel",
|
"wheel",
|
||||||
"ninja",
|
"ninja",
|
||||||
"cmake"
|
"cmake",
|
||||||
|
"conan"
|
||||||
]
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
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'
|
$packageName = 'pyconcept'
|
||||||
$output = "${PSScriptRoot}\..\..\output\py\${packageName}"
|
$output = "${PSScriptRoot}\..\..\output\py\${packageName}"
|
||||||
$python = '.\venv\Scripts\python.exe'
|
$python = '.\venv\Scripts\python.exe'
|
||||||
$conan = '.\venv\Scripts\conan.exe'
|
|
||||||
|
|
||||||
$ccl_source = "${PSScriptRoot}\..\..\ccl"
|
$ccl_source = "${PSScriptRoot}\..\..\ccl"
|
||||||
$ccl_destination = "${PSScriptRoot}\..\ccl"
|
$ccl_destination = "${PSScriptRoot}\..\ccl"
|
||||||
$ccl_exclude = @('*.vcxproj*','*packages.config','CMakeUserPresets.json')
|
$ccl_include = ('*.cpp','*.hpp','*.h')
|
||||||
|
|
||||||
function Build {
|
function Build {
|
||||||
# PrepareEnv
|
PrepareEnv
|
||||||
PrepareImports
|
PrepareImports
|
||||||
PrepareOutput
|
PrepareOutput
|
||||||
BuildProject
|
BuildProject
|
||||||
|
@ -28,7 +27,7 @@ function PrepareEnv {
|
||||||
if (-not (Test-Path -Path ${python} -PathType Leaf)) {
|
if (-not (Test-Path -Path ${python} -PathType Leaf)) {
|
||||||
& 'python' -m venv .\venv
|
& 'python' -m venv .\venv
|
||||||
& $python -m pip install --upgrade pip
|
& $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
|
New-Item -Path ${ccl_destination} -ItemType Directory | Out-Null
|
||||||
$source = Resolve-Path(${ccl_source})
|
$source = Resolve-Path(${ccl_source})
|
||||||
$destination = Resolve-Path(${ccl_destination})
|
$destination = Resolve-Path(${ccl_destination})
|
||||||
Get-ChildItem ${source} -Recurse -Exclude ${ccl_exclude} `
|
Get-ChildItem ${source} -Recurse -Include ${ccl_include} `
|
||||||
| Where-Object -Property 'FullName' -CNotLike '*build*' `
|
| Where-Object { `
|
||||||
| Copy-Item -Destination {Join-Path ${destination}.Path $_.FullName.Substring(${source}.Path.length)}
|
$_.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 {
|
function PrepareOutput {
|
||||||
|
@ -53,11 +63,9 @@ function PrepareOutput {
|
||||||
}
|
}
|
||||||
|
|
||||||
function BuildProject {
|
function BuildProject {
|
||||||
Write-Host 'Configuring Conan...' -ForegroundColor DarkGreen
|
|
||||||
& ${conan} profile detect --force
|
|
||||||
& ${conan} install .
|
|
||||||
Write-Host 'Building project...' -ForegroundColor DarkGreen
|
Write-Host 'Building project...' -ForegroundColor DarkGreen
|
||||||
& $python -m build --wheel --no-isolation --outdir="${output}"
|
& $python -m build --wheel --no-isolation --outdir="${output}"
|
||||||
|
& $python -m build --sdist --no-isolation --outdir="${output}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestWheel([string] $wheelPath) {
|
function TestWheel([string] $wheelPath) {
|
||||||
|
|
|
@ -4,19 +4,19 @@ version = file: VERSION
|
||||||
author = CIHT CONCEPT, IRBorisov
|
author = CIHT CONCEPT, IRBorisov
|
||||||
author_email = iborisov@acconcept.ru
|
author_email = iborisov@acconcept.ru
|
||||||
description = Concept core Python wrapper
|
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
|
license = MIT
|
||||||
classifiers =
|
classifiers =
|
||||||
Development Status :: 3 - Alpha
|
Development Status :: 3 - Alpha
|
||||||
Intended Audience :: Developers
|
Intended Audience :: Developers
|
||||||
Intended Audience :: Science/Research
|
Intended Audience :: Science/Research
|
||||||
License :: OSI Approved :: MIT License
|
License :: OSI Approved :: MIT License
|
||||||
Natural Language :: Russian
|
|
||||||
Programming Language :: Python
|
Programming Language :: Python
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.12
|
Programming Language :: Python :: 3.12
|
||||||
Topic :: Software Development :: Libraries :: Python Modules
|
Topic :: Software Development :: Libraries :: Python Modules
|
||||||
Topic :: Scientific/Engineering :: Information Analysis
|
|
||||||
Topic :: Text Processing :: Linguistic
|
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
packages = find:
|
packages = find:
|
|
@ -22,15 +22,15 @@ class CMakeExtension(Extension):
|
||||||
'''
|
'''
|
||||||
def __init__(self, name: str, source: str = '') -> None:
|
def __init__(self, name: str, source: str = '') -> None:
|
||||||
super().__init__(name, sources=[])
|
super().__init__(name, sources=[])
|
||||||
self.sourcedir = os.fspath(Path(source).resolve())
|
self.source_dir = os.fspath(Path(source).resolve())
|
||||||
|
|
||||||
|
|
||||||
class CMakeBuild(build_ext):
|
class CMakeBuild(build_ext):
|
||||||
'''CMake builder extension.'''
|
'''CMake builder extension.'''
|
||||||
|
|
||||||
def build_extension(self, ext: CMakeExtension) -> None:
|
def build_extension(self, target: CMakeExtension) -> None:
|
||||||
ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name)
|
target_fullpath = Path.cwd() / self.get_ext_fullpath(target.name)
|
||||||
output_folder = ext_fullpath.parent.resolve()
|
output_folder = target_fullpath.parent.resolve()
|
||||||
|
|
||||||
debug_flag = int(os.environ.get('DEBUG', 0)) if self.debug is None else self.debug
|
debug_flag = int(os.environ.get('DEBUG', 0)) if self.debug is None else self.debug
|
||||||
build_type = 'Debug' if debug_flag else 'Release'
|
build_type = 'Debug' if debug_flag else 'Release'
|
||||||
|
@ -58,7 +58,7 @@ class CMakeBuild(build_ext):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# Single config generators are handled "normally"
|
# 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
|
# CMake allows an arch-in-generator style for backward compatibility
|
||||||
contains_arch = any(x in cmake_generator for x in ['ARM', 'Win64'])
|
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:
|
if hasattr(self, 'parallel') and self.parallel:
|
||||||
build_args += [f"-j{self.parallel}"]
|
build_args += [f"-j{self.parallel}"]
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(['conan', 'profile', 'detect', '--force'], check=True)
|
||||||
['cmake', ext.sourcedir, *cmake_args],
|
subprocess.run(['conan', 'install', '.'], check=True)
|
||||||
check=True
|
subprocess.run(['cmake', target.source_dir, *cmake_args], check=True)
|
||||||
)
|
subprocess.run(['cmake', '--build', '.', *build_args], check=True)
|
||||||
subprocess.run(
|
|
||||||
['cmake', '--build', '.', *build_args],
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user