mirror of
https://github.com/MaJerle/lwmem.git
synced 2025-01-26 06:02:54 +08:00
Add Cmake support
This commit is contained in:
parent
8fc29a09a5
commit
00956bd716
15
.gitignore
vendored
15
.gitignore
vendored
@ -24,8 +24,11 @@
|
|||||||
*.i
|
*.i
|
||||||
*.txt
|
*.txt
|
||||||
!docs/*.txt
|
!docs/*.txt
|
||||||
|
!CMakeLists.txt
|
||||||
RTE/
|
RTE/
|
||||||
|
|
||||||
|
*debug
|
||||||
|
|
||||||
# IAR Settings
|
# IAR Settings
|
||||||
**/settings/*.crun
|
**/settings/*.crun
|
||||||
**/settings/*.dbgdt
|
**/settings/*.dbgdt
|
||||||
@ -69,6 +72,7 @@ RTE/
|
|||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
[Rr]elease/
|
[Rr]elease/
|
||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
|
[Dd]ebug*/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
bld/
|
bld/
|
||||||
@ -76,6 +80,7 @@ bld/
|
|||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
_build/
|
_build/
|
||||||
|
build/
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
@ -383,3 +388,13 @@ log_file.txt
|
|||||||
project.ioc
|
project.ioc
|
||||||
mx.scratch
|
mx.scratch
|
||||||
*.tilen majerle
|
*.tilen majerle
|
||||||
|
|
||||||
|
|
||||||
|
# Altium
|
||||||
|
Project outputs*
|
||||||
|
History/
|
||||||
|
*.SchDocPreview
|
||||||
|
*.$$$Preview
|
||||||
|
|
||||||
|
# VSCode projects
|
||||||
|
project_vscode_compiled.exe
|
24
.vscode/c_cpp_properties.json
vendored
Normal file
24
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": 4,
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Win32",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}\\dev\\VisualStudio\\",
|
||||||
|
"${workspaceFolder}\\lwmem\\src\\include\\"
|
||||||
|
],
|
||||||
|
"defines": [
|
||||||
|
"WIN32",
|
||||||
|
"_DEBUG",
|
||||||
|
"UNICODE",
|
||||||
|
"_UNICODE",
|
||||||
|
"LWMEM_DEV"
|
||||||
|
],
|
||||||
|
"compilerPath": "c:\\msys64\\mingw64\\bin\\gcc.exe",
|
||||||
|
"cStandard": "gnu17",
|
||||||
|
"cppStandard": "gnu++14",
|
||||||
|
"intelliSenseMode": "windows-gcc-x86",
|
||||||
|
"configurationProvider": "ms-vscode.cmake-tools"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "(Windows) Launch",
|
||||||
|
"type": "cppvsdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}\\build\\LwPRINTF.exe",
|
||||||
|
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${fileDirname}",
|
||||||
|
"environment": [],
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
54
.vscode/tasks.json
vendored
Normal file
54
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
|
||||||
|
/* For this builds, you need
|
||||||
|
*
|
||||||
|
* - Ninja build system
|
||||||
|
* - MSYS2 compiler with ninja support
|
||||||
|
* - C/C++ extension for VSCode
|
||||||
|
* - CMake-Tools extension for VSCode
|
||||||
|
*/
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cppbuild",
|
||||||
|
"label": "Build project",
|
||||||
|
"command": "cmake",
|
||||||
|
"args": [
|
||||||
|
"--build",
|
||||||
|
"\"build\""
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Clean project",
|
||||||
|
"command": "cmake",
|
||||||
|
"args": [
|
||||||
|
"--build",
|
||||||
|
"\"build\"",
|
||||||
|
"--target",
|
||||||
|
"clean"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Run application",
|
||||||
|
"command": "${workspaceFolder}\\build\\LwMEM.exe",
|
||||||
|
"args": [],
|
||||||
|
"problemMatcher": [],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0.0)
|
||||||
|
project(LwMEM VERSION 0.1.0)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME}
|
||||||
|
lwmem/src/lwmem/lwmem.c
|
||||||
|
lwmem/src/system/lwmem_sys_win32.c
|
||||||
|
tests/lwmem_test.c
|
||||||
|
dev/VisualStudio/main.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
dev/VisualStudio
|
||||||
|
lwmem/src/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
WIN32
|
||||||
|
_DEBUG
|
||||||
|
CONSOLE
|
||||||
|
LWMEM_DEV
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||||
|
include(CPack)
|
@ -1,4 +1,5 @@
|
|||||||
#include "lwmem/lwmem.h"
|
#include "lwmem/lwmem.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Assert check */
|
/* Assert check */
|
||||||
#define ASSERT(x) do { \
|
#define ASSERT(x) do { \
|
||||||
@ -11,7 +12,11 @@
|
|||||||
|
|
||||||
/********************************************/
|
/********************************************/
|
||||||
/* Test case helpers */
|
/* Test case helpers */
|
||||||
#define IS_ALLOC_IN_REGION(ptr, region) ASSERT((unsigned char *)(ptr) >= (region)->start_addr && (unsigned char *)(ptr) < ((unsigned char *)(region)->start_addr + (region)->size))
|
#define UINT_PTR_CAST(x) ((uintptr_t)(x))
|
||||||
|
#define IS_ALLOC_IN_REGION(ptr, region) ASSERT( \
|
||||||
|
UINT_PTR_CAST(ptr) >= UINT_PTR_CAST((region)->start_addr) \
|
||||||
|
&& UINT_PTR_CAST(ptr) < (UINT_PTR_CAST((region)->start_addr) + (region)->size) \
|
||||||
|
)
|
||||||
|
|
||||||
/********************************************/
|
/********************************************/
|
||||||
/* Configuration for default lwmem instance */
|
/* Configuration for default lwmem instance */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user