mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
cmake update
This commit is contained in:
parent
47484a3b68
commit
322dd67c77
@ -8,11 +8,13 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_LIST_DIR}/src MUSL_LIBC_MATH_SRC)
|
||||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise /Od /Oi-")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise /Ox /Oi-")
|
||||
# mute warning C4723: div by 0 because some function returns nan when a input is nan.
|
||||
add_compile_options( /wd4723)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffp-model=strict")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffp-model=strict -O2")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${MUSL_LIBC_MATH_SRC})
|
||||
|
@ -45,11 +45,11 @@ if(PK_ENABLE_OS)
|
||||
add_definitions(-DPK_ENABLE_OS=1)
|
||||
endif()
|
||||
|
||||
option(USE_MUSL_LIBC_MATH "" OFF)
|
||||
if(USE_MUSL_LIBC_MATH)
|
||||
option(PK_ENABLE_DETERMINISTIC_FLOAT "" OFF)
|
||||
if(PK_ENABLE_DETERMINISTIC_FLOAT)
|
||||
add_subdirectory(3rd/math)
|
||||
include_directories(3rd/math)
|
||||
add_definitions(-DUSE_MUSL_LIBC_MATH)
|
||||
add_definitions(-DPK_ENABLE_DETERMINISTIC_FLOAT)
|
||||
endif()
|
||||
|
||||
option(PK_BUILD_MODULE_LZ4 "" OFF)
|
||||
@ -122,6 +122,6 @@ if(PK_BUILD_MODULE_LIBHV)
|
||||
target_link_libraries(${PROJECT_NAME} libhv_bindings)
|
||||
endif()
|
||||
|
||||
if(USE_MUSL_LIBC_MATH)
|
||||
if(PK_ENABLE_DETERMINISTIC_FLOAT)
|
||||
target_link_libraries(${PROJECT_NAME} musl_math)
|
||||
endif()
|
@ -20,7 +20,7 @@ assert config in ['Debug', 'Release', 'RelWithDebInfo']
|
||||
|
||||
os.chdir("build")
|
||||
|
||||
code = os.system(f"cmake .. -DPK_ENABLE_OS=ON -DPK_BUILD_MODULE_LZ4=ON -DUSE_MUSL_LIBC_MATH=ON -DCMAKE_BUILD_TYPE={config} {extra_flags}")
|
||||
code = os.system(f"cmake .. -DPK_ENABLE_OS=ON -DPK_BUILD_MODULE_LZ4=OFF -DPK_ENABLE_DETERMINISTIC_FLOAT=ON -DCMAKE_BUILD_TYPE={config} {extra_flags}")
|
||||
assert code == 0
|
||||
code = os.system(f"cmake --build . --config {config} -j 4")
|
||||
assert code == 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef USE_MUSL_LIBC_MATH
|
||||
#ifndef PK_ENABLE_DETERMINISTIC_FLOAT
|
||||
#include <math.h>
|
||||
#else
|
||||
#include "include/math.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user