This commit is contained in:
2025-12-09 02:34:16 +05:30
parent 3ed23336e2
commit 71d83859f5
4 changed files with 44 additions and 44 deletions

View File

@ -1,5 +1,7 @@
include(FetchContent)
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Force static libs")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=int-conversion")
add_compile_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
@ -37,8 +39,8 @@ FetchContent_Declare(
FetchContent_Declare(
ZLIB
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.3.1
GIT_REPOSITORY https://github.com/zlib-ng/zlib-ng.git
GIT_TAG 2.3.2
SYSTEM
EXCLUDE_FROM_ALL
)
@ -52,16 +54,16 @@ FetchContent_Declare(
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
mimalloc
GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
GIT_TAG v3.0.10
SYSTEM
EXCLUDE_FROM_ALL
PATCH_COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=<SOURCE_DIR>
-P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/PatchMimalloc.cmake
)
#FetchContent_Declare(
# mimalloc
# GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
# GIT_TAG v3.0.10
# SYSTEM
# EXCLUDE_FROM_ALL
# PATCH_COMMAND ${CMAKE_COMMAND}
# -DSOURCE_DIR=<SOURCE_DIR>
# -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/PatchMimalloc.cmake
#)
FetchContent_Declare(
tl-expected
@ -79,19 +81,23 @@ FetchContent_Declare(
EXCLUDE_FROM_ALL
)
set(MI_BUILD_SHARED ON CACHE BOOL "" FORCE)
set(MI_BUILD_STATIC ON CACHE BOOL "" FORCE)
set(MI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
#set(MI_OVERRIDE ON CACHE BOOL "" FORCE)
#set(MI_BUILD_STATIC ON CACHE BOOL "" FORCE)
#set(MI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
#set(MI_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(EXPECTED_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(HTTPLIB_REQUIRE_OPENSSL OFF CACHE BOOL "" FORCE)
set(HTTPLIB_REQUIRE_ZLIB OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(httplib nlohmann_json glaze simdjson ZLIB zstd mimalloc tl-expected unordered_dense)
set(ZSTD_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(ZSTD_BUILD_STATIC ON CACHE BOOL "" FORCE)
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
endif()
set(ZLIB_COMPAT ON CACHE BOOL "" FORCE)
set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(httplib nlohmann_json glaze simdjson ZLIB zstd tl-expected unordered_dense #mimalloc
)
find_package(OpenSSL REQUIRED)

View File

@ -18,18 +18,7 @@ include(CMake/FindDeps.cmake)
# Default to ON if root, OFF if dependency
option(IACore_BUILD_TESTS "Build unit tests" ${PROJECT_IS_TOP_LEVEL})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Configuring IACore for Debug..")
add_compile_options(-O0 -g)
add_compile_definitions("__IA_DEBUG=1")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
message(STATUS "Configuring IACore for Release..")
add_compile_options(-O3 -g0)
add_compile_definitions("__IA_DEBUG=0")
else()
message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\"")
endif()
message(STATUS "Configured IACore for Multi-Config (Debug/Release rules generated)")
message(STATUS "Detected Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
# Check if the compiler is MSVC (cl.exe), but allow Clang acting like MSVC (clang-cl)

View File

@ -20,8 +20,8 @@ target_include_directories(IACore PUBLIC inc/)
target_include_directories(IACore PRIVATE imp/hpp/)
target_link_libraries(IACore PUBLIC
zlibstatic
libzstd_static
ZLIB::ZLIB
tl::expected
glaze::glaze
simdjson::simdjson
@ -35,17 +35,17 @@ target_link_libraries(IACore PRIVATE
OpenSSL::Crypto
)
if(WIN32)
target_link_libraries(IACore PUBLIC mimalloc-static)
if(MSVC)
target_link_options(IACore PUBLIC "/INCLUDE:mi_version")
else()
target_link_options(IACore PUBLIC "")
endif()
else()
target_link_libraries(IACore PUBLIC mimalloc)
endif()
#if(WIN32)
# target_link_libraries(IACore PUBLIC mimalloc-static)
#
# if(MSVC)
# target_link_options(IACore PUBLIC "/INCLUDE:mi_version")
# else()
# target_link_options(IACore PUBLIC "")
# endif()
#else()
# target_link_libraries(IACore PUBLIC mimalloc)
#endif()
target_precompile_headers(IACore PUBLIC inc/IACore/PCH.hpp)
@ -64,3 +64,8 @@ target_compile_definitions(IACore PRIVATE
CPPHTTPLIB_ZLIB_SUPPORT
NOMINMAX
)
target_compile_definitions(IACore PUBLIC
$<$<CONFIG:Debug>:__IA_DEBUG=1>
$<$<CONFIG:Release>:__IA_DEBUG=0>
)

View File

@ -17,7 +17,7 @@
#include <IACore/IACore.hpp>
#include <IACore/Logger.hpp>
#include <mimalloc-new-delete.h>
// #include <mimalloc-new-delete.h>
namespace IACore
{