Fix and simplify CMakeLists.txt

This commit is contained in:
2025-07-30 18:39:51 +03:00
parent da5a4cb483
commit d0230c3b30
2 changed files with 18 additions and 55 deletions

View File

@@ -52,6 +52,8 @@ set(ENABLE_COVERAGE OFF CACHE BOOL "Enable coverage")
set(ENABLE_EXAMPLES ON CACHE BOOL "Enable building examples") set(ENABLE_EXAMPLES ON CACHE BOOL "Enable building examples")
set(ENABLE_LTO ON CACHE BOOL "Enable LTO support") set(ENABLE_LTO ON CACHE BOOL "Enable LTO support")
set(ENABLE_MT ON CACHE BOOL "Enable multithreading support") set(ENABLE_MT ON CACHE BOOL "Enable multithreading support")
set(USE_CLOCK_GETTIME OFF CACHE BOOL "Force use clock gettime")
set(BH_ENABLE_LFS OFF CACHE BOOL "Enable long file support")
# Enable IPO/LTO # Enable IPO/LTO
if(ENABLE_LTO) if(ENABLE_LTO)
@@ -77,63 +79,15 @@ if(ENABLE_TESTING)
endif() endif()
# Set library code # Set library code
set(BH_SOURCE file(GLOB BH_SOURCE
src/Algo.c "src/*.c"
src/Args.c "src/Math/*.c"
src/Buffer.c "src/String/*.c"
src/Bytes.c
src/Color.c
src/Hashmap.c
src/IO.c
src/Math/Box2f.c
src/Math/Box3f.c
src/Math/Line.c
src/Math/Mat3f.c
src/Math/Mat4f.c
src/Math/Misc.c
src/Math/Plane.c
src/Math/Quat4f.c
src/Math/Ray2f.c
src/Math/Ray3f.c
src/Math/Vec2f.c
src/Math/Vec2i.c
src/Math/Vec3f.c
src/Math/Vec3i.c
src/Math/Vec4f.c
src/Math/Vec4i.c
src/Queue.c
src/String/Float.c
src/String/Int.c
src/String/Unicode.c
src/Util.c
) )
set(BH_HEADER file(GLOB BH_HEADER
include/BH/Algo.h "include/BH/*.h"
include/BH/Args.h "include/BH/Math/*.h"
include/BH/Color.h
include/BH/Common.h
include/BH/Hashmap.h
include/BH/IO.h
include/BH/Math/Box2f.h
include/BH/Math/Box3f.h
include/BH/Math/Line.h
include/BH/Math/Mat3f.h
include/BH/Math/Mat4f.h
include/BH/Math/Misc.h
include/BH/Math/Plane.h
include/BH/Math/Quat.h
include/BH/Math/Ray2f.h
include/BH/Math/Ray3f.h
include/BH/Math/Vec2f.h
include/BH/Math/Vec2i.h
include/BH/Math/Vec3f.h
include/BH/Math/Vec3i.h
include/BH/Math/Vec4f.h
include/BH/Math/Vec4i.h
include/BH/Queue.h
include/BH/Thread.h
include/BH/Util.h
) )
set(BH_SOURCE_DUMMY set(BH_SOURCE_DUMMY
@@ -232,6 +186,8 @@ endif()
add_library(BHLib STATIC ${BH_SOURCE} ${BH_HEADER}) add_library(BHLib STATIC ${BH_SOURCE} ${BH_HEADER})
target_include_directories(BHLib PUBLIC ${BH_INCLUDE_DIRS}) target_include_directories(BHLib PUBLIC ${BH_INCLUDE_DIRS})
target_link_libraries(BHLib PUBLIC m) target_link_libraries(BHLib PUBLIC m)
configure_file(Config.cmake Config.h @ONLY)
target_include_directories(BHLib PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# Enable all compiler warnings # Enable all compiler warnings
if(MSVC) if(MSVC)

7
Config.cmake Normal file
View File

@@ -0,0 +1,7 @@
#ifndef BH_SRC_CONFIG_H
#define BH_SRC_CONFIG_H
#cmakedefine BH_USE_CLOCK_GETTIME
#cmakedefine BH_ENABLE_LFS
#endif /* BH_SRC_CONFIG_H */