csync/std: don't build in a separate library

There is no need to create a static library for the csync/std file, just
put everything together in csync
This commit is contained in:
Olivier Goffart 2017-12-14 12:50:11 +01:00 committed by Dominik Schmidt
parent 776bbbf7b1
commit 48c55b7d29
3 changed files with 22 additions and 59 deletions

View file

@ -23,26 +23,22 @@ find_package(SQLite3 3.8.0 REQUIRED)
include(ConfigureChecks.cmake)
include(../common/common.cmake)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if (MEM_NULL_TESTS)
add_definitions(-DCSYNC_MEM_NULL_TESTS)
endif (MEM_NULL_TESTS)
add_subdirectory(std)
# Statically include sqlite
set(CSYNC_PUBLIC_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/std
${CMAKE_SOURCE_DIR}
CACHE INTERNAL "csync public include directories"
)
set(CSYNC_PRIVATE_INCLUDE_DIRS
${SQLITE3_INCLUDE_DIRS}
${CSTDLIB_PUBLIC_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
)
@ -52,7 +48,6 @@ set(CSYNC_LIBRARY
)
set(CSYNC_LINK_LIBRARIES
${CSTDLIB_LIBRARY}
${CSYNC_REQUIRED_LIBRARIES}
${SQLITE3_LIBRARIES}
)
@ -77,6 +72,13 @@ set(csync_SRCS
csync_rename.cpp
vio/csync_vio.cpp
std/c_alloc.c
std/c_path.c
std/c_string.c
std/c_time.c
std/c_utf8.cpp
)
if (WIN32)
@ -89,16 +91,13 @@ else()
)
endif()
if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
list(APPEND csync_SRCS std/asprintf.c)
endif()
configure_file(csync_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/csync_version.h)
set(csync_HDRS
${CMAKE_CURRENT_BINARY_DIR}/csync_version.h
csync.h
vio/csync_vio.h
vio/csync_vio_method.h
vio/csync_vio_module.h
)
# Statically include sqlite
if (USE_OUR_OWN_SQLITE3)
@ -112,14 +111,16 @@ if (USE_OUR_OWN_SQLITE3)
endif()
endif()
include_directories(
${CSYNC_PUBLIC_INCLUDE_DIRS}
${CSYNC_PRIVATE_INCLUDE_DIRS}
)
add_library(${CSYNC_LIBRARY} SHARED ${common_SOURCES} ${csync_SRCS})
#add_library(${CSYNC_LIBRARY}_static STATIC ${csync_SRCS})
target_include_directories(
${CSYNC_LIBRARY}
PUBLIC ${CSYNC_PUBLIC_INCLUDE_DIRS}
PRIVATE ${CSYNC_PRIVATE_INCLUDE_DIRS}
)
generate_export_header( ${CSYNC_LIBRARY}
EXPORT_MACRO_NAME OCSYNC_EXPORT
EXPORT_FILE_NAME ocsynclib.h
@ -129,8 +130,7 @@ target_link_libraries(${CSYNC_LIBRARY} ${CSYNC_LINK_LIBRARIES})
#target_link_libraries(${CSYNC_LIBRARY}_static ${CSYNC_LINK_LIBRARIES})
if(ZLIB_FOUND)
target_link_libraries(${CSYNC_LIBRARY} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(${CSYNC_LIBRARY} ZLIB::ZLIB)
endif(ZLIB_FOUND)
find_package(Qt5Core REQUIRED)

View file

@ -1,39 +0,0 @@
project(cstdlib)
set(CSTDLIB_PUBLIC_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
CACHE INTERNAL "cstdlib public include directories"
)
set(CSTDLIB_LIBRARY
cstdlib
CACHE INTERNAL "cstdlib library"
)
set(CSTDLIB_LINK_LIBRARIES
${CSTDLIB_LIBRARY}
)
set(cstdlib_SRCS
c_alloc.c
c_path.c
c_string.c
c_time.c
c_utf8.cpp
)
if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
list(APPEND cstdlib_SRCS
asprintf.c
)
endif()
include_directories(
${CSTDLIB_PUBLIC_INCLUDE_DIRS}
)
add_library(${CSTDLIB_LIBRARY} STATIC ${cstdlib_SRCS})
if(NOT WIN32)
add_definitions( -fPIC )
endif()
qt5_use_modules(${CSTDLIB_LIBRARY} Core)

View file

@ -21,6 +21,8 @@
#ifndef _C_TIME_H
#define _C_TIME_H
#include "ocsynclib.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -58,7 +60,7 @@ struct timespec c_tspecdiff(struct timespec time1, struct timespec time0);
*/
double c_secdiff(struct timespec clock1, struct timespec clock0);
int c_utimes(const char *uri, const struct timeval *times);
OCSYNC_EXPORT int c_utimes(const char *uri, const struct timeval *times);
#ifdef __cplusplus
}