Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
0d74eb8c
Commit
0d74eb8c
authored
11 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
gmshpy : platform-neutral source package of the python bindings
parent
bfea95a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wrappers/gmshpy/CMakeLists.txt
+72
-15
72 additions, 15 deletions
wrappers/gmshpy/CMakeLists.txt
wrappers/gmshpy/__init__.py.in
+1
-0
1 addition, 0 deletions
wrappers/gmshpy/__init__.py.in
wrappers/gmshpy/setup.py.in
+19
-0
19 additions, 0 deletions
wrappers/gmshpy/setup.py.in
with
92 additions
and
15 deletions
wrappers/gmshpy/CMakeLists.txt
+
72
−
15
View file @
0d74eb8c
...
...
@@ -72,18 +72,7 @@ endif(ENABLE_PYTHON_LIB_API)
include
(
${
SWIG_USE_FILE
}
)
include_directories
(
${
PYTHON_INCLUDE_PATH
}
)
IF
(
HAVE_MPI
)
# this hack is only required for openmpi compiled with dynamic modules
# unfortunately I do not know how to detect this situation => I always enable it
set
(
GMSH_PYTHON_MODULES_INCLUDE_CODE
"import ctypes
\n
"
)
FOREACH
(
lib
${
MPI_C_LIBRARIES
}
)
IF
(
${
lib
}
MATCHES
".*libmpi.*"
)
set
(
GMSH_PYTHON_MODULES_INCLUDE_CODE
"
${
GMSH_PYTHON_MODULES_INCLUDE_CODE
}
ctypes.CDLL(
\"
${
lib
}
\"
, mode = ctypes.RTLD_GLOBAL)
\n
"
)
ENDIF
(
${
lib
}
MATCHES
".*libmpi.*"
)
ENDFOREACH
(
lib
)
ENDIF
(
HAVE_MPI
)
set
(
GMSH_PYTHON_MODULES_INCLUDE_CODE
""
)
foreach
(
module
${
SWIG_MODULES
}
)
set_source_files_properties
(
${
module
}
.i PROPERTIES CPLUSPLUS ON
)
...
...
@@ -95,13 +84,81 @@ foreach(module ${SWIG_MODULES})
swig_link_libraries
(
${
module
}
${
PYTHON_LIBRARIES
}
shared
)
set
(
GMSH_PYTHON_MODULES_INCLUDE_CODE
"
${
GMSH_PYTHON_MODULES_INCLUDE_CODE
}
from gmshpy.
${
module
}
import *
\n
"
)
list
(
APPEND GMSHPY_DEPENDS
"
_
${
module
}
"
)
list
(
APPEND GMSHPY_DEPENDS
"
${
module
}
PYTHON_wrap.cxx
"
)
if
(
APPLE
)
set_target_properties
(
"_
${
module
}
"
PROPERTIES LINK_FLAGS
"-undefined suppress -flat_namespace"
)
endif
(
APPLE
)
endforeach
(
module
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/__init__.py.in
${
CMAKE_CURRENT_BINARY_DIR
}
/__init__.py.orig
)
IF
(
HAVE_MPI
)
# this hack is only required for openmpi compiled with dynamic modules
# unfortunately I do not know how to detect this situation => I always enable it
set
(
GMSH_PYTHON_OPENMPI_HACK
"import ctypes
\n
"
)
FOREACH
(
lib
${
MPI_C_LIBRARIES
}
)
IF
(
${
lib
}
MATCHES
".*libmpi.*"
)
set
(
GMSH_PYTHON_OPENMPI_HACK
"
${
GMSH_PYTHON_OPENMPI_HACK
}
ctypes.CDLL(
\"
${
lib
}
\"
, mode = ctypes.RTLD_GLOBAL)
\n
"
)
ENDIF
(
${
lib
}
MATCHES
".*libmpi.*"
)
ENDFOREACH
(
lib
)
ENDIF
(
HAVE_MPI
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/__init__.py.in
${
CMAKE_CURRENT_BINARY_DIR
}
/__init__.py
)
string
(
REPLACE
";"
"
\"
,
\"
"
GMSH_PYTHON_MODULES
"
${
SWIG_MODULES
}
"
)
set
(
GMSH_PYTHON_MODULES
"
\"
${
GMSH_PYTHON_MODULES
}
\"
"
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/setup.py.in
${
CMAKE_CURRENT_BINARY_DIR
}
/setup.py
)
add_custom_target
(
"_gmshpy"
DEPENDS
${
GMSHPY_DEPENDS
}
)
add_custom_command
(
TARGET _gmshpy POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"gmshpy"
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"gmshpy/extra_include"
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"gmshpy/src"
)
add_custom_command
(
TARGET _gmshpy POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy __init__.py.orig
"gmshpy/src/__init__.py"
COMMAND
${
CMAKE_COMMAND
}
-E copy setup.py
"gmshpy/setup.py"
)
foreach
(
module
${
SWIG_MODULES
}
)
add_custom_command
(
TARGET _gmshpy POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
module
}
PYTHON_wrap.cxx
"gmshpy/src"
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
module
}
.py
"gmshpy/src"
)
endforeach
(
module
)
set
(
GMSH_PYTHON_EXTRA_INCLUDE
Numeric/BasisFactory.h
Numeric/BergotBasis.h
Mesh/CenterlineField.h
Geo/Curvature.h
Mesh/directions3D.h
Mesh/DivideAndConquer.h
projects/riemann/Field.h
Mesh/Field.h
Fltk/FlGui.h
Solver/frameSolver.h
Solver/functionSpace.h
Mesh/Generator.h
Geo/GeomMeshMatcher.h
Geo/GFaceCompound.h
Geo/gmshLevelset.h
Mesh/highOrderTools.h
Numeric/jacobiPolynomials.h
Numeric/legendrePolynomials.h
Solver/linearSystemPETSc.h
Mesh/meshGFaceLloyd.h
contrib/HighOrderMeshOptimizer/OptHomRun.h
Post/PViewAsSimpleFunction.h
Post/PViewFactory.h
Numeric/pyramidalBasis.h
Solver/SElement.h
Numeric/simpleFunctionPython.h
Solver/STensor33.h
Solver/STensor43.h
)
foreach
(
file
${
GMSH_PYTHON_EXTRA_INCLUDE
}
)
add_custom_command
(
TARGET _gmshpy POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../
${
file
}
"
"gmshpy/extra_include"
)
endforeach
(
file
)
add_custom_command
(
TARGET _gmshpy POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E tar cfz gmshpy.tar.gz
"gmshpy"
COMMAND
${
CMAKE_COMMAND
}
-E remove_directory
"gmshpy"
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/__init__.py.in
${
CMAKE_CURRENT_BINARY_DIR
}
/__init__.py
)
This diff is collapsed.
Click to expand it.
wrappers/gmshpy/__init__.py.in
+
1
−
0
View file @
0d74eb8c
# set Ctrl-C to default signal (terminates immediately)
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
${GMSH_PYTHON_OPENMPI_HACK}
${GMSH_PYTHON_MODULES_INCLUDE_CODE}
GmshInitialize()
This diff is collapsed.
Click to expand it.
wrappers/gmshpy/setup.py.in
0 → 100644
+
19
−
0
View file @
0d74eb8c
from distutils.core import setup, Extension
gmshroot = "."
gmshmodules = [${GMSH_PYTHON_MODULES}]
setup(
name = 'gmshpy',
packages = ['gmshpy'],
package_dir = {'gmshpy' : 'src'},
ext_modules = [
Extension('gmshpy._' + module, ['src/' + module + 'PYTHON_wrap.cxx'],
include_dirs = ['./extra_include/', gmshroot + '/include/gmsh/'],
define_macros=[('SWIG', '1')],
libraries = ['Gmsh'],
library_dirs = [gmshroot + '/lib/']
)
for module in gmshmodules],
py_modules = [ "gmshpy." + module for module in gmshmodules ]
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment