Skip to content

Commit

Permalink
dynamic sym res on apple
Browse files Browse the repository at this point in the history
  • Loading branch information
phantom authored and phantom committed Mar 3, 2015
1 parent 1946fb1 commit 332756e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project (Graphfab)

set(GRAPHFAB_MAJOR_VER 1)
set(GRAPHFAB_MINOR_VER 2)
set(GRAPHFAB_PATCHLEVEL 3)
set(GRAPHFAB_PATCHLEVEL 4)

#User Configuration
if(${WIN32})
Expand Down Expand Up @@ -50,6 +50,7 @@ if(PYTHONLIBS_FOUND)
unset(PYTHON_LIBRARY_DEBUG CACHE)
else()
set(ENABLE_PYTHON2_BINDINGS OFF CACHE BOOL "Enable Python 2 bindings")
set(PYTHON2_LIBRARY "${PYTHON_LIBRARY}" CACHE STRING "NOTFOUND")
endif()

#Dependencies
Expand Down
14 changes: 12 additions & 2 deletions graphfab/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,17 @@ if(ENABLE_PYTHON3_BINDINGS)
# if(PYTHONLIBS_FOUND)
add_library(graphfab_python3mod SHARED python/graphfabmodule.c)
target_link_libraries(graphfab_python3mod graphfab)
target_link_libraries(graphfab_python3mod ${PYTHON3_LIBRARY})
# if(NOT APPLE)
target_link_libraries(graphfab_python3mod ${PYTHON3_LIBRARY})
# else()
# set_target_properties(graphfab_python3mod PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
# endif()
set_target_properties(graphfab_python3mod PROPERTIES OUTPUT_NAME "graphfab" COMPILE_FLAGS "-fPIC -DPYTHON_API_VER=3 -DPYTHON_SCREWED_IT_UP=1" PREFIX "" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/graphfab_python3mod_bin" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/graphfab_python3mod_lib")
set_property(TARGET graphfab_python3mod PROPERTY INCLUDE_DIRECTORIES "${PYTHON3_INCLUDE_DIR}" APPEND)
if(GRAPHFAB_WINDOWS_BUILD)
set_target_properties(graphfab_python3mod PROPERTIES SUFFIX ".pyd" )
elseif(APPLE)
set_target_properties(graphfab_python3mod PROPERTIES SUFFIX ".so" )
endif()
install(TARGETS graphfab_python3mod DESTINATION python3/site-packages)
# endif()
Expand All @@ -221,7 +227,11 @@ if(ENABLE_PYTHON2_BINDINGS)
else()
target_link_libraries(graphfab_python2mod graphfab)
endif()
target_link_libraries(graphfab_python2mod ${PYTHON2_LIBRARY})
if(NOT APPLE)
target_link_libraries(graphfab_python2mod ${PYTHON2_LIBRARY})
else()
set_target_properties(graphfab_python2mod PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()
set_target_properties(graphfab_python2mod PROPERTIES OUTPUT_NAME "graphfab" COMPILE_FLAGS "-fPIC -DPYTHON_API_VER=2 -DPYTHON_SCREWED_IT_UP=1" PREFIX "" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/graphfab_python2mod_bin" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/graphfab_python2mod_libn")
set_property(TARGET graphfab_python2mod PROPERTY INCLUDE_DIRECTORIES "${PYTHON2_INCLUDE_DIR}" APPEND)
if(GRAPHFAB_WINDOWS_BUILD)
Expand Down
18 changes: 16 additions & 2 deletions sandbox/python/pyfab_app.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#os.chdir(newpath)
#print('not changing dir')

print('pre import graphfab')
import graphfab

print('post import graphfab')

import sys
if sys.version_info[0] < 3:
import __builtin__
Expand Down Expand Up @@ -83,6 +86,8 @@ def dict_iteritems(d):
import math
import platform

print('imported platform')

if is_pyqt5():
import PyQt5
from PyQt5 import QtCore, QtGui, QtWidgets
Expand All @@ -104,6 +109,8 @@ def dict_iteritems(d):
optparser.parse_args()
defaultfile = optparser.values.openfile

print('after option parser')

def intervalContains(a, b, x):
if a <= x <= b:
return True
Expand All @@ -129,6 +136,8 @@ def fixNodes(network):
for node in network.nodes:
fixNode(node)

print('is pyqt5?')

if is_pyqt5():
MainWindowBaseClass = QtWidgets.QMainWindow
from PyQt5.QtGui import (QPainter,
Expand Down Expand Up @@ -177,6 +186,8 @@ def fixNodes(network):
class PyfabRenderer:
pass

print('after is pyqt5')

#os.chdir(localpath)

#import pyfab_cfg
Expand Down Expand Up @@ -1870,11 +1881,14 @@ def reject(self):
super(PrefDialog, self).reject()

def start():
print('create QApplication')
if not inspyder:
app = QtWidgets.QApplication(sys.argv)
#app = QtWidgets.QApplication(sys.argv)
app = QtWidgets.QApplication([])
else:
app = qapplication()
app.setAttribute(Qt.AA_UseHighDpiPixmaps)
#app.setAttribute(Qt.AA_UseHighDpiPixmaps)
print('post create QApplication')

layoutapp = Autolayout()

Expand Down

0 comments on commit 332756e

Please sign in to comment.