OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-sensory / opencog / cython-v0 / CMakeLists.txt

54 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}
)

# The -3 flag means "build for python3"
SET(CYTHON_FLAGS "-3" "-f" "-Wextra")

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

ADD_LIBRARY(sensory_v0_cython SHARED
	sensory_v0.cpp
)

ADD_DEPENDENCIES(sensory_v0_cython sensory_v0_atom_types)

# The NO_AS_NEEDED forces the shared library ctors to run
# for the libsensory-whatever.so. These are needed to get
# the assorted atom type factories to get installed into
# the atompace nameserver.
TARGET_LINK_LIBRARIES(sensory_v0_cython
	${NO_AS_NEEDED}
	sensory-v0-types
	sensory-v0-irc
	sensory-v0-filedir
	sensory-v0-terminal
	sensory-v0
	${ATOMSPACE_LIBRARIES}
	${Python3_LIBRARIES}
)

SET_TARGET_PROPERTIES(sensory_v0_cython PROPERTIES
	PREFIX ""
	OUTPUT_NAME sensory_v0)

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