shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
661 stars 131 forks source link

add static build config. #510

Closed xuhancn closed 7 months ago

xuhancn commented 8 months ago
  1. Add "SLEEF_BUILD_SHARED_LIBS" to instead of CMake reserved variable "BUILD_SHARED_LIBS".
  2. Add clear library type to add_library, it will remove the global control from "BUILD_SHARED_LIBS", Link: https://cmake.org/cmake/help/latest/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html
  3. remove install to dummy dir, it will make git dirty.

Why we avoid to use BUILD_SHARED_LIBS and add_library without STATIC/SHARED parameter. Please check the offical document Note part. image

Additional, I write a test project to test this PR: https://github.com/xuhancn/sleef_cmake_example Turn on/off this line to control the build type. https://github.com/xuhancn/sleef_cmake_example/blob/main/CMakeLists.txt#L14

Static:

image

Shared:

image