OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-storage / opencog / persist / api / cython / CMakeLists.txt

50 lines · txt ref:
# Need to use -fno-strict-aliasing when compiling cython code, in order
# to avoid nasty compiler warnings about aliasing.  Cython explicitly
# performs aliasing, in order to emulate python object inheritance.
# See, for example,
# https://groups.google.com/forum/#!topic/cython-users/JV1-KvIUeIg
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
INCLUDE_DIRECTORIES(
	${Python3_INCLUDE_DIRS}
	${CMAKE_CURRENT_SOURCE_DIR}
	${CMAKE_CURRENT_BINARY_DIR}
)

# Need to be able to find opencog/atomspace.pxd
# and so the location of that goes in the -I flag
SET(CYTHON_FLAGS "-3" "-f" "-Wextra"
	"-I${ATOMSPACE_INCLUDE_DIR}/opencog/cython/")

# The python module name is taken from the pyx filename. Thus, the file
# storage.pyx means that module name will be 'opencog.storage'. This will
# have an autogenerated PyInit_storage() in it, again, based on the module
# name.
CYTHON_ADD_MODULE_PYX(storage
	"storage.pxd")

ADD_LIBRARY(storage_cython SHARED
	storage.cpp
)

ADD_DEPENDENCIES(storage_cython storage_types)

TARGET_LINK_LIBRARIES(storage_cython
	# utilities_cython
	fast_load_scm
	# ${NO_AS_NEEDED}
	persist
	storage-types
	${ATOMSPACE_LIBRARIES}
	${Python3_LIBRARIES}
)

SET_TARGET_PROPERTIES(storage_cython PROPERTIES
	PREFIX ""
	OUTPUT_NAME storage)

### install the modules ###
INSTALL(TARGETS
	storage_cython
	DESTINATION "${PYTHON_DEST}")