5 commits - calendaring/calendaring.i calendaring/event.cpp calendaring/event.h calendaring/php calendaring/python CMakeLists.txt cmake/modules icalendar/icalendar.i icalendar/php icalendar/python shared.i tests/calendaringtest.cpp tests/calendaringtest.h
Christian Mollekopf
mollekopf at kolabsys.com
Tue Aug 7 00:32:54 CEST 2012
CMakeLists.txt | 10 +++
calendaring/calendaring.i | 22 +-------
calendaring/event.cpp | 5 +
calendaring/event.h | 1
calendaring/php/CMakeLists.txt | 46 -----------------
calendaring/python/CMakeLists.txt | 47 -----------------
cmake/modules/SWIGUtils.cmake | 100 ++++++++++++++++++++++++++++++++++++++
icalendar/icalendar.i | 11 ----
icalendar/php/CMakeLists.txt | 46 -----------------
icalendar/python/CMakeLists.txt | 47 -----------------
shared.i | 12 ++++
tests/calendaringtest.cpp | 16 ++++++
tests/calendaringtest.h | 2
13 files changed, 161 insertions(+), 204 deletions(-)
New commits:
commit a7ef5422f835d91926e128abac6ba9d35dd9b557
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Tue Aug 7 00:03:37 2012 +0200
consistently use the kolab-prefix for php modules
diff --git a/calendaring/php/CMakeLists.txt b/calendaring/php/CMakeLists.txt
index ffdc650..5fc92ec 100644
--- a/calendaring/php/CMakeLists.txt
+++ b/calendaring/php/CMakeLists.txt
@@ -1,4 +1,4 @@
#Generate PHP wrapper
include_directories(../)
include(SWIGUtils)
-generatePHPBindings(calendaring ../calendaring.i)
+generatePHPBindings(kolabcalendaring ../calendaring.i)
diff --git a/icalendar/php/CMakeLists.txt b/icalendar/php/CMakeLists.txt
index 48d653f..3aea015 100644
--- a/icalendar/php/CMakeLists.txt
+++ b/icalendar/php/CMakeLists.txt
@@ -1,4 +1,4 @@
#Generate PHP wrapper
include_directories(../)
include(SWIGUtils)
-generatePHPBindings(icalendar ../icalendar.i)
+generatePHPBindings(kolabicalendar ../icalendar.i)
commit cc9b089770514251cc6e1a83ac43dc8014e201d8
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Aug 6 23:44:51 2012 +0200
Moved the vector template instatiation to a separate module, so it can be used from all other module, while no requiring arbitrary extensions of the libkolabxml template instantiations.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 253f283..2c0e761 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,3 +179,13 @@ configure_file(${Libkolab_MODULE_DIR}/LibkolabConfigVersion.cmake.in ${Libkolab_
# Install these two files into the same directory as the generated exports-file.
install(FILES ${Libkolab_BINARY_DIR}/LibkolabConfig.cmake ${Libkolab_BINARY_DIR}/LibkolabConfigVersion.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
+
+
+include(SWIGUtils)
+if(PYTHON_BINDINGS)
+ generatePythonBindings(shared shared.i)
+endif(PYTHON_BINDINGS)
+
+if(PHP_BINDINGS)
+ generatePHPBindings(kolabshared shared.i)
+endif(PHP_BINDINGS)
diff --git a/calendaring/calendaring.i b/calendaring/calendaring.i
index 1f01724..6ee44ac 100644
--- a/calendaring/calendaring.i
+++ b/calendaring/calendaring.i
@@ -1,9 +1,7 @@
-/* calendaring.i */
-%module calendaring
%{
/* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */
- #define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
-
+ #define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
+
#include "../calendaring/calendaring.h"
#include "../calendaring/event.h"
%}
@@ -12,13 +10,9 @@
%include "std_vector.i"
%import(module="kolabformat") <kolabevent.h>
-
-namespace std {
- %template(vectorevent2) vector< vector<Kolab::Event> >;
-};
+%import "../shared.i"
%rename(EventCal) Kolab::Calendaring::Event;
-
%include "../calendaring/calendaring.h"
%include "../calendaring/event.h"
diff --git a/icalendar/icalendar.i b/icalendar/icalendar.i
index d0de6bc..62156e7 100644
--- a/icalendar/icalendar.i
+++ b/icalendar/icalendar.i
@@ -1,5 +1,3 @@
-/* icalendar.i */
-%module icalendar
%{
/* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */
#define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
@@ -10,5 +8,6 @@
%include "std_string.i"
%import(module="kolabformat") <kolabevent.h>
+%import "../shared.i"
%include "icalendar.h"
\ No newline at end of file
diff --git a/shared.i b/shared.i
new file mode 100644
index 0000000..f75820f
--- /dev/null
+++ b/shared.i
@@ -0,0 +1,12 @@
+
+%{
+ /* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */
+ #define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
+ #include <kolabevent.h>
+%}
+%include "std_vector.i"
+%import(module="kolabformat") <kolabevent.h>
+namespace std {
+ %template(vectorevent) vector<Kolab::Event>;
+ %template(vectorevent2) vector< vector<Kolab::Event> >;
+};
commit 1e577d9df5b989209607985035da737751e265d4
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Aug 6 18:18:02 2012 +0200
Don't include all kolab containers in every SWIG module.
Otherwise we can't load several modules in parallel due to conflicts
(same symbols).
* Moved the SWIG module building code to cmake macros.
* don't show compiler warning we're not interested in
* specify module name on the command line to allow easy renaming of modules
diff --git a/calendaring/calendaring.i b/calendaring/calendaring.i
index 4f15de2..1f01724 100644
--- a/calendaring/calendaring.i
+++ b/calendaring/calendaring.i
@@ -1,12 +1,9 @@
/* calendaring.i */
%module calendaring
%{
-
/* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */
#define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
- #include <kolabcontainers.h>
- #include <kolabevent.h>
#include "../calendaring/calendaring.h"
#include "../calendaring/event.h"
%}
@@ -14,17 +11,14 @@
%include "std_string.i"
%include "std_vector.i"
+%import(module="kolabformat") <kolabevent.h>
+
namespace std {
- %template(vectordatetime) vector<Kolab::cDateTime>;
- %template(vectorevent) vector<Kolab::Event>;
%template(vectorevent2) vector< vector<Kolab::Event> >;
};
-/*%apply const std::string& {std::string* foo};*/
+%rename(EventCal) Kolab::Calendaring::Event;
-%rename(EventXML) Kolab::Event;
-%include <kolabcontainers.h>
-%include <kolabevent.h>
%include "../calendaring/calendaring.h"
%include "../calendaring/event.h"
diff --git a/calendaring/php/CMakeLists.txt b/calendaring/php/CMakeLists.txt
index 72b8333..ffdc650 100644
--- a/calendaring/php/CMakeLists.txt
+++ b/calendaring/php/CMakeLists.txt
@@ -1,46 +1,4 @@
#Generate PHP wrapper
include_directories(../)
-
-set(KOLAB_SWIG_PHP_SOURCE_FILE php_calendaring_wrapper.cpp)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/calendaring.php
- COMMAND ${SWIG} -v -c++ -php -I${Libkolabxml_INCLUDES} -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ../calendaring.i
- COMMENT "Generating php bindings"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ../calendaring.i kolab
- VERBATIM
- )
-
-SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PHP_SOURCE_FILE} PROPERTIES GENERATED 1)
-ADD_CUSTOM_TARGET(generate_calendaring_php_bindings ALL DEPENDS ${KOLAB_SWIG_PHP_SOURCE_FILE})
-
-
-#Compile PHP Bindings
-# Since there is no php library we can't compile with -Wl,--no-undefined
-set(CMAKE_SHARED_LINKER_FLAGS "")
-
-if (APPLE)
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flat_namespace -undefined suppress" )
-endif()
-
-find_package(PHP4 5.3 REQUIRED)
-
-if (PHP4_FOUND)
- include_directories(${PHP4_INCLUDE_PATH})
- add_library(calendaring_phpbindings SHARED ${KOLAB_SWIG_PHP_SOURCE_FILE})
- target_link_libraries(calendaring_phpbindings kolab)
- SET_TARGET_PROPERTIES(calendaring_phpbindings PROPERTIES OUTPUT_NAME "kolab-calendaring")
- SET_TARGET_PROPERTIES(calendaring_phpbindings PROPERTIES PREFIX "")
-
-# configure_file(test.php ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-
- set(PHP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/phpbindings" CACHE STRING "Install directory for php bindings.")
-
- install(TARGETS calendaring_phpbindings LIBRARY DESTINATION ${PHP_INSTALL_DIR})
-
- install( FILES
- ${CMAKE_CURRENT_BINARY_DIR}/calendaring.php
- DESTINATION ${PHP_INSTALL_DIR}
- )
-else(PHP4_FOUND)
- message(WARNING "not building php bindings because php was not found")
-endif (PHP4_FOUND)
+include(SWIGUtils)
+generatePHPBindings(calendaring ../calendaring.i)
diff --git a/calendaring/python/CMakeLists.txt b/calendaring/python/CMakeLists.txt
index f351ba2..2a49bea 100644
--- a/calendaring/python/CMakeLists.txt
+++ b/calendaring/python/CMakeLists.txt
@@ -1,46 +1,3 @@
include_directories(../)
-find_package(SWIG REQUIRED)
-
-# Compile Python Bindings
-
-find_package(PythonLibs)
-
-if (NOT PYTHONLIBS_FOUND)
- message("python libs not found, not building python bindings")
- return()
-endif()
-message("found python include dirs: ${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH}")
-
-set(KOLAB_SWIG_PYTHON_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/python_calendaring_wrapper.cpp)
-set(KOLAB_SWIG_PYTHON_HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/calendaring.py)
-
-add_custom_command(OUTPUT ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ${KOLAB_SWIG_PYTHON_HEADER_FILE}
- COMMAND ${SWIG} -v -c++ -python -I${Libkolabxml_INCLUDES} -o ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ../calendaring.i
- COMMENT "Generating python bindings"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ../calendaring.i kolab
- VERBATIM
- )
-
-SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PYTHON_SOURCE_FILE} PROPERTIES GENERATED 1)
-
-#${PYTHON_INCLUDE_PATH} is for backwards compatibility (el6)
-include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH})
-
-set(PYTHON_MODULE_PREFIX "_")
-python_add_module(calendaring ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
-
-#cmake 2.6.4 fails to respect the module prefix
-SET_TARGET_PROPERTIES(calendaring PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
-
-target_link_libraries(calendaring kolab ${PYTHON_LIBRARIES})
-# configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-
-set(PYTHON_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythonbindings" CACHE STRING "Install directory for python bindings.")
-
-install(TARGETS calendaring LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/kolab)
-
-install( FILES
- ${KOLAB_SWIG_PYTHON_HEADER_FILE}
- DESTINATION ${PYTHON_INSTALL_DIR}/kolab
- )
+include(SWIGUtils)
+generatePythonBindings(calendaring ../calendaring.i)
\ No newline at end of file
diff --git a/cmake/modules/SWIGUtils.cmake b/cmake/modules/SWIGUtils.cmake
new file mode 100644
index 0000000..63c5b68
--- /dev/null
+++ b/cmake/modules/SWIGUtils.cmake
@@ -0,0 +1,100 @@
+
+
+macro (generatePHPBindings MODULE_NAME INTERFACE_FILE)
+
+ set(KOLAB_SWIG_PHP_SOURCE_FILE php_${MODULE_NAME}_wrapper.cpp)
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.php
+ COMMAND ${SWIG} -v -c++ -php -I${Libkolabxml_INCLUDES} -module ${MODULE_NAME} -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ${INTERFACE_FILE}
+ COMMENT "Generating php bindings"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${INTERFACE_FILE} kolab
+ VERBATIM
+ )
+
+ SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PHP_SOURCE_FILE} PROPERTIES GENERATED 1)
+ ADD_CUSTOM_TARGET(generate_${MODULE_NAME}_php_bindings ALL DEPENDS ${KOLAB_SWIG_PHP_SOURCE_FILE})
+
+ #Compile PHP Bindings
+ # Since there is no php library we can't compile with -Wl,--no-undefined
+ set(CMAKE_SHARED_LINKER_FLAGS "")
+
+ if (APPLE)
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flat_namespace -undefined suppress" )
+ else()
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused" )
+ endif()
+
+ find_package(PHP4 5.3 REQUIRED)
+
+ if (PHP4_FOUND)
+ include_directories(${PHP4_INCLUDE_PATH})
+ add_library(${MODULE_NAME}_phpbindings SHARED ${KOLAB_SWIG_PHP_SOURCE_FILE})
+ target_link_libraries(${MODULE_NAME}_phpbindings kolab)
+ SET_TARGET_PROPERTIES(${MODULE_NAME}_phpbindings PROPERTIES OUTPUT_NAME ${MODULE_NAME})
+ SET_TARGET_PROPERTIES(${MODULE_NAME}_phpbindings PROPERTIES PREFIX "")
+
+ # configure_file(test.php ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+
+ set(PHP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/phpbindings" CACHE STRING "Install directory for php bindings.")
+
+ install(TARGETS ${MODULE_NAME}_phpbindings LIBRARY DESTINATION ${PHP_INSTALL_DIR}/kolab)
+
+ install( FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.php
+ DESTINATION ${PHP_INSTALL_DIR}/kolab
+ )
+ else(PHP4_FOUND)
+ message(WARNING "not building php bindings because php was not found")
+ endif (PHP4_FOUND)
+endmacro()
+
+
+macro(generatePythonBindings MODULE_NAME INTERFACE_FILE)
+
+ find_package(SWIG REQUIRED)
+
+ # Compile Python Bindings
+
+ find_package(PythonLibs)
+
+ if (NOT PYTHONLIBS_FOUND)
+ message("python libs not found, not building python bindings")
+ return()
+ endif()
+ message("found python include dirs: ${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH}")
+
+ set(KOLAB_SWIG_PYTHON_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/python_${MODULE_NAME}_wrapper.cpp)
+ set(KOLAB_SWIG_PYTHON_HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py)
+
+ add_custom_command(OUTPUT ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ${KOLAB_SWIG_PYTHON_HEADER_FILE}
+ COMMAND ${SWIG} -v -c++ -python -module ${MODULE_NAME} -I${Libkolabxml_INCLUDES} -o ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ${INTERFACE_FILE}
+ COMMENT "Generating python bindings"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${INTERFACE_FILE} kolab
+ VERBATIM
+ )
+
+ SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PYTHON_SOURCE_FILE} PROPERTIES GENERATED 1)
+
+ #${PYTHON_INCLUDE_PATH} is for backwards compatibility (el6)
+ include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH})
+
+ set(PYTHON_MODULE_PREFIX "_")
+ python_add_module(${MODULE_NAME} ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
+
+ #cmake 2.6.4 fails to respect the module prefix
+ SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
+
+ target_link_libraries(${MODULE_NAME} kolab ${PYTHON_LIBRARIES})
+ # configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+
+ set(PYTHON_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythonbindings" CACHE STRING "Install directory for python bindings.")
+
+ install(TARGETS ${MODULE_NAME} LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/kolab)
+
+ install( FILES
+ ${KOLAB_SWIG_PYTHON_HEADER_FILE}
+ DESTINATION ${PYTHON_INSTALL_DIR}/kolab
+ )
+
+endmacro()
\ No newline at end of file
diff --git a/icalendar/icalendar.i b/icalendar/icalendar.i
index 9e2389b..d0de6bc 100644
--- a/icalendar/icalendar.i
+++ b/icalendar/icalendar.i
@@ -1,7 +1,6 @@
/* icalendar.i */
%module icalendar
%{
-
/* This macro ensures that return vectors remain a vector also in python and are not converted to tuples */
#define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
@@ -9,12 +8,7 @@
%}
%include "std_string.i"
-%include "std_vector.i"
-namespace std {
- %template(vectordatetime) vector<Kolab::cDateTime>;
- %template(vectorevent) vector<Kolab::Event>;
- %template(vectorevent2) vector< vector<Kolab::Event> >;
-};
+%import(module="kolabformat") <kolabevent.h>
%include "icalendar.h"
\ No newline at end of file
diff --git a/icalendar/php/CMakeLists.txt b/icalendar/php/CMakeLists.txt
index a9a94c8..48d653f 100644
--- a/icalendar/php/CMakeLists.txt
+++ b/icalendar/php/CMakeLists.txt
@@ -1,46 +1,4 @@
#Generate PHP wrapper
include_directories(../)
-
-set(KOLAB_SWIG_PHP_SOURCE_FILE php_icalendar_wrapper.cpp)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/icalendar.php
- COMMAND ${SWIG} -v -c++ -php -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ../icalendar.i
- COMMENT "Generating php bindings"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ../icalendar.i kolab
- VERBATIM
- )
-
-SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PHP_SOURCE_FILE} PROPERTIES GENERATED 1)
-ADD_CUSTOM_TARGET(generate_icalendar_php_bindings ALL DEPENDS ${KOLAB_SWIG_PHP_SOURCE_FILE})
-
-
-#Compile PHP Bindings
-# Since there is no php library we can't compile with -Wl,--no-undefined
-set(CMAKE_SHARED_LINKER_FLAGS "")
-
-if (APPLE)
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flat_namespace -undefined suppress" )
-endif()
-
-find_package(PHP4 5.3 REQUIRED)
-
-if (PHP4_FOUND)
- include_directories(${PHP4_INCLUDE_PATH})
- add_library(icalendar_phpbindings SHARED ${KOLAB_SWIG_PHP_SOURCE_FILE})
- target_link_libraries(icalendar_phpbindings kolab ${PHP_LIBRARIES})
- SET_TARGET_PROPERTIES(icalendar_phpbindings PROPERTIES OUTPUT_NAME "kolab-icalendar")
- SET_TARGET_PROPERTIES(icalendar_phpbindings PROPERTIES PREFIX "")
-
-# configure_file(test.php ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-
- set(PHP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/phpbindings" CACHE STRING "Install directory for php bindings.")
-
- install(TARGETS icalendar_phpbindings LIBRARY DESTINATION ${PHP_INSTALL_DIR})
-
- install( FILES
- ${CMAKE_CURRENT_BINARY_DIR}/icalendar.php
- DESTINATION ${PHP_INSTALL_DIR}
- )
-else(PHP4_FOUND)
- message(WARNING "not building php bindings because php was not found")
-endif (PHP4_FOUND)
+include(SWIGUtils)
+generatePHPBindings(icalendar ../icalendar.i)
diff --git a/icalendar/python/CMakeLists.txt b/icalendar/python/CMakeLists.txt
index e406c5c..0b842a4 100644
--- a/icalendar/python/CMakeLists.txt
+++ b/icalendar/python/CMakeLists.txt
@@ -1,46 +1,3 @@
include_directories(../)
-find_package(SWIG REQUIRED)
-
-# Compile Python Bindings
-
-find_package(PythonLibs)
-
-if (NOT PYTHONLIBS_FOUND)
- message("python libs not found, not building python bindings")
- return()
-endif()
-message("found python include dirs: ${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH}")
-
-set(KOLAB_SWIG_PYTHON_SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/python_icalendar_wrapper.cpp)
-set(KOLAB_SWIG_PYTHON_HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/icalendar.py)
-
-add_custom_command(OUTPUT ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ${KOLAB_SWIG_PYTHON_HEADER_FILE}
- COMMAND ${SWIG} -v -c++ -python -o ${KOLAB_SWIG_PYTHON_SOURCE_FILE} ../icalendar.i
- COMMENT "Generating python bindings"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ../icalendar.i kolab
- VERBATIM
- )
-
-SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_PYTHON_SOURCE_FILE} PROPERTIES GENERATED 1)
-
-#${PYTHON_INCLUDE_PATH} is for backwards compatibility (el6)
-include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH})
-
-set(PYTHON_MODULE_PREFIX "_")
-python_add_module(icalendar ${KOLAB_SWIG_PYTHON_SOURCE_FILE})
-
-#cmake 2.6.4 fails to respect the module prefix
-SET_TARGET_PROPERTIES(icalendar PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
-
-target_link_libraries(icalendar kolab ${PYTHON_LIBRARIES})
-
-set(PYTHON_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythonbindings" CACHE STRING "Install directory for python bindings.")
-
-install(TARGETS icalendar LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/kolab)
-
-install( FILES
- ${KOLAB_SWIG_PYTHON_HEADER_FILE}
- DESTINATION ${PYTHON_INSTALL_DIR}/kolab
- )
-
+include(SWIGUtils)
+generatePythonBindings(icalendar ../icalendar.i)
commit 3758d73b6b1afa1700f2f0f3c02c9911a4b326e4
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Aug 6 18:14:24 2012 +0200
Test for copy constructor
diff --git a/tests/calendaringtest.cpp b/tests/calendaringtest.cpp
index ce88c57..2694c33 100644
--- a/tests/calendaringtest.cpp
+++ b/tests/calendaringtest.cpp
@@ -41,6 +41,22 @@ void compareEvents(const std::vector<Kolab::Event> &list1, const std::vector<Kol
}
}
+void CalendaringTest::testCalendaringEvent()
+{
+ Kolab::Event event;
+ event.setUid("uid");
+ event.setStart(Kolab::cDateTime(2011,10,10,12,1,1,true));
+ event.setEnd(Kolab::cDateTime(2011,10,11,12,1,1,true));
+ Kolab::Calendaring::Event calEvent(event);
+
+ QCOMPARE(event.start(), calEvent.start());
+ QCOMPARE(event.uid(), calEvent.uid());
+
+ Kolab::Calendaring::Event calEvent2;
+ Kolab::Calendaring::Event calEvent3 = calEvent2;
+ QVERIFY(!calEvent2.uid().empty());
+ QCOMPARE(calEvent2.uid(), calEvent3.uid());
+}
void CalendaringTest::testEventConflict_data()
{
diff --git a/tests/calendaringtest.h b/tests/calendaringtest.h
index 14dd891..af05d22 100644
--- a/tests/calendaringtest.h
+++ b/tests/calendaringtest.h
@@ -25,6 +25,8 @@ class CalendaringTest: public QObject
Q_OBJECT
private slots:
+ void testCalendaringEvent();
+
void testEventConflict_data();
void testEventConflict();
commit 354651417e521067146aaf768e24a0946e66a25c
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Mon Aug 6 18:11:27 2012 +0200
Copy constructor from event base
diff --git a/calendaring/event.cpp b/calendaring/event.cpp
index a4e7e84..f9de600 100644
--- a/calendaring/event.cpp
+++ b/calendaring/event.cpp
@@ -34,6 +34,11 @@ Event::Event()
setUid(Kolab::generateUID());
}
+Event::Event(const Kolab::Event &e)
+: Kolab::Event(e)
+{
+}
+
Event::~Event()
{
diff --git a/calendaring/event.h b/calendaring/event.h
index 4657637..e5e2a7a 100644
--- a/calendaring/event.h
+++ b/calendaring/event.h
@@ -35,6 +35,7 @@ class KOLAB_EXPORT Event: public Kolab::Event
{
public:
Event();
+ Event(const Kolab::Event &);
~Event();
bool read(const std::string &);
More information about the commits
mailing list