
    set (PYTHON_SOURCES
yap_kernel_launcher.py
docs/conf.py
yap_kernel/serialize.py
yap_kernel/_eventloop_macos.py
yap_kernel/jsonutil.py
yap_kernel/pickleutil.py
yap_kernel/pylab/backend_inline.py
yap_kernel/pylab/config.py
yap_kernel/pylab/__init__.py
yap_kernel/displayhook.py
yap_kernel/__main__.py
yap_kernel/gui/gtk3embed.py
yap_kernel/gui/gtkembed.py
yap_kernel/gui/__init__.py
yap_kernel/parentpoller.py
yap_kernel/_version.py
yap_kernel/eventloops.py
yap_kernel/connect.py
yap_kernel/comm/comm.py
yap_kernel/comm/__init__.py
yap_kernel/comm/manager.py
yap_kernel/kernelspec.py
yap_kernel/iostream.py
yap_kernel/zmqshell.py
yap_kernel/kernelbase.py
yap_kernel/heartbeat.py
yap_kernel/log.py
yap_kernel/datapub.py
yap_kernel/codeutil.py
yap_kernel/kernelapp.py
yap_kernel/embed.py
yap_kernel/__init__.py
yap_kernel/inprocess/blocking.py
yap_kernel/inprocess/socket.py
yap_kernel/inprocess/constants.py
yap_kernel/inprocess/channels.py
yap_kernel/inprocess/tests/test_kernelmanager.py
yap_kernel/inprocess/tests/test_kernel.py
yap_kernel/inprocess/tests/__init__.py
yap_kernel/inprocess/__init__.py
yap_kernel/inprocess/manager.py
yap_kernel/inprocess/client.py
yap_kernel/inprocess/ipkernel.py
yap_kernel/ipkernel.py
yap_ipython/display.py
yap_ipython/frontend.py
yap_ipython/parallel.py
yap_ipython/html.py
yap_ipython/__main__.py
yap_ipython/terminal/ptutils.py
yap_ipython/terminal/shortcuts.py
yap_ipython/terminal/ipapp.py
yap_ipython/terminal/pt_inputhooks/wx.py
yap_ipython/terminal/pt_inputhooks/pyglet.py
yap_ipython/terminal/pt_inputhooks/osx.py
yap_ipython/terminal/pt_inputhooks/gtk.py
yap_ipython/terminal/pt_inputhooks/tk.py
yap_ipython/terminal/pt_inputhooks/glut.py
yap_ipython/terminal/pt_inputhooks/gtk3.py
yap_ipython/terminal/pt_inputhooks/__init__.py
yap_ipython/terminal/pt_inputhooks/qt.py
yap_ipython/terminal/console.py
yap_ipython/terminal/prompts.py
yap_ipython/terminal/ptshell.py
yap_ipython/terminal/embed.py
yap_ipython/terminal/tests/test_help.py
yap_ipython/terminal/tests/test_embed.py
yap_ipython/terminal/tests/test_interactivshell.py
yap_ipython/terminal/tests/__init__.py
yap_ipython/terminal/__init__.py
yap_ipython/terminal/interactiveshell.py
yap_ipython/terminal/debugger.py
yap_ipython/terminal/magics.py
yap_ipython/consoleapp.py
yap_ipython/core/display.py
yap_ipython/core/application.py
yap_ipython/core/builtin_trap.py
yap_ipython/core/formatters.py
yap_ipython/core/prefilter.py
yap_ipython/core/getipython.py
yap_ipython/core/usage.py
yap_ipython/core/oinspect.py
yap_ipython/core/displayhook.py
yap_ipython/core/hooks.py
yap_ipython/core/splitinput.py
yap_ipython/core/page.py
yap_ipython/core/history.py
yap_ipython/core/displaypub.py
yap_ipython/core/profiledir.py
yap_ipython/core/shellapp.py
yap_ipython/core/extensions.py
yap_ipython/core/compilerop.py
yap_ipython/core/events.py
yap_ipython/core/pylabtools.py
yap_ipython/core/completer.py
yap_ipython/core/prompts.py
yap_ipython/core/latex_symbols.py
yap_ipython/core/macro.py
yap_ipython/core/inputsplitter.py
yap_ipython/core/error.py
yap_ipython/core/profileapp.py
yap_ipython/core/magic_arguments.py
yap_ipython/core/logger.py
yap_ipython/core/inputtransformer.py
yap_ipython/core/payloadpage.py
yap_ipython/core/crashhandler.py
yap_ipython/core/magics/display.py
yap_ipython/core/magics/execution.py
yap_ipython/core/magics/namespace.py
yap_ipython/core/magics/basic.py
yap_ipython/core/magics/extension.py
yap_ipython/core/magics/history.py
yap_ipython/core/magics/pylab.py
yap_ipython/core/magics/config.py
yap_ipython/core/magics/osm.py
yap_ipython/core/magics/script.py
yap_ipython/core/magics/__init__.py
yap_ipython/core/magics/auto.py
yap_ipython/core/magics/logging.py
yap_ipython/core/magics/code.py
yap_ipython/core/ultratb.py
yap_ipython/core/__init__.py
yap_ipython/core/autocall.py
yap_ipython/core/alias.py
yap_ipython/core/completerlib.py
yap_ipython/core/magic.py
yap_ipython/core/interactiveshell.py
yap_ipython/core/excolors.py
yap_ipython/core/release.py
yap_ipython/core/display_trap.py
yap_ipython/core/debugger.py
yap_ipython/core/historyapp.py
yap_ipython/core/payload.py
yap_ipython/config.py
yap_ipython/utils/frame.py
yap_ipython/utils/ipstruct.py
yap_ipython/utils/module_paths.py
yap_ipython/utils/jsonutil.py
yap_ipython/utils/PyColorize.py
yap_ipython/utils/pickleutil.py
yap_ipython/utils/eventful.py
yap_ipython/utils/ulinecache.py
yap_ipython/utils/generics.py
yap_ipython/utils/version.py
yap_ipython/utils/tz.py
yap_ipython/utils/_process_cli.py
yap_ipython/utils/wildcard.py
yap_ipython/utils/dir2.py
yap_ipython/utils/strdispatch.py
yap_ipython/utils/sysinfo.py
yap_ipython/utils/io.py
yap_ipython/utils/decorators.py
yap_ipython/utils/contexts.py
yap_ipython/utils/data.py
yap_ipython/utils/terminal.py
yap_ipython/utils/syspathcontext.py
yap_ipython/utils/tokenize2.py
yap_ipython/utils/localinterfaces.py
yap_ipython/utils/_process_win32_controller.py
yap_ipython/utils/py3compat.py
yap_ipython/utils/sentinel.py
yap_ipython/utils/colorable.py
yap_ipython/utils/_sysinfo.py
yap_ipython/utils/importstring.py
yap_ipython/utils/tokenutil.py
yap_ipython/utils/traitlets.py
yap_ipython/utils/path.py
yap_ipython/utils/daemonize.py
yap_ipython/utils/log.py
yap_ipython/utils/openpy.py
yap_ipython/utils/tempdir.py
yap_ipython/utils/encoding.py
yap_ipython/utils/__init__.py
yap_ipython/utils/signatures.py
yap_ipython/utils/_process_win32.py
yap_ipython/utils/coloransi.py
yap_ipython/utils/_process_posix.py
yap_ipython/utils/shimmodule.py
yap_ipython/utils/timing.py
yap_ipython/utils/text.py
yap_ipython/utils/process.py
yap_ipython/utils/capture.py
yap_ipython/paths.py
yap_ipython/nbconvert.py
yap_ipython/external/mathjax.py
yap_ipython/external/qt_for_kernel.py
yap_ipython/external/decorators/_numpy_testing_noseclasses.py
yap_ipython/external/decorators/_decorators.py
yap_ipython/external/decorators/__init__.py
yap_ipython/external/__init__.py
yap_ipython/external/qt_loaders.py
yap_ipython/__init__.py
yap_ipython/sphinxext/ipython_console_highlighting.py
yap_ipython/sphinxext/ipython_directive.py
yap_ipython/sphinxext/custom_doctests.py
yap_ipython/sphinxext/__init__.py
yap_ipython/kernel/adapter.py
yap_ipython/kernel/channelsabc.py
yap_ipython/kernel/__main__.py
yap_ipython/kernel/launcher.py
yap_ipython/kernel/multikernelmanager.py
yap_ipython/kernel/restarter.py
yap_ipython/kernel/managerabc.py
yap_ipython/kernel/threaded.py
yap_ipython/kernel/clientabc.py
yap_ipython/kernel/connect.py
yap_ipython/kernel/kernelspecapp.py
yap_ipython/kernel/kernelspec.py
yap_ipython/kernel/channels.py
yap_ipython/kernel/__init__.py
yap_ipython/kernel/manager.py
yap_ipython/kernel/client.py
yap_ipython/nbformat.py
yap_ipython/extensions/cythonmagic.py
yap_ipython/extensions/storemagic.py
yap_ipython/extensions/tests/test_autoreload.py
yap_ipython/extensions/tests/test_storemagic.py
yap_ipython/extensions/tests/__init__.py
yap_ipython/extensions/__init__.py
yap_ipython/extensions/rmagic.py
yap_ipython/extensions/sympyprinting.py
yap_ipython/extensions/autoreload.py
yap_ipython/yapi.py
yap_ipython/qt.py
yap_ipython/lib/display.py
yap_ipython/lib/pretty.py
yap_ipython/lib/inputhookgtk.py
yap_ipython/lib/inputhookwx.py
yap_ipython/lib/lexers.py
yap_ipython/lib/demo.py
yap_ipython/lib/inputhookgtk3.py
yap_ipython/lib/kernel.py
yap_ipython/lib/inputhookpyglet.py
yap_ipython/lib/editorhooks.py
yap_ipython/lib/inputhook.py
yap_ipython/lib/backgroundjobs.py
yap_ipython/lib/latextools.py
yap_ipython/lib/deepreload.py
yap_ipython/lib/__init__.py
yap_ipython/lib/guisupport.py
yap_ipython/lib/security.py
yap_ipython/lib/inputhookglut.py
yap_ipython/lib/clipboard.py
yap_ipython/lib/inputhookqt4.py
__init__.py

         )

            set (EXTRAS
                    MANIFEST.in
                    YAP_KERNEL.md
                    setup.py
                    setup.cfg
                    README.md
                )

                set (RESOURCES
                    #yap_kernel/resources/logo-32x32.png
                    #yap_kernel/resourcess/logo-64x64.png
            )
            set (RENAMED_RESOURCES
                yap_kernel/resources/logo-32x32.png
                yap_kernel/resources/logo-64x64.png
    # yap_kernel/resources/codemirror/mode/prolog/prolog.js
    )

            set (PL_SOURCES
                    yap_ipython/prolog/jupyter.yap
                    )

