From 9a835fe12c9586ab8dd44d7c96fef4a2d6017e4b Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 17 May 2024 18:27:03 -0400 Subject: chore: Update mimmaloc v2.1.6, update fPIC & cleanup --- lib/Net.Compression/vnlib_compress/CMakeLists.txt | 52 +++++++++++------------ lib/Net.Compression/vnlib_compress/Taskfile.yaml | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'lib/Net.Compression') diff --git a/lib/Net.Compression/vnlib_compress/CMakeLists.txt b/lib/Net.Compression/vnlib_compress/CMakeLists.txt index c3eb723..0004c60 100644 --- a/lib/Net.Compression/vnlib_compress/CMakeLists.txt +++ b/lib/Net.Compression/vnlib_compress/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10) project(vnlib_compress C) -set(CMAKE_PROJECT_NAME "vnlib_compress") +set(_COMP_PROJ_NAME "vnlib_compress") #set options for enable botli and zlib option(ENABLE_BROTLI "Enable brotli compression" ON) @@ -39,7 +39,7 @@ if(ENABLE_BROTLI) FetchContent_Declare( lib_brotli GIT_REPOSITORY https://github.com/google/brotli.git - GIT_TAG 1b3a5ccb6e7b9384b741437532f4dae0730c61f2 + GIT_TAG 04388304a6f8181cc1f022cc9e95dbb3bfe829a3 GIT_PROGRESS TRUE ) @@ -95,38 +95,36 @@ if(ENABLE_RPMALLOC) add_compile_definitions(VNLIB_CUSTOM_MALLOC_ENABLE) endif() - -#Setup the compiler options -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) #enable position independent code (for shared libraries with exports) - ############################### # # CONFIGURE LIBRARY BUILD # ############################### +set(CMAKE_C_STANDARD_REQUIRED ON) + if(COMPRESS_BUILD_SHARED) - set(TARGET_NAME ${CMAKE_PROJECT_NAME}) - add_library(${TARGET_NAME} SHARED ${VNLIB_COMPRESS_SOURCES} ${COMP_HEADERS}) + add_library(${_COMP_PROJ_NAME} SHARED ${VNLIB_COMPRESS_SOURCES} ${COMP_HEADERS}) + #enable position independent code (for shared libraries with exports) + set_target_properties(${_COMP_PROJ_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) else() - set(TARGET_NAME ${CMAKE_PROJECT_NAME}_static) - add_library(${TARGET_NAME} STATIC ${VNLIB_COMPRESS_SOURCES} ${COMP_HEADERS}) + set(_COMP_PROJ_NAME ${_COMP_PROJ_NAME}_static) #append static to the name + add_library(${_COMP_PROJ_NAME} STATIC ${VNLIB_COMPRESS_SOURCES} ${COMP_HEADERS}) endif() -target_compile_features(${TARGET_NAME} PRIVATE c_std_90) #force compiler to use c90 standard for library +target_compile_features(${_COMP_PROJ_NAME} PRIVATE c_std_90) #force compiler to use c90 standard for library #if on unix lib will be appended, so we can adjust if(UNIX) - set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME vn_compress) + set_target_properties(${_COMP_PROJ_NAME} PROPERTIES OUTPUT_NAME vn_compress) endif() #since were buildiing in tree, set the export defintiions -target_compile_definitions(${TARGET_NAME} PRIVATE VNLIB_EXPORTING) +target_compile_definitions(${_COMP_PROJ_NAME} PRIVATE VNLIB_COMPRESS_EXPORTING) if(ENABLE_BROTLI) #link the encoder-only library to the main project - target_link_libraries(${TARGET_NAME} PRIVATE brotlienc) + target_link_libraries(${_COMP_PROJ_NAME} PRIVATE brotlienc) endif() if(ENABLE_ZLIB) @@ -135,22 +133,22 @@ if(ENABLE_ZLIB) target_compile_definitions(zlib PRIVATE HAS_SSE42 PRIVATE HAS_SSE2) endif() - target_link_libraries(${TARGET_NAME} PRIVATE zlib) + target_link_libraries(${_COMP_PROJ_NAME} PRIVATE zlib) endif() #link rpmalloc to the main project if(ENABLE_RPMALLOC) - target_link_libraries(${TARGET_NAME} PRIVATE vnlib_rpmalloc_static) - add_dependencies(${TARGET_NAME} vnlib_rpmalloc_static) + target_link_libraries(${_COMP_PROJ_NAME} PRIVATE vnlib_rpmalloc_static) + add_dependencies(${_COMP_PROJ_NAME} vnlib_rpmalloc_static) #Include the nativeheap api header - target_include_directories(${TARGET_NAME} PRIVATE ../../Utils.Memory/vnlib_rpmalloc/) + target_include_directories(${_COMP_PROJ_NAME} PRIVATE ../../Utils.Memory/vnlib_rpmalloc/) endif() #setup flags for windows compilation if(MSVC) target_compile_options( - ${TARGET_NAME} + ${_COMP_PROJ_NAME} PRIVATE /Qspectre @@ -173,7 +171,7 @@ if(MSVC) #set build macros target_compile_definitions( - ${TARGET_NAME} + ${_COMP_PROJ_NAME} PRIVATE $<$:DEBUG> @@ -184,7 +182,7 @@ if(MSVC) elseif(CMAKE_COMPILER_IS_GNUCC) target_compile_options( - ${TARGET_NAME} + ${_COMP_PROJ_NAME} PRIVATE -Wextra @@ -194,7 +192,7 @@ elseif(CMAKE_COMPILER_IS_GNUCC) #enable debug compiler options if(build_type STREQUAL "debug") target_compile_options( - ${TARGET_NAME} + ${_COMP_PROJ_NAME} PRIVATE -g #enable debugger info @@ -204,7 +202,7 @@ elseif(CMAKE_COMPILER_IS_GNUCC) -pedantic #enable pedantic mode ) - target_compile_definitions(${TARGET_NAME} PRIVATE DEBUG) + target_compile_definitions(${_COMP_PROJ_NAME} PRIVATE DEBUG) endif() @@ -214,11 +212,13 @@ endif() if(NATIVE_HEAP_LIB_PATH) + message(STATUS "Linking native heap library to the main project found at ${NATIVE_HEAP_LIB_PATH}") + #Include the nativeheap api header include_directories(${NATIVE_HEAP_INCLUDES}) #If manual heap linking is enabled, we need to link the native heap library - target_link_libraries(${TARGET_NAME} PRIVATE ${NATIVE_HEAP_LIB_PATH}) - target_compile_definitions(${TARGET_NAME} PRIVATE VNLIB_CUSTOM_MALLOC_ENABLE) #configure src + target_link_libraries(${_COMP_PROJ_NAME} PRIVATE ${NATIVE_HEAP_LIB_PATH}) + target_compile_definitions(${_COMP_PROJ_NAME} PRIVATE VNLIB_CUSTOM_MALLOC_ENABLE) #configure src endif() \ No newline at end of file diff --git a/lib/Net.Compression/vnlib_compress/Taskfile.yaml b/lib/Net.Compression/vnlib_compress/Taskfile.yaml index 4ddc464..f1d594e 100644 --- a/lib/Net.Compression/vnlib_compress/Taskfile.yaml +++ b/lib/Net.Compression/vnlib_compress/Taskfile.yaml @@ -17,7 +17,7 @@ tasks: cmds: - cmd: echo "Building {{.PROJECT_NAME}}" silent: true - - cmake -Bbuild/ -DCMAKE_BUILD_TYPE=Release {{.CMAKE_ARGS}} + - cmake -Bbuild/ -DCMAKE_BUILD_TYPE=Release {{.CLI_ARGS}} - cmake --build build/ --config Release #called by ci pipline to build the winx64 project -- cgit