add debug mode support
This commit is contained in:
parent
4a3cc010b0
commit
c3cbbda2a0
7 changed files with 92 additions and 6 deletions
26
.vscode-example/c_cpp_properties.json
Normal file
26
.vscode-example/c_cpp_properties.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.22621.0",
|
||||
"compilerPath": "cl.exe",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "windows-msvc-x64",
|
||||
"configurationProvider": "mesonbuild.mesonbuild",
|
||||
"compileCommands": [
|
||||
"${workspaceFolder}/build/meson-src/compile_commands.json"
|
||||
],
|
||||
"mergeConfigurations": true
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
16
.vscode-example/launch.json
Normal file
16
.vscode-example/launch.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
// 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": [
|
||||
{
|
||||
"cwd": "${workspaceRoot}",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/build/meson-src/main.exe",
|
||||
"preLaunchTask": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
3
.vscode-example/settings.json
Normal file
3
.vscode-example/settings.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild"
|
||||
}
|
||||
12
.vscode-example/tasks.json
Normal file
12
.vscode-example/tasks.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// filepath: c:\Users\Riley\OneDrive\Documents\Code\C\Conan-C\.vscode\tasks.json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/build.bat debug",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
19
build.bat
19
build.bat
|
|
@ -1,5 +1,20 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set DEBUG=release
|
||||
if "%1" == "debug" set DEBUG=debug
|
||||
|
||||
conan install . --output-folder=build --build=missing
|
||||
cd build
|
||||
meson setup --native-file conan_meson_native.ini .. meson-src
|
||||
|
||||
meson setup -Dbuildtype=%DEBUG% --native-file conan_meson_native.ini .. meson-src --reconfigure
|
||||
meson compile -C meson-src
|
||||
meson-src\main.exe
|
||||
|
||||
REM Only run the executable if it exists
|
||||
if exist meson-src\main.exe (
|
||||
meson-src\main.exe
|
||||
) else (
|
||||
echo "Executable not found. Build might have failed."
|
||||
)
|
||||
|
||||
pause
|
||||
11
build.sh
11
build.sh
|
|
@ -1,5 +1,12 @@
|
|||
if [ "$1" = "debug" ]; then
|
||||
BUILD_TYPE=debug
|
||||
else
|
||||
BUILD_TYPE=release
|
||||
fi
|
||||
|
||||
conan install . --output-folder=build --build=missing
|
||||
cd build
|
||||
meson setup --native-file conan_meson_native.ini .. meson-src
|
||||
meson setup --native-file conan_meson_native.ini .. meson-src -Dbuildtype=$BUILD_TYPE
|
||||
meson compile -C meson-src
|
||||
./meson-src/main
|
||||
./meson-src/main
|
||||
read -p "Press enter to continue..."
|
||||
|
|
|
|||
11
meson.build
11
meson.build
|
|
@ -1,11 +1,18 @@
|
|||
project('tutorial', 'cpp')
|
||||
|
||||
CC = meson.get_compiler('cpp')
|
||||
target_name = 'main'
|
||||
|
||||
zlib = dependency('zlib', version : '1.2.11', static: true, required: true)
|
||||
|
||||
target_name = 'main'
|
||||
|
||||
files = files('src/main.cpp')
|
||||
|
||||
if get_option('buildtype') == 'debug'
|
||||
if CC.has_argument('-fsanitize=address') and CC.has_link_argument('-fsanitize=address')
|
||||
add_project_arguments('-fsanitize=address', '-fno-omit-frame-pointer', language: 'cpp')
|
||||
add_project_link_arguments('-fsanitize=address', language: 'cpp')
|
||||
endif
|
||||
add_project_arguments('-DDEBUG', language: 'cpp')
|
||||
endif
|
||||
|
||||
executable(target_name, files, dependencies: [zlib], include_directories: include_directories('src/include'))
|
||||
Loading…
Add table
Add a link
Reference in a new issue