Build related improvements (additional)

This commit is contained in:
kobalicek
2023-12-01 21:51:18 +01:00
parent 803712f111
commit e731f57975

View File

@@ -301,12 +301,22 @@ if (ASMJIT_SANITIZE)
endif() endif()
endif() endif()
if (NOT WIN32) if (WIN32)
# Dependency: nothing extra at the moment.
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
# Dependency: libc is the only required library on Android as it also provides libthread.
message("-- Dependency: adding libc (Android target detected)")
list(APPEND ASMJIT_DEPS c)
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
# Dependency: libroot is used by Haiku instead of libc, so link to libroot and libpthread.
message("-- Dependency: adding libroot and libpthread (Haiku target detected)")
list(APPEND ASMJIT_DEPS root pthread)
else()
# Dependency: libc is always required. # Dependency: libc is always required.
message("-- Dependency: adding libc (Linux, BSD, or other UNIX/POSIX environment)")
list(APPEND ASMJIT_DEPS c) list(APPEND ASMJIT_DEPS c)
# Dependency: pthread (required so AsmJit can use pthread_lock). # Dependency: pthread (required so AsmJit can use pthread_lock).
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "^(Android)$")
check_cxx_source_compiles(" check_cxx_source_compiles("
#include <pthread.h> #include <pthread.h>
int main() { int main() {
@@ -314,14 +324,13 @@ if (NOT WIN32)
pthread_mutex_init(&m, nullptr); pthread_mutex_init(&m, nullptr);
return pthread_mutex_destroy(&m); return pthread_mutex_destroy(&m);
} }
" ASMJIT_LIBC_HAS_PTHREAD) " ASMJIT_LIBC_HAS_LIBPTHREAD)
if (ASMJIT_LIBC_HAS_PTHREAD) if (ASMJIT_LIBC_HAS_LIBPTHREAD)
message("-- Dependency: pthread provided by libc (not linking to libpthread)") message("-- Dependency: libpthread provided by libc (not linking to libpthread)")
else() else()
message("-- Dependency: pthread not provided by libc, linking to libpthread") message("-- Dependency: libpthread not provided by libc, linking to libpthread")
list(APPEND ASMJIT_DEPS pthread) list(APPEND ASMJIT_DEPS pthread)
endif() endif()
endif()
# Dependency: shm_open (required so AsmJit can use shm_open on supported platforms). # Dependency: shm_open (required so AsmJit can use shm_open on supported platforms).
if ("${CMAKE_SYSTEM_NAME}" MATCHES "^(Linux|NetBSD)$" AND NOT ASMJIT_NO_SHM_OPEN) if ("${CMAKE_SYSTEM_NAME}" MATCHES "^(Linux|NetBSD)$" AND NOT ASMJIT_NO_SHM_OPEN)
@@ -331,8 +340,8 @@ if (NOT WIN32)
const char file_name[1] {}; const char file_name[1] {};
return shm_open(file_name, 0, 0); return shm_open(file_name, 0, 0);
} }
" ASMJIT_LIBC_HAS_SHM_OPEN) " ASMJIT_LIBC_HAS_LIBRT)
if (ASMJIT_LIBC_HAS_SHM_OPEN) if (ASMJIT_LIBC_HAS_LIBRT)
message("-- Dependency: shm_open provided by libc (not linking to librt)") message("-- Dependency: shm_open provided by libc (not linking to librt)")
else() else()
message("-- Dependency: shm_open not provided by libc, linking to librt") message("-- Dependency: shm_open not provided by libc, linking to librt")