summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-09 16:51:17 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-09 16:51:17 (GMT)
commit4d647f351f1b5cc628a5f3b0df49e23b2bd239e6 (patch)
tree325bba00b253f55adcaf26855487a383abab6bec
parent969fb4663b7edf4692778a7980849bf8e89dcbbd (diff)
downloadlibkolabxml-4d647f351f1b5cc628a5f3b0df49e23b2bd239e6.tar.gz
fixed building of csharp bindings
-rw-r--r--src/csharp/CMakeLists.txt120
1 files changed, 36 insertions, 84 deletions
diff --git a/src/csharp/CMakeLists.txt b/src/csharp/CMakeLists.txt
index ba157a7..0e2bc00 100644
--- a/src/csharp/CMakeLists.txt
+++ b/src/csharp/CMakeLists.txt
@@ -1,12 +1,16 @@
# Generate C# wrapper
include_directories(../)
-if (NOT WIN32)
+# Compile CSHARP Bindings
+find_program(GMCS NAMES gmcs HINTS /usr/bin/)
+
+if (NOT GMCS)
#The following assumes windows, so we exit otherwise
+ message("gmcs not found, not building csharp bindings")
return()
endif()
-set(KOLAB_SWIG_CSHARP_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/csharp_kolabformat_wrapper.cpp)
+set(KOLAB_SWIG_CSHARP_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/csharp_kolabformat_wrapper.cpp) #it seems we never use this file? it works at least as a dependecy.
set(KOLAB_SWIG_CSHARP_DLL_FILE ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.dll)
set(KOLAB_SWIG_CSHARP_TEST_FILE ${CMAKE_CURRENT_BINARY_DIR}/test.exe)
@@ -20,92 +24,40 @@ add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_SOURCE_FILE}
SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_SOURCE_FILE} PROPERTIES GENERATED 1)
-# Compile CSHARP Bindings
-find_program(GMCS NAMES gmcs HINTS /usr/bin/)
-
-if (GMCS)
- configure_file(test.cs ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+configure_file(test.cs ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
- set(CSHARP_GENERATED_SOURCE_FILES
- ${CMAKE_CURRENT_BINARY_DIR}/Address.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Affiliation.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Alarm.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Attachment.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Attendee.cs
- ${CMAKE_CURRENT_BINARY_DIR}/cDateTime.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Classification.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Configuration.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Contact.cs
- ${CMAKE_CURRENT_BINARY_DIR}/ContactReference.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Crypto.cs
- ${CMAKE_CURRENT_BINARY_DIR}/CustomProperty.cs
- ${CMAKE_CURRENT_BINARY_DIR}/DayPos.cs
- ${CMAKE_CURRENT_BINARY_DIR}/DistList.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Duration.cs
- ${CMAKE_CURRENT_BINARY_DIR}/ErrorSeverity.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Event.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Geo.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Journal.cs
- ${CMAKE_CURRENT_BINARY_DIR}/kolabformatPINVOKE.cs
- ${CMAKE_CURRENT_BINARY_DIR}/NameComponents.cs
- ${CMAKE_CURRENT_BINARY_DIR}/PartStatus.cs
- ${CMAKE_CURRENT_BINARY_DIR}/RecurrenceRule.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Related.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Relative.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Role.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Status.cs
- ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_Kolab__Note.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Telephone.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Todo.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectoraddress.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectoraffiliation.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectoralarm.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorattachment.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorattendee.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorcontactref.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorcs.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectordatetime.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectordaypos.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorgeo.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectori.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectorrelated.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectors.cs
- ${CMAKE_CURRENT_BINARY_DIR}/vectortelephone.cs
- ${CMAKE_CURRENT_BINARY_DIR}/Weekday.cs
- )
+FILE(GLOB CSHARP_GENERATED_SOURCE_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.cs")
+LIST( REMOVE_ITEM CSHARP_GENERATED_SOURCE_FILES "${CMAKE_CURRENT_BINARY_DIR}/kolabformat.cs") #this one must be first so we remove and readd later
+SET_SOURCE_FILES_PROPERTIES(${CSHARP_GENERATED_SOURCE_FILES} PROPERTIES GENERATED 1)
+LIST( REMOVE_ITEM CSHARP_GENERATED_SOURCE_FILES "${CMAKE_CURRENT_BINARY_DIR}/test.cs") #not a generated file
+add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_DLL_FILE}
+ COMMAND ${GMCS} -target:library "${CMAKE_CURRENT_BINARY_DIR}/kolabformat.cs" ${CSHARP_GENERATED_SOURCE_FILES}
+ COMMENT "Compiling C# library"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS kolabxml ${KOLAB_SWIG_CSHARP_SOURCE_FILE} ${CSHARP_GENERATED_SOURCE_FILES}
+ VERBATIM
+ )
- add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_DLL_FILE}
- COMMAND ${GMCS} -target:library ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.cs ${CSHARP_GENERATED_SOURCE_FILES}
- COMMENT "Compiling C# library"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS kolabxml ${KOLAB_SWIG_CSHARP_SOURCE_FILE}
- VERBATIM
- )
+add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_TEST_FILE}
+ COMMAND ${GMCS} -reference:${KOLAB_SWIG_CSHARP_DLL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/test.cs
+ COMMENT "Compiling C# test.exe"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS kolabxml ${KOLAB_SWIG_CSHARP_SOURCE_FILE} ${KOLAB_SWIG_CSHARP_DLL_FILE}
+ VERBATIM
+ )
- add_custom_command(OUTPUT ${KOLAB_SWIG_CSHARP_TEST_FILE}
- COMMAND ${GMCS} -reference:${KOLAB_SWIG_CSHARP_DLL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/test.cs
- COMMENT "Compiling C# test.exe"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS kolabxml ${KOLAB_SWIG_CSHARP_SOURCE_FILE}
- VERBATIM
- )
+SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_DLL_FILE} PROPERTIES GENERATED 1)
+SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_TEST_FILE} PROPERTIES GENERATED 1)
+ADD_CUSTOM_TARGET(generate_csharp_bindings ALL DEPENDS ${KOLAB_SWIG_CSHARP_DLL_FILE} ${KOLAB_SWIG_CSHARP_TEST_FILE})
- SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_DLL_FILE} PROPERTIES GENERATED 1)
- SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_TEST_FILE} PROPERTIES GENERATED 1)
- ADD_CUSTOM_TARGET(generate_csharp_bindings ALL DEPENDS ${KOLAB_SWIG_CSHARP_DLL_FILE} ${KOLAB_SWIG_CSHARP_TEST_FILE})
+if (KOLAB_CSHARP_INSTALL_DIR)
+ set(CSHARP_INSTALL_DIR ${KOLAB_CSHARP_INSTALL_DIR})
+else (KOLAB_CSHARP_INSTALL_DIR)
+ set(CSHARP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/csharpbindings)
+endif (KOLAB_CSHARP_INSTALL_DIR)
- if (KOLAB_CSHARP_INSTALL_DIR)
- set(CSHARP_INSTALL_DIR ${KOLAB_CSHARP_INSTALL_DIR})
- else (KOLAB_CSHARP_INSTALL_DIR)
- set(CSHARP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/csharpbindings)
- endif (KOLAB_CSHARP_INSTALL_DIR)
+#not sure about the LIBRARY here, but might work
+install(FILES ${KOLAB_SWIG_CSHARP_DLL_FILE} LIBRARY DESTINATION ${CSHARP_INSTALL_DIR})
+install(FILES ${KOLAB_SWIG_CSHARP_TEST_FILE} RUNTIME DESTINATION ${CSHARP_INSTALL_DIR})
- #there is no target "csharpbindings" so you can't install it, just install plain files.
-# install(TARGETS csharpbindings LIBRARY DESTINATION ${CSHARP_INCLUDE_DIR})
- #not sure about the LIBRARY here, but might work
- install(FILES ${KOLAB_SWIG_CSHARP_DLL_FILE} LIBRARY DESTINATION ${CSHARP_INSTALL_DIR})
- install(FILES ${KOLAB_SWIG_CSHARP_TEST_FILE} RUNTIME DESTINATION ${CSHARP_INSTALL_DIR})
-else(GMCS)
- message("gmcs not found, not building csharp bindings")
-endif (GMCS)