diff --git a/ports/libmicrohttpd/CMakeLists.txt b/ports/libmicrohttpd/CMakeLists.txt new file mode 100644 index 0000000000..d76c09122c --- /dev/null +++ b/ports/libmicrohttpd/CMakeLists.txt @@ -0,0 +1,78 @@ +cmake_minimum_required(VERSION 3.8) +project(libmicrohttpd C) + +if(MSVC) + add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) +endif() + +set(MIN_SRC contrib/libmicrohttpd) + + +set(SRC + src/microhttpd/base64.c + src/microhttpd/basicauth.c + src/microhttpd/connection.c + src/microhttpd/daemon.c + src/microhttpd/digestauth.c + src/microhttpd/internal.c + src/microhttpd/md5.c + src/microhttpd/memorypool.c + src/microhttpd/mhd_mono_clock.c + src/microhttpd/postprocessor.c + src/microhttpd/reason_phrase.c + src/microhttpd/response.c + src/microhttpd/tsearch.c + src/microhttpd/sysfdsetsize.c + src/microhttpd/mhd_str.c + src/microhttpd/mhd_threads.c + src/microhttpd/mhd_sockets.c + src/microhttpd/mhd_itc.c + src/microhttpd/mhd_compat.c +) +set(HEADERS + src/microhttpd/base64.h + src/microhttpd/connection.h + src/microhttpd/internal.h + src/microhttpd/md5.h + src/microhttpd/memorypool.h + src/microhttpd/mhd_byteorder.h + src/microhttpd/mhd_limits.h + src/microhttpd/mhd_mono_clock.h + src/microhttpd/response.h + src/microhttpd/tsearch.h + src/microhttpd/sysfdsetsize.h + src/microhttpd/mhd_str.h + src/microhttpd/mhd_threads.h + src/microhttpd/mhd_locks.h + src/microhttpd/mhd_sockets.h + src/microhttpd/mhd_itc.h + src/microhttpd/mhd_itc_types.h + src/microhttpd/mhd_compat.h +) + +if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +include_directories(${HEADERS} src/include w32/common) + +add_library(libmicrohttpd ${SRC}) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(libmicrohttpd PRIVATE -DMHD_W32DLL) +else() + target_compile_definitions(libmicrohttpd PRIVATE -DMHD_W32LIB) +endif() + + target_link_libraries(libmicrohttpd ws2_32) + +install( + TARGETS libmicrohttpd + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES src/include/microhttpd.h DESTINATION include) +endif() diff --git a/ports/libmicrohttpd/CONTROL b/ports/libmicrohttpd/CONTROL new file mode 100644 index 0000000000..a5b6730cf5 --- /dev/null +++ b/ports/libmicrohttpd/CONTROL @@ -0,0 +1,3 @@ +Source: libmicrohttpd +Version: 0.9.55 +Description: GNU libmicrohttpd is a small C library that is supposed to make it easy to run an HTTP server as part of another application diff --git a/ports/libmicrohttpd/portfile.cmake b/ports/libmicrohttpd/portfile.cmake new file mode 100644 index 0000000000..8b11e3e9cc --- /dev/null +++ b/ports/libmicrohttpd/portfile.cmake @@ -0,0 +1,23 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libmicrohttpd-0.9.55) +vcpkg_download_distfile(ARCHIVE + URLS "ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.55.tar.gz" + FILENAME "libmicrohttpd-0.9.55.tar.gz" + SHA512 b410e7253d7c98c40b5e8b8dcd1f93bcbb05c88717190e8dae73073d36465e8e5cfa53c6c5098de60051a5ec64dc423fd94f4b06537d8146b744aa99f5a0b173 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmicrohttpd RENAME copyright)