set(FILES ${PYTHON_SOURCES} ${PL_SOURCES} ${EXTRAS} ${RESOURCES})

    set(SETUP_PY ${CMAKE_CURRENT_BINARY_DIR}/setup.py)

    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap.tgz
     COMMAND ${CMAKE_COMMAND} -E tar cf ${CMAKE_CURRENT_BINARY_DIR}/yap.tgz  ${FILES}


      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
      DEPENDS ${FILES}
)


add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png
 COMMAND ${CMAKE_COMMAND} -E make_directory yap_kernel/resources
            COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/docs/icons/yap_32x32x32.png  ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png
            DEPENDS ${CMAKE_SOURCE_DIR}/docs/icons/yap_32x32x32.png
        )


        add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png
                    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/docs/icons/yap_64x64x32.png  ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png
            DEPENDS ${CMAKE_SOURCE_DIR}/docs/icons/yap_64x64x32.png
                )



        add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js
                    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/kernel.js  ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/
            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kernel.js
                )

	      add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
                    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/yap.js  ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
            DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/yap.js
                )

	      add_custom_target(YAP_KERNEL ALL
		COMMAND ${CMAKE_COMMAND} -E tar xzf yap.tgz
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png yap.tgz ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
	    )

	  
    install(CODE "execute_process(
        COMMAND ${PYTHON_EXECUTABLE}  ${SETUP_PY} build sdist bdist
        COMMAND ${PYTHON_EXECUTABLE} -m pip install     --ignore-installed --no-deps  .
        COMMAND ${PYTHON_EXECUTABLE} -m yap_kernel.kernelspec
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")

      install(FILES ${PL_SOURCES} DESTINATION ${libpl} )
