aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Module.Taskfile.yaml4
-rw-r--r--lib/Utils.Memory/NativeHeapApi/src/NativeHeapApi.h9
-rw-r--r--lib/Utils.Memory/vnlib_mimalloc/NativeHeapApi.h9
-rw-r--r--lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml92
-rw-r--r--lib/Utils.Memory/vnlib_mimalloc/build.readme.txt10
-rw-r--r--lib/Utils.Memory/vnlib_rpmalloc/CMakeLists.txt9
-rw-r--r--lib/Utils.Memory/vnlib_rpmalloc/NativeHeapApi.h9
-rw-r--r--lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml75
-rw-r--r--lib/Utils.Memory/vnlib_rpmalloc/build.readme.txt6
9 files changed, 146 insertions, 77 deletions
diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml
index bfc8849..ce64fb2 100644
--- a/Module.Taskfile.yaml
+++ b/Module.Taskfile.yaml
@@ -59,8 +59,8 @@ tasks:
desc: 'Configures the module for local development'
cmds:
#build native libs for development
- - cd lib/Utils.Memory/vnlib_rpmalloc && task build
- - cd lib/Utils.Memory/vnlib_mimalloc && task build
+ - cd lib/Utils.Memory/vnlib_rpmalloc && task dev-init
+ - cd lib/Utils.Memory/vnlib_mimalloc && task dev-init
- cd lib/Utils.Cryptography/monocypher && task build
- cd lib/Utils.Cryptography/argon2 && task build
- cd lib/Net.Compression/vnlib_compress && task build
diff --git a/lib/Utils.Memory/NativeHeapApi/src/NativeHeapApi.h b/lib/Utils.Memory/NativeHeapApi/src/NativeHeapApi.h
index 1738d19..b54313a 100644
--- a/lib/Utils.Memory/NativeHeapApi/src/NativeHeapApi.h
+++ b/lib/Utils.Memory/NativeHeapApi/src/NativeHeapApi.h
@@ -51,7 +51,7 @@
#ifdef _P_IS_WINDOWS
#define VNLIB_HEAP_API __declspec(dllimport)
#else
- #define VNLIB_HEAP_API
+ #define VNLIB_HEAP_API extern
#endif /* _P_IS_WINDOWS */
#endif /* !VNLIB_EXPORTING */
#endif /* !VNLIB_EXPORT */
@@ -72,12 +72,9 @@ typedef enum HeapCreationFlags
HEAP_CREATION_SUPPORTS_REALLOC = 0x08
} HeapCreationFlags;
-#ifdef _P_IS_WINDOWS
-typedef void* LPVOID;
-#endif /* !WIN32 */
-
/* The vnlib ERRNO type, integer/process dependent,
-internally represented as a pointer */
+ internally represented as a pointer
+*/
typedef void* ERRNO;
/* A pointer to a heap structure that was stored during heap creation */
diff --git a/lib/Utils.Memory/vnlib_mimalloc/NativeHeapApi.h b/lib/Utils.Memory/vnlib_mimalloc/NativeHeapApi.h
index 1738d19..b54313a 100644
--- a/lib/Utils.Memory/vnlib_mimalloc/NativeHeapApi.h
+++ b/lib/Utils.Memory/vnlib_mimalloc/NativeHeapApi.h
@@ -51,7 +51,7 @@
#ifdef _P_IS_WINDOWS
#define VNLIB_HEAP_API __declspec(dllimport)
#else
- #define VNLIB_HEAP_API
+ #define VNLIB_HEAP_API extern
#endif /* _P_IS_WINDOWS */
#endif /* !VNLIB_EXPORTING */
#endif /* !VNLIB_EXPORT */
@@ -72,12 +72,9 @@ typedef enum HeapCreationFlags
HEAP_CREATION_SUPPORTS_REALLOC = 0x08
} HeapCreationFlags;
-#ifdef _P_IS_WINDOWS
-typedef void* LPVOID;
-#endif /* !WIN32 */
-
/* The vnlib ERRNO type, integer/process dependent,
-internally represented as a pointer */
+ internally represented as a pointer
+*/
typedef void* ERRNO;
/* A pointer to a heap structure that was stored during heap creation */
diff --git a/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml b/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
index 2d816e3..62116d7 100644
--- a/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
+++ b/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
@@ -9,75 +9,105 @@
version: '3'
vars:
+ DEP_NAME: 'mimalloc'
PROJECT_NAME: 'vnlib_mimalloc'
- MODULE_NAME: 'vnlib.core'
tasks:
default:
desc: "Builds the entire project from source code without using the VNBuild build system for target machines"
cmds:
- #init cmake build with greedy enabled
- - cmake -Bbuild/ -DCMAKE_BUILD_TYPE=Release -DENABLE_GREEDY=1 {{.CLI_ARGS}}
- - cmake --build build/ --config Release
- - cmd: echo "Your vnlib_mimalloc library file can be found in '{{.USER_WORKING_DIR}}/build'"
- silent: true
-
+ #init cmake build with greedy enabled
+ - task: build-internal
+ vars:
+ BUILD_TYPE: "Release"
+ CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+
+ - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{.USER_WORKING_DIR}}/build'"
+ silent: true
+
+ debug:
+ cmds:
+ - task: build-internal
+ vars:
+ BUILD_TYPE: "Debug"
+ CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+
build:
- cmds:
- #build our library
- - cmake -B./build -DENABLE_GREEDY=1 {{.CLI_ARGS}}
- - cmake --build build/ --config Debug
- - cmake --build build/ --config Release
+ desc: 'DO NOT USE! This function is used internally during releases.'
+ cmds:
+ #init cmake build with greedy enabled
+ - cmake -B./build -DENABLE_GREEDY=1 {{ .CLI_ARGS }}
+ - cmake --build build/ --config Debug
+ - cmake --build build/ --config Release
+
+ build-internal:
+ internal: true
+ cmds:
+ #build with defaults
+ #init cmake build with greedy enabled
+ - cmake -Bbuild/ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }} {{ .CLI_ARGS }}
+ - cmake --build build/ --config {{ .BUILD_TYPE }}
postbuild_success:
vars:
- #required files to include in tar
- TAR_FILES: "license.txt readme.txt mimalloc_license.txt"
-
+ ARTIFACTS_OUT: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}'
cmds:
#make bin dir
- - cmd: powershell -Command "New-Item -Type Directory -Force -Path './bin'"
+ - cmd: powershell -Command "New-Item -Type Directory -Force -Path '{{ .ARTIFACTS_OUT }}'"
ignore_error: true
#get licenses for debug
- task: licenses
- vars:
- TARGET: './build/Debug'
+ vars: { TARGET: './build/Debug' }
- task: licenses
- vars:
- TARGET: './build/Release'
-
- #dynamic debug lib
- - cd build/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}} {{.PROJECT_NAME}}.pdb
+ vars: { TARGET: './build/Release' }
+ #dynamic debug lib
+ - cd build/Debug && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' .
#release dll
- - cd build/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}}
+ - cd build/Release && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-release-{{.PROJECT_NAME}}.tgz' .
#source code
- task: pack_source
-
+
licenses:
+ internal: true
cmds:
#add mimalloc license to binary output
- - powershell -Command "Copy-Item -Path vendor/license -Destination '{{.TARGET}}/mimalloc_license.txt'"
+ - powershell -Command "Copy-Item -Path vendor/license -Destination '{{.TARGET}}/{{ .DEP_NAME }}_license.txt'"
#add my license file
- powershell -Command "Copy-Item -Path ./license -Destination '{{.TARGET}}/license.txt'"
#add readme file
- powershell -Command "Copy-Item -Path ./build.readme.txt -Destination '{{.TARGET}}/readme.txt'"
pack_source:
- dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ desc: "Packs up the project source code and creates a tarball in the builds binary directory"
+ vars:
+ TARGET_SOURCE: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}/src.tgz'
+ SOURCE_FILES:
+ CMakeLists.txt
+ Taskfile.yaml
+ vendor
+ LICENSE
+ NativeHeapApi.h
+ vnlib_mimalloc.c
+
cmds:
- #pack mimalloc source code and create the archive
- - powershell -Command "tar --exclude build/* --exclude bin/* --exclude vendor/test/ --exclude vendor/out/ -czf 'bin/src.tgz' ."
+ #tar up the source
+ - tar -czf "{{.TARGET_SOURCE}}" {{ .SOURCE_FILES | join " " }}
clean:
ignore_error: true
cmds:
- for: [ bin/, build/ ]
cmd: powershell Remove-Item -Recurse '{{.ITEM}}' -Force
-
- \ No newline at end of file
+
+ #called by module for initializing the project, it's not internal but hidden
+ dev-init:
+ internal: false
+ cmds:
+ - task: debug \ No newline at end of file
diff --git a/lib/Utils.Memory/vnlib_mimalloc/build.readme.txt b/lib/Utils.Memory/vnlib_mimalloc/build.readme.txt
index cd003b6..2edae23 100644
--- a/lib/Utils.Memory/vnlib_mimalloc/build.readme.txt
+++ b/lib/Utils.Memory/vnlib_mimalloc/build.readme.txt
@@ -25,9 +25,9 @@ PREREQUISITES:
NOTE:
If you have any mimalloc specific CMake options you want to use, when running task, you can pass them as
-an the MIMALLOC_CMAKE_ARGS env variable.
+on the command line following a double hyphen '--'
-Example: >task MIMALLOC_CMAKE_ARGS="-DMI_SECURE=ON" (enable secure mode for mimalloc)
+Example: >task -- -DMI_SECURE=ON (enable secure mode for mimalloc)
See: https://microsoft.github.io/mimalloc/build.html for more information on mimalloc specific CMake options.
@@ -36,6 +36,12 @@ BUILDING:
2. Navigate to directory containing the Taskfile.yaml file in the root
3. Run the default task: > task (yes literally just type "task" and hit enter if you installed Task gobally)
+You may build a debug version with the following task command:
+>task debug
+
+You may always use the task list command to see all available public tasks:
+>task --list
+
WINDOWS:
The taskfile should print on screen where the output library file was placed. It will be in the build directory
usually under Debug or Release.
diff --git a/lib/Utils.Memory/vnlib_rpmalloc/CMakeLists.txt b/lib/Utils.Memory/vnlib_rpmalloc/CMakeLists.txt
index fedde80..f3a2b6a 100644
--- a/lib/Utils.Memory/vnlib_rpmalloc/CMakeLists.txt
+++ b/lib/Utils.Memory/vnlib_rpmalloc/CMakeLists.txt
@@ -13,12 +13,11 @@ message(STATUS "Build type is '${build_type}'")
set(CMAKE_C_STANDARD 11) #c11 is required for rpmalloc static assertions
set(CMAKE_C_STANDARD_REQUIRED ON)
-#export header files to the main project
-file(GLOB HEADERS *.h)
-
#Add indepednent source files to the project
set(VNLIB_RPMALLOC_SOURCES
+ "NativeHeapApi.h"
"vnlib_rpmalloc.c"
+ "vendor/rpmalloc.h"
"vendor/rpmalloc.c"
)
@@ -26,8 +25,8 @@ set(VNLIB_RPMALLOC_SOURCES
include_directories(vendor)
#create shared/static libs
-add_library(${_RP_PROJ_NAME} SHARED ${VNLIB_RPMALLOC_SOURCES} ${HEADERS})
-add_library(${_RP_PROJ_NAME}_static STATIC ${VNLIB_RPMALLOC_SOURCES} ${HEADERS})
+add_library(${_RP_PROJ_NAME} SHARED ${VNLIB_RPMALLOC_SOURCES})
+add_library(${_RP_PROJ_NAME}_static STATIC ${VNLIB_RPMALLOC_SOURCES})
#enable fPIC for shared library
set_target_properties(${_RP_PROJ_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
diff --git a/lib/Utils.Memory/vnlib_rpmalloc/NativeHeapApi.h b/lib/Utils.Memory/vnlib_rpmalloc/NativeHeapApi.h
index 1738d19..b54313a 100644
--- a/lib/Utils.Memory/vnlib_rpmalloc/NativeHeapApi.h
+++ b/lib/Utils.Memory/vnlib_rpmalloc/NativeHeapApi.h
@@ -51,7 +51,7 @@
#ifdef _P_IS_WINDOWS
#define VNLIB_HEAP_API __declspec(dllimport)
#else
- #define VNLIB_HEAP_API
+ #define VNLIB_HEAP_API extern
#endif /* _P_IS_WINDOWS */
#endif /* !VNLIB_EXPORTING */
#endif /* !VNLIB_EXPORT */
@@ -72,12 +72,9 @@ typedef enum HeapCreationFlags
HEAP_CREATION_SUPPORTS_REALLOC = 0x08
} HeapCreationFlags;
-#ifdef _P_IS_WINDOWS
-typedef void* LPVOID;
-#endif /* !WIN32 */
-
/* The vnlib ERRNO type, integer/process dependent,
-internally represented as a pointer */
+ internally represented as a pointer
+*/
typedef void* ERRNO;
/* A pointer to a heap structure that was stored during heap creation */
diff --git a/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml b/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
index 98dd914..dc84740 100644
--- a/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
+++ b/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
@@ -9,6 +9,7 @@
version: '3'
vars:
+ DEP_NAME: 'rpmalloc'
PROJECT_NAME: 'vnlib_rpmalloc'
tasks:
@@ -16,28 +17,44 @@ tasks:
default:
desc: "Builds the entire project from source code without using the VNBuild build system for target machines"
cmds:
- #build with defaults
- #init cmake build with greedy enabled
- - cmake -Bbuild/ -DCMAKE_BUILD_TYPE=Release -DENABLE_GREEDY=1 {{.CMAKE_ARGS}}
- - cmake --build build/ --config Release
- - cmd: echo "Your vnlib_rpmalloc library file can be found in '{{.USER_WORKING_DIR}}/build'"
- silent: true
-
+ #init cmake build with greedy enabled
+ - task: build-internal
+ vars:
+ BUILD_TYPE: "Release"
+ CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+
+ - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{.USER_WORKING_DIR}}/build'"
+ silent: true
+
+ debug:
+ cmds:
+ - task: build-internal
+ vars:
+ BUILD_TYPE: "Debug"
+ CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+
build:
+ desc: 'DO NOT USE! This function is used internally during releases.'
cmds:
#init cmake build with greedy enabled
- - cmake -B./build -DENABLE_GREEDY=1
+ - cmake -B./build -DENABLE_GREEDY=1 {{ .CLI_ARGS }}
- cmake --build build/ --config Debug
- cmake --build build/ --config Release
+ build-internal:
+ internal: true
+ cmds:
+ #build with defaults
+ #init cmake build with greedy enabled
+ - cmake -Bbuild/ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }} {{ .CLI_ARGS }}
+ - cmake --build build/ --config {{ .BUILD_TYPE }}
+
postbuild_success:
vars:
- #required files to include in tar
- TAR_FILES: "license.txt readme.txt rpmalloc_license.txt"
-
+ ARTIFACTS_OUT: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}'
cmds:
#make bin dir
- - cmd: powershell -Command "New-Item -Type Directory -Force -Path './bin'"
+ - cmd: powershell -Command "New-Item -Type Directory -Force -Path '{{ .ARTIFACTS_OUT }}'"
ignore_error: true
#get licenses for debug
@@ -48,29 +65,49 @@ tasks:
vars: { TARGET: './build/Release' }
#dynamic debug lib
- - cd build/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' .
+ - cd build/Debug && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' .
#release dll
- - cd build/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}.tgz' .
+ - cd build/Release && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-release-{{.PROJECT_NAME}}.tgz' .
#source code
- task: pack_source
+
licenses:
+ internal: true
cmds:
- #add rpmalloc license to binary output
- - powershell -Command "Copy-Item -Path vendor/license -Destination '{{.TARGET}}/rpmalloc_license.txt'"
+ #add license to binary output
+ - powershell -Command "Copy-Item -Path vendor/license -Destination '{{.TARGET}}/{{ .DEP_NAME }}_license.txt'"
#add my license file
- powershell -Command "Copy-Item -Path ./license -Destination '{{.TARGET}}/license.txt'"
#add readme file
- powershell -Command "Copy-Item -Path ./build.readme.txt -Destination '{{.TARGET}}/readme.txt'"
pack_source:
- dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ desc: "Packs up the project source code and creates a tarball in the builds binary directory"
+ vars:
+ TARGET_SOURCE: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}/src.tgz'
+ SOURCE_FILES:
+ CMakeLists.txt
+ Taskfile.yaml
+ vendor
+ LICENSE
+ NativeHeapApi.h
+ vnlib_rpmalloc.c
+
cmds:
- - powershell -Command "tar --exclude build/* --exclude bin/* --exclude vendor/build/* -czf 'bin/src.tgz' ."
+ #tar up the source
+ - tar -czf "{{.TARGET_SOURCE}}" {{ .SOURCE_FILES | join " " }}
clean:
ignore_error: true
cmds:
- for: [ bin/, build/ ]
- cmd: powershell Remove-Item -Recurse '{{.ITEM}}' -Force \ No newline at end of file
+ cmd: powershell Remove-Item -Recurse '{{.ITEM}}' -Force
+
+ #called by module for initializing the project
+ dev-init:
+ internal: false
+ cmds:
+ - task: debug \ No newline at end of file
diff --git a/lib/Utils.Memory/vnlib_rpmalloc/build.readme.txt b/lib/Utils.Memory/vnlib_rpmalloc/build.readme.txt
index 79a7091..a8d1ab5 100644
--- a/lib/Utils.Memory/vnlib_rpmalloc/build.readme.txt
+++ b/lib/Utils.Memory/vnlib_rpmalloc/build.readme.txt
@@ -28,6 +28,12 @@ BUILDING:
2. Navigate to directory containing the Taskfile.yaml file in the root
3. Run the default task: > task (yes literally just type "task" and hit enter if you installed Task gobally)
+You may build a debug version with the following task command:
+>task debug
+
+You may always use the task list command to see all available public tasks:
+>task --list
+
WINDOWS:
The taskfile should print on screen where the output library file was placed. It will be in the build directory
usually under Debug or Release.