Commit b64ed01b authored by Ghislain MARY's avatar Ghislain MARY

Fix build on Windows.

parent 1d092f58
......@@ -92,20 +92,14 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
set(LIBS ${BCTOOLBOX_CORE_LIBRARIES})
if(SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
list(APPEND LIBS ${SQLITE3_LIBRARIES})
if(ENABLE_ZIDCACHE)
add_definitions("-DZIDCACHE_ENABLED")
endif()
endif()
if(MSVC)
include_directories(${MSVC_INCLUDE_DIR})
endif()
if(ENABLE_ZIDCACHE)
add_definitions("-DZIDCACHE_ENABLED")
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(EXPORT_TARGETS_NAME "LinphoneBuilder")
......
......@@ -473,6 +473,6 @@ BZRTP_EXPORT int bzrtp_cache_read(void *dbPointer, int zuid, char *tableName, ch
*
* @return 0 on succes, error code otherwise
*/
int bzrtp_exportKey(bzrtpContext_t *zrtpContext, char *label, size_t labelLength, uint8_t *derivedKey, size_t *derivedKeyLength);
BZRTP_EXPORT int bzrtp_exportKey(bzrtpContext_t *zrtpContext, char *label, size_t labelLength, uint8_t *derivedKey, size_t *derivedKeyLength);
#endif /* ifndef BZRTP_H */
......@@ -36,10 +36,17 @@ endif()
bc_apply_compile_flags(SOURCE_FILES STRICT_OPTIONS_CPP)
set(INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS})
set(LIBS ${BCTOOLBOX_CORE_LIBRARIES})
if(SQLITE3_FOUND)
list(APPEND INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
list(APPEND LIBS ${SQLITE3_LIBRARIES})
endif()
if(ENABLE_STATIC)
add_library(bzrtp-static STATIC ${SOURCE_FILES})
set_target_properties(bzrtp-static PROPERTIES OUTPUT_NAME bzrtp)
target_include_directories(bzrtp-static PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_include_directories(bzrtp-static PUBLIC ${INCLUDE_DIRS})
target_link_libraries(bzrtp-static INTERFACE ${LIBS})
install(TARGETS bzrtp-static EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......@@ -50,7 +57,7 @@ if(ENABLE_SHARED)
add_library(bzrtp SHARED ${SOURCE_FILES})
target_compile_definitions(bzrtp PRIVATE "-DBZRTP_EXPORTS")
set_target_properties(bzrtp PROPERTIES VERSION 0)
target_include_directories(bzrtp PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_include_directories(bzrtp PUBLIC ${INCLUDE_DIRS})
target_link_libraries(bzrtp PRIVATE ${LIBS})
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
......
......@@ -34,6 +34,12 @@
#ifdef ZIDCACHE_ENABLED
#include "sqlite3.h"
#ifdef _WIN32
#include <malloc.h>
#else
#include <alloca.h>
#endif
/* define a version number for the DB schema as an interger MMmmpp */
/* current version is 0.0.1 */
#define ZIDCACHE_DBSCHEMA_VERSION_NUMBER 000001
......@@ -504,7 +510,7 @@ int bzrtp_cache_write(void *dbPointer, int zuid, char *tableName, char **columns
/* now check we managed to update a row */
if (sqlite3_changes(db)==0) { /* update failed: we must insert the row */
char valuesBindingString[2*columnsCount+3];
char *valuesBindingString = alloca(2*columnsCount+3);
insertColumnsStringLength+=6; /* +6 to add the initial 'zuid, ' to column list */
insertColumnsString = (char *)malloc(insertColumnsStringLength+6);
sqlite3_snprintf(insertColumnsStringLength,insertColumnsString,"%w","zuid");
......
......@@ -41,12 +41,13 @@ else()
target_link_libraries(bzrtpTest bzrtp)
endif()
target_link_libraries(bzrtpTest ${BCTOOLBOX_LIBRARIES})
if(HAVE_SQRT)
target_link_libraries(bzrtpTest m)
endif()
if(SQLITE3_FOUND)
target_include_directories(bzrtpTest PUBLIC ${SQLITE3_INCLUDE_DIRS})
target_link_libraries(bzrtpTest ${SQLITE3_LIBRARIES})
endif()
if(HAVE_SQRT)
target_link_libraries(bzrtpTest m)
endif()
unset(PATTERN_FILES_IN_TEST_DIR CACHE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment