diff --git a/CMakeLists.txt b/CMakeLists.txt index 96d6c6a9..1c42c618 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,9 @@ add_subdirectory(trantor) target_link_libraries(${PROJECT_NAME} PUBLIC trantor) if(NOT WIN32) - target_link_libraries(${PROJECT_NAME} PRIVATE dl) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") + target_link_libraries(${PROJECT_NAME} PRIVATE dl) + endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") else(NOT WIN32) target_link_libraries(${PROJECT_NAME} PRIVATE shlwapi) endif(NOT WIN32) @@ -100,7 +102,7 @@ find_package(Jsoncpp REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC Jsoncpp_lib) list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${JSONCPP_INCLUDE_DIRS}) -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT WIN32) +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32) find_package(UUID REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE UUID_lib) @@ -117,7 +119,7 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT WIN32) else() message(FATAL_ERROR "uuid lib error") endif() -endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT WIN32) +endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32) find_package(Brotli) if(Brotli_FOUND) diff --git a/cmake/templates/DrogonConfig.cmake.in b/cmake/templates/DrogonConfig.cmake.in index 21365e5b..afce825b 100644 --- a/cmake/templates/DrogonConfig.cmake.in +++ b/cmake/templates/DrogonConfig.cmake.in @@ -14,9 +14,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) find_dependency(Jsoncpp REQUIRED) find_dependency(Trantor REQUIRED) -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT WIN32) +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32) find_dependency(UUID REQUIRED) -endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT WIN32) +endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32) find_dependency(ZLIB REQUIRED) if(@pg_FOUND@) find_dependency(pg) diff --git a/lib/src/Utilities.cc b/lib/src/Utilities.cc index dd72b104..b285f05e 100644 --- a/lib/src/Utilities.cc +++ b/lib/src/Utilities.cc @@ -344,10 +344,15 @@ std::string getUuid() std::string ret{binaryStringToHex((const unsigned char *)str, len)}; free(str); return ret; -#elif defined __FreeBSD__ +#elif defined __FreeBSD__ || defined __OpenBSD__ uuid_t *uuid = new uuid_t; char *binstr = (char *)malloc(16); +#if defined __FreeBSD__ uuidgen(uuid, 1); +#else + uint32_t status; + uuid_create(uuid, &status); +#endif #if _BYTE_ORDER == _LITTLE_ENDIAN uuid_enc_le(binstr, uuid); #else /* _BYTE_ORDER != _LITTLE_ENDIAN */ diff --git a/orm_lib/inc/drogon/orm/SqlBinder.h b/orm_lib/inc/drogon/orm/SqlBinder.h index dbee0d44..5c251a8e 100644 --- a/orm_lib/inc/drogon/orm/SqlBinder.h +++ b/orm_lib/inc/drogon/orm/SqlBinder.h @@ -35,11 +35,11 @@ #include #endif -#if defined __linux__ || defined __FreeBSD__ +#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__ #ifdef __linux__ #include // __BYTE_ORDER __LITTLE_ENDIAN -#elif defined __FreeBSD__ +#elif defined __FreeBSD__ || defined __OpenBSD__ #include // _BYTE_ORDER _LITTLE_ENDIAN #define __BYTE_ORDER _BYTE_ORDER #define __LITTLE_ENDIAN _LITTLE_ENDIAN diff --git a/trantor b/trantor index 28371795..b2902d21 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit 28371795d6479a77771a2b25fc310795872bae46 +Subproject commit b2902d217b9f0a59c428bff1ca6ccfe024a86aa6