Fix FreeBSD build

This commit is contained in:
Hanicef 2024-04-27 16:40:11 +02:00
parent 2eae5b2ef6
commit 99550f97bd
4 changed files with 9 additions and 3 deletions

View file

@ -34,6 +34,8 @@ if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
set(SRB2_CPACK_GENERATOR "TGZ") set(SRB2_CPACK_GENERATOR "TGZ")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(SRB2_CPACK_GENERATOR "TGZ") set(SRB2_CPACK_GENERATOR "TGZ")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
set(SRB2_CPACK_GENERATOR "TGZ")
endif() endif()
endif() endif()

View file

@ -256,6 +256,10 @@ endif()
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB) target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB)
target_link_libraries(SRB2SDL2 PRIVATE PNG::PNG) target_link_libraries(SRB2SDL2 PRIVATE PNG::PNG)
target_link_libraries(SRB2SDL2 PRIVATE CURL::libcurl) target_link_libraries(SRB2SDL2 PRIVATE CURL::libcurl)
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
target_link_libraries(SRB2SDL2 PRIVATE -lexecinfo)
target_link_libraries(SRB2SDL2 PRIVATE -lpthread)
endif()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE)
target_sources(SRB2SDL2 PRIVATE apng.c) target_sources(SRB2SDL2 PRIVATE apng.c)

View file

@ -172,7 +172,7 @@ static int portable_fseek64(FILE* file, int64_t offset, int origin)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
return _fseeki64(file, offset, origin); return _fseeki64(file, offset, origin);
#elif __APPLE__ #elif __APPLE__ || defined(__FreeBSD__)
return fseeko(file, offset, origin); return fseeko(file, offset, origin);
#else #else
return fseeko64(file, offset, origin); return fseeko64(file, offset, origin);
@ -183,7 +183,7 @@ static int64_t portable_ftell64(FILE* file)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
return _ftelli64(file); return _ftelli64(file);
#elif __APPLE__ #elif __APPLE__ || defined(__FreeBSD__)
return ftello(file); return ftello(file);
#else #else
return ftello64(file); return ftello64(file);

View file

@ -14,7 +14,7 @@
#include <vector> #include <vector>
#if defined (__linux__) #if defined (__linux__) || defined (__FreeBSD__)
#include <sys/random.h> #include <sys/random.h>
#elif defined (_WIN32) #elif defined (_WIN32)
#define _CRT_RAND_S #define _CRT_RAND_S