Skip to content

Commit

Permalink
fix build on MinGW-w64 and MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
Adsun701 committed Aug 19, 2019
1 parent b87070b commit 75e9936
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ add_test(NAME hashtable_test COMMAND hashtable_test)
add_executable(sumset_test
tests/sumset_test.c src/sumset.c src/util.c src/trace.c src/hex.c
src/checksum.c src/rollsum.c src/mdfour.c src/hashtable.c ${blake2_SRCS})
target_compile_options(sumset_test PRIVATE -Drsync_EXPORTS)
target_link_libraries(sumset_test ${blake2_LIBS})
add_test(NAME sumset_test COMMAND sumset_test)

Expand Down Expand Up @@ -361,7 +362,11 @@ set_target_properties(rsync PROPERTIES
VERSION ${LIBRSYNC_VERSION}
SOVERSION ${LIBRSYNC_MAJOR_VERSION}
C_VISIBILITY_PRESET hidden)
install(TARGETS rsync ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS rsync ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)


########### next target ###############
Expand All @@ -377,8 +382,13 @@ if (BUILD_RDIFF)
else (POPT_FOUND)
message (WARNING "Popt library is required for rdiff target")
endif (POPT_FOUND)
target_compile_options(rdiff PRIVATE -Drsync_EXPORTS)

install(TARGETS rdiff ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS rdiff ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif (BUILD_RDIFF)


Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

NOT RELEASED YET

* Fix MSVC builds by adding missing LIBRSYNC_EXPORT to variables in
librsync.h, add -Drsync_EXPORTS to the sumset_test and rdiff targets,
and correctly install .dll files in the bin directory. (adsun701,
https://github.com/librsync/librsync/pull/161)

## librsync 2.1.0

Released 2019-08-19
Expand Down
4 changes: 2 additions & 2 deletions src/librsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ typedef struct rs_stats {
* \sa rs_mdfour(), rs_mdfour_begin(), rs_mdfour_update(), rs_mdfour_result() */
typedef struct rs_mdfour rs_mdfour_t;

extern const int RS_MD4_SUM_LENGTH, RS_BLAKE2_SUM_LENGTH;
LIBRSYNC_EXPORT extern const int RS_MD4_SUM_LENGTH, RS_BLAKE2_SUM_LENGTH;

# define RS_MAX_STRONG_SUM_LENGTH 32

Expand Down Expand Up @@ -493,7 +493,7 @@ LIBRSYNC_EXPORT rs_result rs_file_copy_cb(void *arg, rs_long_t pos, size_t *len,
* The default 0 means use the recommended buffer size for the operation being
* performed, any other value will override the recommended sizes. You probably
* only need to change these in testing. */
extern int rs_inbuflen, rs_outbuflen;
LIBRSYNC_EXPORT extern int rs_inbuflen, rs_outbuflen;

/** Generate the signature of a basis file, and write it out to another.
*
Expand Down

0 comments on commit 75e9936

Please sign in to comment.