From 71d83859f55fc8528f866ebb47b2fdca6f552612 Mon Sep 17 00:00:00 2001 From: dev0 Date: Tue, 9 Dec 2025 02:34:16 +0530 Subject: [PATCH] Fixes --- CMake/FindDeps.cmake | 44 ++++++++++++++++++++--------------- CMakeLists.txt | 13 +---------- Src/IACore/CMakeLists.txt | 29 +++++++++++++---------- Src/IACore/imp/cpp/IACore.cpp | 2 +- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/CMake/FindDeps.cmake b/CMake/FindDeps.cmake index 4b52fad..5d9a111 100644 --- a/CMake/FindDeps.cmake +++ b/CMake/FindDeps.cmake @@ -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= - -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= +# -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) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1638d40..5c061ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Src/IACore/CMakeLists.txt b/Src/IACore/CMakeLists.txt index 90615b5..18098a6 100644 --- a/Src/IACore/CMakeLists.txt +++ b/Src/IACore/CMakeLists.txt @@ -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 + $<$:__IA_DEBUG=1> + $<$:__IA_DEBUG=0> +) diff --git a/Src/IACore/imp/cpp/IACore.cpp b/Src/IACore/imp/cpp/IACore.cpp index eae26f8..ce2e797 100644 --- a/Src/IACore/imp/cpp/IACore.cpp +++ b/Src/IACore/imp/cpp/IACore.cpp @@ -17,7 +17,7 @@ #include #include -#include +// #include namespace IACore {