Add internal configuration file, add missing includes, rename some options

This commit is contained in:
2024-06-12 12:09:59 +03:00
parent 5762484550
commit bfa33b3778
15 changed files with 47 additions and 17 deletions

View File

@@ -10,6 +10,9 @@ include(CheckIPOSupported)
include(CheckIncludeFile)
include(CheckSymbolExists)
# Project settings
option(BH_PLATFORM_THREADS "Enable multithreading support" TRUE)
# Check for IPO/LTO
check_ipo_supported(RESULT supported)
@@ -55,6 +58,7 @@ set(BH_INCLUDE_DIRS
if(WIN32)
message(STATUS "Platform - Win32")
set(BH_PLATFORM_WIN TRUE)
option(BH_THREADS_WINXP "Enable threading support for Windows XP" FALSE)
# Add platform dependent files
list(APPEND BH_SOURCE
@@ -62,8 +66,11 @@ if(WIN32)
)
# Check multithreading support
check_symbol_exists(_beginthread process.h BH_USE_WINTHREAD)
if(BH_USE_WINTHREAD)
if(BH_PLATFORM_THREADS)
check_symbol_exists(_beginthread process.h BH_PLATFORM_THREADS)
endif()
if(BH_PLATFORM_THREADS)
message(STATUS "Multithreading enabled")
list(APPEND BH_SOURCE
src/thread_win.c
@@ -75,7 +82,7 @@ if(WIN32)
)
endif()
if(BH_NO_WINXP)
if(NOT BH_THREADS_WINXP)
add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_VISTA -DWINVER=_WIN32_WINNT_VISTA)
endif()
elseif(UNIX)
@@ -88,8 +95,11 @@ elseif(UNIX)
)
# Check multithreading support
check_include_file(pthread.h BH_USE_PTHREAD)
if(BH_USE_PTHREAD)
if(BH_PLATFORM_THREADS)
check_include_file(pthread.h BH_PLATFORM_THREADS)
endif()
if(BH_PLATFORM_THREADS)
message(STATUS "Multithreading enabled")
list(APPEND BH_SOURCE
src/thread_posix.c
@@ -111,6 +121,7 @@ endif()
# Configure library
configure_file(include/bh/config.in include/bh/config.h)
configure_file(include/bh/internal/config.in include/bh/internal/config.h)
# Library
add_library(bhlib STATIC ${BH_SOURCE} ${BH_HEADER})