Browse Source

Improved python import heirarchy (sp?). Now you can use: from pyLemma import pyFDEM1D which is the intuitive way to do this.

iss7
Trevor Irons 4 years ago
parent
commit
a045a6acb1
5 changed files with 55 additions and 3 deletions
  1. 1
    1
      CMake/SuperBuild.cmake
  2. 4
    2
      CMakeLists.txt
  3. 10
    0
      Modules/FDEM1D/python/CMakeLists.txt
  4. 0
    0
      python/pyLemma/__init__.py
  5. 40
    0
      python/setup.py

+ 1
- 1
CMake/SuperBuild.cmake View File

@@ -75,7 +75,7 @@ if (LEMMA_PYTHON3_BINDINGS)
75 75
         message( STATUS "pybind11 was NOT found, please build or remove LEMMA_PYTHON3_BINDINGS" )
76 76
 	    ExternalProject_Add(pybind11
77 77
 		    GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
78
-		    GIT_TAG "master"
78
+		    GIT_TAG "v2.3.0" #"master"
79 79
 		    UPDATE_COMMAND ""
80 80
 		    PATCH_COMMAND ""
81 81
     	    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/pybind11

+ 4
- 2
CMakeLists.txt View File

@@ -255,8 +255,10 @@ if (LEMMA_PYTHON3_BINDINGS)
255 255
     find_package(pybind11 REQUIRED)
256 256
     #    find_package(Boost 1.64.0   REQUIRED COMPONENTS system python3 numpy3)
257 257
     # Is this OK for portability of non-python libraries
258
-    include_directories(${PYTHON_INCLUDE_DIRS})
259
-#    include_directories(${Boost_INCLUDE_DIRS})
258
+    #include_directories(${PYTHON_INCLUDE_DIRS})
259
+    #include_directories(${Boost_INCLUDE_DIRS})
260
+    install ( FILES python/setup.py DESTINATION ${CMAKE_INSTALL_PREFIX}/pyLemma/ ) 
261
+    install ( DIRECTORY python/pyLemma DESTINATION ${CMAKE_INSTALL_PREFIX}/pyLemma/ ) 
260 262
 endif()
261 263
 
262 264
 ####################

+ 10
- 0
Modules/FDEM1D/python/CMakeLists.txt View File

@@ -1,5 +1,15 @@
1
+
2
+#pybind11_add_module(pyFDEM1D   MODULE pyFDEM1D.cpp)
1 3
 add_library(pyFDEM1D MODULE pyFDEM1D.cpp)
2 4
 target_link_libraries(pyFDEM1D PRIVATE pybind11::module lemmacore fdem1d )
3 5
 set_target_properties(pyFDEM1D PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
4 6
                                        SUFFIX "${PYTHON_MODULE_EXTENSION}")
5 7
 
8
+install(TARGETS pyFDEM1D
9
+	COMPONENT python
10
+	RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/pyLemma/pyLemma/"
11
+	LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/pyLemma/pyLemma/"
12
+	ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/pyLemma/pyLemma/"
13
+)
14
+
15
+#install (FILES __init__.py DESTINATION "${CMAKE_INSTALL_PREFIX}/pyLemma/pyLemma/pyFDEM1D")

+ 0
- 0
python/pyLemma/__init__.py View File


+ 40
- 0
python/setup.py View File

@@ -0,0 +1,40 @@
1
+#from distutils.core import setup
2
+from setuptools import setup, Extension, find_packages
3
+
4
+import sys
5
+if sys.version_info < (3,0):
6
+  sys.exit('Sorry, Python < 3.0 is not supported')
7
+
8
+setup(
9
+  name             = 'pyLemma',
10
+  version          = '0.0.2', 
11
+  author           = 'Trevor Irons and others',
12
+  author_email     = 'Trevor.Irons@lemmasoftware.org',
13
+  description      = 'A short description of the app/lib',
14
+  long_description = 'A longer one',
15
+  classifiers=[
16
+        'Development Status :: 3 - Alpha',
17
+        'Intended Audience :: Developers',
18
+        'License :: OSI Approved :: MPL License',
19
+        'Topic :: Scientific/Engineering',
20
+        'Programming Language :: Python :: 3',
21
+  ],
22
+  #packages    = ['pyLemma.pyFDEM1D'],
23
+  packages=find_packages(),
24
+  #package_dir = {
25
+  #  '': '../'
26
+  #},
27
+  include_package_data=True,
28
+  package_data = {
29
+    #'pyLemma': ['pyFDEM1D.*.so']
30
+    #'pyLemma.pyFDEM1D': ['pyFDEM1D.*.so']
31
+    #'pyLemma.pyFDEM1D': ['pyFDEM1D.*.so']
32
+    '': ['pyFDEM1D.*.so']
33
+  },
34
+  zip_safe=False,
35
+)
36
+
37
+
38
+    #ext_modules=[CMakeExtension('proj_name')],
39
+    #cmdclass=dict(build_ext=CMakeBuild),
40
+

Loading…
Cancel
Save