diff --git a/.vscode/settings.json b/.vscode/settings.json index 69f2595..eecda43 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ "cmake.ctestArgs": ["--test-dir build", "--output-on-failure"], "cmake.installPrefix": "output", "cSpell.words": [ + "conanfile", "coredll", "DCMAKE", "debool", diff --git a/ccl/CMakeLists.txt b/ccl/CMakeLists.txt index 39e370a..f561ff1 100644 --- a/ccl/CMakeLists.txt +++ b/ccl/CMakeLists.txt @@ -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() \ No newline at end of file diff --git a/pyconcept/MANIFEST.in b/pyconcept/MANIFEST.in index 0f2b8ed..f6c3482 100644 --- a/pyconcept/MANIFEST.in +++ b/pyconcept/MANIFEST.in @@ -5,4 +5,5 @@ graft tests graft cmake include CMakeLists.txt +include conanfile.txt recursive-include ccl * \ No newline at end of file diff --git a/pyconcept/README.md b/pyconcept/README.md index 7ba845f..f1c1fea 100644 --- a/pyconcept/README.md +++ b/pyconcept/README.md @@ -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 diff --git a/pyconcept/VERSION b/pyconcept/VERSION index e21e727..6c6aa7c 100644 --- a/pyconcept/VERSION +++ b/pyconcept/VERSION @@ -1 +1 @@ -1.4.0 \ No newline at end of file +0.1.0 \ No newline at end of file diff --git a/pyconcept/pyproject.toml b/pyconcept/pyproject.toml index 6c6d2b5..c1d8afc 100644 --- a/pyconcept/pyproject.toml +++ b/pyconcept/pyproject.toml @@ -3,6 +3,7 @@ requires = [ "setuptools", "wheel", "ninja", - "cmake" + "cmake", + "conan" ] build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/pyconcept/requirements-dev.txt b/pyconcept/requirements-dev.txt new file mode 100644 index 0000000..05d2db3 Binary files /dev/null and b/pyconcept/requirements-dev.txt differ diff --git a/pyconcept/scripts/Build.ps1 b/pyconcept/scripts/Build.ps1 index efb1193..965ecbb 100644 --- a/pyconcept/scripts/Build.ps1 +++ b/pyconcept/scripts/Build.ps1 @@ -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) { diff --git a/pyconcept/setup.cfg b/pyconcept/setup.cfg index 28a18bc..d3f7b62 100644 --- a/pyconcept/setup.cfg +++ b/pyconcept/setup.cfg @@ -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: \ No newline at end of file diff --git a/pyconcept/setup.py b/pyconcept/setup.py index af14333..c5853f2 100644 --- a/pyconcept/setup.py +++ b/pyconcept/setup.py @@ -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(