PROJECT (qyoto)

# find Qt4
IF (NOT QT4_FOUND)
    FIND_PACKAGE (Qt4 REQUIRED)
ENDIF (NOT QT4_FOUND)
INCLUDE (CSharpMacros)

# source files
SET(SRC_QYOTO_SHARED src/emitsignal.cpp
    src/invokeslot.cpp
    src/methodcall.cpp
    src/methodreturnvalue.cpp
    src/signalreturnvalue.cpp
    src/slotreturnvalue.cpp
    src/virtualmethodcall.cpp
    src/virtualmethodreturnvalue.cpp
    src/qyotosmokebinding.cpp
    src/handlers.cpp
    src/qyotoshared.cpp)

SET(SRC_QYOTO src/qyoto.cpp)

SET(SRC_CS_QYOTO src/SmokeInvocation.cs
    src/SmokeMarshallers.cs
    src/Qyoto.cs
    src/QyotoMetaData.cs
    src/AssemblyInfo.cs
    core/*.cs
    gui/*.cs
    network/*.cs
    sql/*.cs
    xml/*.cs
    svg/*.cs
    opengl/*.cs
    qdbus/*.cs)

INCLUDE_DIRECTORIES (${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/smoke ${CMAKE_SOURCE_DIR}/smoke/qt ${CMAKE_CURRENT_SOURCE_DIR}/src)
LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})

ADD_LIBRARY (qyotoshared SHARED ${SRC_QYOTO_SHARED})
TARGET_LINK_LIBRARIES (qyotoshared smokeqt ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
set_target_properties(qyotoshared PROPERTIES VERSION 1.0.0 SOVERSION 1)

ADD_LIBRARY (qyoto MODULE ${SRC_QYOTO})
TARGET_LINK_LIBRARIES (qyoto qyotoshared smokeqt ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})

SET(CS_FLAGS -debug -define:DEBUG -unsafe -warn:0 -keyfile:${KEYFILE})
ADD_CS_LIBRARY(qt-dotnet "${SRC_CS_QYOTO}" ALL)

ADD_DEPENDENCIES (qt-dotnet qyoto)

GET_CS_LIBRARY_TARGET_DIR()
FILE(WRITE ${CS_LIBRARY_TARGET_DIR}/qt-dotnet.dll.config "<configuration><dllmap dll=\"libqyotoshared\" target=\"libqyotoshared.so.1\"/></configuration>")

INSTALL(TARGETS qyoto LIBRARY DESTINATION ${LIB_INSTALL_DIR})
INSTALL(TARGETS qyotoshared LIBRARY DESTINATION ${LIB_INSTALL_DIR})
INSTALL(FILES src/emitsignal.h src/invokeslot.h src/marshall.h src/methodcall.h src/methodreturnvalue.h
src/qyoto.h src/qyotosmokebinding.h src/signalreturnvalue.h src/slotreturnvalue.h
src/smokeqyoto.h src/virtualmethodcall.h src/virtualmethodreturnvalue.h DESTINATION include/qyoto)
INSTALL_GAC(qt-dotnet)

ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(examples EXCLUDE_FROM_ALL)
