mirror of
https://github.com/MaJerle/lwmem.git
synced 2025-01-13 21:42:53 +08:00
Add Cmake support
This commit is contained in:
parent
8fc29a09a5
commit
00956bd716
51
.gitignore
vendored
51
.gitignore
vendored
@ -24,26 +24,29 @@
|
||||
*.i
|
||||
*.txt
|
||||
!docs/*.txt
|
||||
!CMakeLists.txt
|
||||
RTE/
|
||||
|
||||
# IAR Settings
|
||||
**/settings/*.crun
|
||||
**/settings/*.dbgdt
|
||||
**/settings/*.cspy
|
||||
**/settings/*.cspy.*
|
||||
**/settings/*.xcl
|
||||
**/settings/*.dni
|
||||
**/settings/*.wsdt
|
||||
**/settings/*.wspos
|
||||
*debug
|
||||
|
||||
# IAR Debug Exe
|
||||
**/Exe/*.sim
|
||||
# IAR Settings
|
||||
**/settings/*.crun
|
||||
**/settings/*.dbgdt
|
||||
**/settings/*.cspy
|
||||
**/settings/*.cspy.*
|
||||
**/settings/*.xcl
|
||||
**/settings/*.dni
|
||||
**/settings/*.wsdt
|
||||
**/settings/*.wspos
|
||||
|
||||
# IAR Debug Obj
|
||||
**/Obj/*.pbd
|
||||
**/Obj/*.pbd.*
|
||||
**/Obj/*.pbi
|
||||
**/Obj/*.pbi.*
|
||||
# IAR Debug Exe
|
||||
**/Exe/*.sim
|
||||
|
||||
# IAR Debug Obj
|
||||
**/Obj/*.pbd
|
||||
**/Obj/*.pbd.*
|
||||
**/Obj/*.pbi
|
||||
**/Obj/*.pbi.*
|
||||
|
||||
*.TMP
|
||||
/docs_src/x_Doxyfile.doxy
|
||||
@ -69,6 +72,7 @@ RTE/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Dd]ebug*/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
@ -76,6 +80,7 @@ bld/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
_build/
|
||||
build/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
@ -274,7 +279,7 @@ ClientBin/
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
@ -370,7 +375,7 @@ __pycache__/
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
@ -383,3 +388,13 @@ log_file.txt
|
||||
project.ioc
|
||||
mx.scratch
|
||||
*.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 <stdio.h>
|
||||
|
||||
/* Assert check */
|
||||
#define ASSERT(x) do { \
|
||||
@ -11,7 +12,11 @@
|
||||
|
||||
/********************************************/
|
||||
/* 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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user