-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ ros/src/py_detector/py_detector/weights/yolov3.weights | |
.python-version | ||
|
||
compile_commands.json | ||
|
||
*.log | ||
*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,44 +15,50 @@ class cmake_build_ext(build_ext): | |
|
||
def run(self): | ||
self.build_cmake(self.extensions) | ||
super().run() | ||
# super().run() | ||
|
||
def build_cmake(self, exts): | ||
# This code assumes 'gtsam' & 'gtsam_quadrics' extensions are specified | ||
# in that order... | ||
gtsam_ext = exts[0] | ||
gtsam_quadrics_ext = exts[1] | ||
|
||
gtsam_so = self.get_ext_filename(gtsam_ext.name) | ||
gtsam_quadrics_so = self.get_ext_filename(gtsam_quadrics_ext.name) | ||
|
||
# Build our CPython shared objects | ||
source_dir = os.getcwd() | ||
build_dir = self.build_temp | ||
build_lib_dir = self.build_lib | ||
|
||
self.spawn([ | ||
'cmake', '-DBUILD_SHARED_LIBS=OFF', | ||
'cmake', '-DBUILD_SHARED_LIBS=OFF', '-UCMAKE_MAKE_PROGRAM', | ||
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON', '-G', 'Ninja', '-B', | ||
build_dir, '-S', source_dir | ||
]) | ||
self.spawn(['cmake', '--build', build_dir]) | ||
|
||
# Move shared objects to the expected output location | ||
lib_dir = os.path.dirname(self.get_ext_fullpath(gtsam_ext.name)) | ||
os.makedirs(lib_dir, exist_ok=True) | ||
|
||
# Move shared objects to the build lib location | ||
# TODO probably should just output them there from CMake... but eh | ||
shutil.copy( | ||
os.path.join(build_dir, 'gtsam', 'python', 'gtsam', | ||
self.get_ext_filename(gtsam_ext.name)), | ||
self.get_ext_fullpath(gtsam_ext.name)) | ||
shutil.copy( | ||
os.path.join(build_dir, | ||
self.get_ext_filename(gtsam_quadrics_ext.name)), | ||
self.get_ext_fullpath(gtsam_quadrics_ext.name)) | ||
os.path.join(build_dir, 'gtsam', 'python', 'gtsam', gtsam_so), | ||
os.path.join(build_lib_dir, gtsam_so)) | ||
shutil.copy(os.path.join(build_dir, gtsam_quadrics_so), | ||
os.path.join(build_lib_dir, gtsam_quadrics_so)) | ||
|
||
# Move shared objects to the shared source location | ||
# TODO probably should be behind an '--inplace' flag or something... | ||
shutil.copy(os.path.join(build_lib_dir, gtsam_so), | ||
os.path.join(source_dir, gtsam_so)) | ||
shutil.copy(os.path.join(build_lib_dir, gtsam_quadrics_so), | ||
os.path.join(source_dir, gtsam_quadrics_so)) | ||
|
||
|
||
with open("README.md", 'r') as f: | ||
long_description = f.read() | ||
|
||
setup(name='gtsam_quadrics', | ||
version='0.2.0', | ||
version='0.2.1', | ||
author='Lachlan Nicholson', | ||
author_email='[email protected]', | ||
maintainer='Ben Talbot', | ||
|