From 62bf58dd2db7a94666c19f0dca4bbf94bb0e536e Mon Sep 17 00:00:00 2001 From: PrimedErwin <1973609350@qq.com> Date: Thu, 22 May 2025 16:32:54 +0800 Subject: [PATCH] update cmakelists --- CMakeLists.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73231325..bfe81793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(MSVC) add_definitions(-DNDEBUG) endif() - if(PK_ENABLE_DETERMINISM) + if(PK_ENABLE_DETERMINISTIC_FLOAT) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Oi-") endif() else() @@ -35,7 +35,7 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shorten-64-to-32") endif() - if(PK_ENABLE_DETERMINISM) + if(PK_ENABLE_DETERMINISTIC_FLOAT) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexcess-precision=standard -ffp-contract=off") endif() endif() @@ -52,10 +52,7 @@ option(PK_ENABLE_DETERMINISTIC_FLOAT "" OFF) if(PK_ENABLE_DETERMINISTIC_FLOAT) add_subdirectory(3rd/math) include_directories(3rd/math) - add_definitions(-DPK_ENABLE_DETERMINISTIC_FLOAT) - if(NOT MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexcess-precision=standard -ffp-contract=off") - endif() + add_definitions(-DPK_ENABLE_DETERMINISTIC_FLOAT=1) endif() if(PK_ENABLE_WATCHDOG) @@ -94,7 +91,7 @@ else() endif() if(UNIX AND NOT APPLE) - if(NOT PK_ENABLE_DETERMINISM) + if(NOT PK_ENABLE_DETERMINISTIC_FLOAT) # use platform libm target_link_libraries(${PROJECT_NAME} m) endif() @@ -114,6 +111,10 @@ endif() ############################################ +if(PK_ENABLE_DETERMINISTIC_FLOAT) + target_link_libraries(${PROJECT_NAME} musl_math) +endif() + if(PK_BUILD_MODULE_LZ4) target_link_libraries(${PROJECT_NAME} lz4) endif() @@ -121,7 +122,3 @@ endif() if(PK_BUILD_MODULE_LIBHV) target_link_libraries(${PROJECT_NAME} libhv_bindings) endif() - -if(PK_ENABLE_DETERMINISTIC_FLOAT) - target_link_libraries(${PROJECT_NAME} musl_math) -endif() \ No newline at end of file