Skip to content

Commit 92573b2

Browse files
committed
Initial commit
0 parents  commit 92573b2

File tree

11 files changed

+2646
-0
lines changed

11 files changed

+2646
-0
lines changed

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This project
2+
castxml/data/*
3+
_skbuild
4+
MANIFEST
5+
6+
# Python
7+
*.py[cod]
8+
9+
# C extensions
10+
*.so
11+
12+
# Packages
13+
*.egg
14+
*.eggs
15+
*.egg-info
16+
dist
17+
build
18+
_skbuild
19+
eggs
20+
parts
21+
bin
22+
var
23+
sdist
24+
develop-eggs
25+
.installed.cfg
26+
lib
27+
lib64
28+
29+
# Installer logs
30+
pip-log.txt
31+
32+
# Unit test / coverage reports
33+
.cache
34+
.coverage
35+
.pytest_cache
36+
.tox
37+
coverage.xml
38+
htmlcov
39+
40+
# Translations
41+
*.mo
42+
43+
# Mr Developer
44+
.mr.developer.cfg
45+
.project
46+
.pydevproject
47+
48+
# Complexity
49+
output/*.html
50+
output/*/index.html
51+
52+
# IDE junk
53+
.idea/*
54+
*.swp

CMakeLists.txt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
cmake_minimum_required(VERSION 3.17)
2+
3+
project(CastXMLPythonDistributions)
4+
5+
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
6+
7+
# Options
8+
set(ARCHIVE_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to download archives")
9+
10+
include(CastXMLUrls)
11+
12+
#-----------------------------------------------------------------------------
13+
# Which archives ?
14+
#-----------------------------------------------------------------------------
15+
function(check_archive_var archive_var)
16+
if(NOT DEFINED "${archive_var}_url")
17+
message(FATAL_ERROR "Failed to determine which archive to download: '${archive_var}_url' variable is not defined")
18+
endif()
19+
if(NOT DEFINED "${archive_var}_sha512")
20+
message(FATAL_ERROR "Could you make sure variable '${archive_var}_sha512' is defined ?")
21+
endif()
22+
endfunction()
23+
24+
set(binary_archive "linux32_binary")
25+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
26+
set(binary_archive "linux64_binary")
27+
endif()
28+
if(APPLE)
29+
set(binary_archive "macosx_binary")
30+
endif()
31+
if(WIN32)
32+
set(binary_archive "win32_binary")
33+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
34+
set(binary_archive "win64_binary")
35+
endif()
36+
endif()
37+
check_archive_var("${binary_archive}")
38+
39+
#-----------------------------------------------------------------------------
40+
# Summary
41+
#-----------------------------------------------------------------------------
42+
message(STATUS "*********************************************")
43+
message(STATUS "CastXML Python Distribution")
44+
message(STATUS "")
45+
message(STATUS " ARCHIVE_DOWNLOAD_DIR : ${ARCHIVE_DOWNLOAD_DIR}")
46+
message(STATUS "")
47+
message(STATUS " src_archive : ${src_archive}")
48+
message(STATUS " <src_archive>_url : ${${src_archive}_url}")
49+
message(STATUS " <src_archive>_sha256 : ${${src_archive}_sha512}")
50+
message(STATUS "")
51+
message(STATUS "*********************************************")
52+
53+
#-----------------------------------------------------------------------------
54+
# Download pre-built archive
55+
#-----------------------------------------------------------------------------
56+
include(FetchContent)
57+
FetchContent_Populate(castxmlrelease
58+
URL ${${binary_archive}_url}
59+
URL_HASH SHA512=${${binary_archive}_sha512}
60+
)
61+
set(CASTXML_RELEASE_DIR ${castxmlrelease_SOURCE_DIR})
62+
63+
set(castxml_executable ${CASTXML_RELEASE_DIR}/bin/castxml${CMAKE_EXECUTABLE_SUFFIX})
64+
65+
install(PROGRAMS ${castxml_executable} DESTINATION castxml/data/bin)

CastXMLUrls.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#-----------------------------------------------------------------------------
2+
# CastXML binaries
3+
set(linux32_binary_url "NA") # Linux 32-bit binaries not available
4+
set(linux32_binary_sha512 "NA")
5+
6+
set(linux64_binary_url "https://data.kitware.com/api/v1/file/5ee7eb659014a6d84ec1f25e/download")
7+
set(linux64_binary_sha512 "a3c929ebd652fd159709826e154d566235fb12903dac04070854e83abf0e091ae369421b83699d4d78d4334ce1c5b7c9fda5f90e0c8e31170b7e902273eb4a09")
8+
9+
set(macosx_binary_url "https://data.kitware.com/api/v1/file/5ee7eb5c9014a6d84ec1f240/download")
10+
set(macosx_binary_sha512 "0ba8deff17b3a8f5a2cd22939ff83a864629201d8b881e44d7ed01d0fd2aa578338e3319e402c226b3648a6027a4538e8c4cd066d6fe2c49eb1a4471e803b827")
11+
12+
set(win32_binary_url "NA") # Windows 32-bit binaries not available
13+
set(win32_binary_sha512 "NA")
14+
15+
set(win64_binary_url "https://data.kitware.com/api/v1/file/5ee7eb539014a6d84ec1f22a/download")
16+
set(win64_binary_sha512 "fa7a38dbdb71e0484cfeb255aef6d085abf23496a85051e3dccac593d9eec042fad5be72110d7f3528b424d90fbf5b5053c31f054470d691a7109c1f13776229")

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# CastXML
2+
3+
Introduction
4+
============
5+
6+
CastXML is a C-family abstract syntax tree XML output tool.
7+
8+
This project is maintained by [Kitware][kitware] in support of [ITK][itk],
9+
the Insight Segmentation and Registration Toolkit.
10+
11+
[kitware]: https://www.kitware.com/
12+
[itk]: https://itk.org/
13+
14+
Manual
15+
======
16+
17+
See the [castxml(1)][manual] manual page for instructions to run the tool.
18+
19+
[manual]: https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst#castxml1
20+
21+
License
22+
=======
23+
24+
CastXML is licensed under the [Apache License, Version 2.0][apache-license-2.0].
25+
See the [LICENSE][license] and [NOTICE][notice] files for details.
26+
27+
[apache-license-2.0]: https://www.apache.org/licenses/LICENSE-2.0
28+
[license]: https://github.com/CastXML/CastXML/blob/master/LICENSE
29+
[notice]: https://raw.githubusercontent.com/CastXML/CastXML/master/NOTICE
30+
31+
Community
32+
=========
33+
34+
Subscribe and post to the [CastXML Mailing List][mailing-list] for discussion of CastXML.
35+
36+
[mailing-list]: https://public.kitware.com/mailman/listinfo/castxml

castxml/__init__.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
import platform
3+
import subprocess
4+
import sys
5+
6+
from ._version import get_versions
7+
8+
__version__ = get_versions()['version']
9+
del get_versions
10+
11+
DATA = os.path.join(os.path.dirname(__file__), 'data')
12+
13+
# Support running tests from the source tree
14+
if not os.path.exists(DATA):
15+
from skbuild.constants import CMAKE_INSTALL_DIR as SKBUILD_CMAKE_INSTALL_DIR
16+
from skbuild.constants import set_skbuild_plat_name
17+
18+
if platform.system().lower() == "darwin":
19+
# Since building the project specifying --plat-name or CMAKE_OSX_* variables
20+
# leads to different SKBUILD_DIR, the code below attempt to guess the most
21+
# likely plat-name.
22+
_skbuild_dirs = os.listdir(os.path.join(os.path.dirname(__file__), '..', '_skbuild'))
23+
if _skbuild_dirs:
24+
_likely_plat_name = '-'.join(_skbuild_dirs[0].split('-')[:3])
25+
set_skbuild_plat_name(_likely_plat_name)
26+
27+
_data = os.path.abspath(os.path.join(
28+
os.path.dirname(__file__), '..', SKBUILD_CMAKE_INSTALL_DIR(), 'castxml/data'))
29+
if os.path.exists(_data):
30+
DATA = _data
31+
32+
BIN_DIR = os.path.join(DATA, 'bin')
33+
34+
35+
def _program(name, args):
36+
return subprocess.call([os.path.join(BIN_DIR, name)] + args)
37+
38+
39+
def castxml():
40+
raise SystemExit(_program('castxml', sys.argv[1:]))

0 commit comments

Comments
 (0)