Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MIDIMan
SRB2
Commits
36bd4a70
Commit
36bd4a70
authored
2 years ago
by
Eidolon
Browse files
Options
Downloads
Patches
Plain Diff
cmake: Add SRB2_CONFIG_ENABLE_VALGRIND
parent
67fb09ec
Branches
cmake-valgrind
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
cmake/Modules/FindValgrind.cmake
+56
-0
56 additions, 0 deletions
cmake/Modules/FindValgrind.cmake
src/CMakeLists.txt
+5
-0
5 additions, 0 deletions
src/CMakeLists.txt
with
64 additions
and
0 deletions
CMakeLists.txt
+
3
−
0
View file @
36bd4a70
...
...
@@ -49,6 +49,9 @@ else()
set
(
SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT OFF
)
endif
()
if
(
"
${
CMAKE_SYSTEM_NAME
}
"
MATCHES Linux
)
option
(
SRB2_CONFIG_ENABLE_VALGRIND
"Build with Valgrind memory debugging support"
OFF
)
endif
()
option
(
SRB2_CONFIG_SYSTEM_LIBRARIES
"Link dependencies using CMake's find_package and do not use internal builds"
...
...
This diff is collapsed.
Click to expand it.
cmake/Modules/FindValgrind.cmake
0 → 100644
+
56
−
0
View file @
36bd4a70
# Find Valgrind
# Once done, this will define
#
# VALGRIND_FOUND - system has Valgrind
# VALGRIND_INCLUDE_DIRS - Valgrind include directories
# VALGRIND_LIBRARIES - link libraries
include
(
LibFindMacros
)
libfind_pkg_check_modules
(
VALGRIND_PKGCONF valgrind
)
# includes
find_path
(
VALGRIND_INCLUDE_DIR
NAMES valgrind.h
PATHS
${
VALGRIND_PKGCONF_INCLUDE_DIRS
}
"/usr/include/valgrind"
"/usr/local/include/valgrind"
)
# library
find_library
(
COREGRIND_LIBRARY
NAMES coregrind
PATHS
${
VALGRIND_PKGCONF_LIBRARY_DIRS
}
"/usr/lib/valgrind"
"/usr/local/lib/valgrind"
)
find_library
(
VEX_LIBRARY
NAMES vex
PATHS
${
VALGRIND_PKGCONF_LIBRARY_DIRS
}
"/usr/lib/valgrind"
"/usr/local/lib/valgrind"
)
# set include dir variables
set
(
VALGRIND_PROCESS_INCLUDES VALGRIND_INCLUDE_DIR
)
set
(
VALGRIND_PROCESS_LIBS COREGRIND_LIBRARY VEX_LIBRARY
)
libfind_process
(
VALGRIND
)
if
(
VALGRIND_FOUND AND NOT TARGET Valgrind::Valgrind
)
add_library
(
Valgrind::Coregrind UNKNOWN IMPORTED
)
set_target_properties
(
Valgrind::Coregrind PROPERTIES
IMPORTED_LOCATION
"
${
COREGRIND_LIBRARY
}
"
)
add_library
(
Valgrind::Vex UNKNOWN IMPORTED
)
set_target_properties
(
Valgrind::Vex PROPERTIES
IMPORTED_LOCATION
"
${
VEX_LIBRARY
}
"
)
add_library
(
Valgrind::Valgrind UNKNOWN IMPORTED
)
set_target_properties
(
Valgrind::Valgrind PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"
${
VALGRIND_INCLUDE_DIR
}
"
)
target_link_libraries
(
Valgrind::Valgrind PUBLIC Valgrind::Coregrind Valgrind::Vex
)
endif
()
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
5
−
0
View file @
36bd4a70
...
...
@@ -140,6 +140,11 @@ if(${SRB2_CONFIG_DEV_BUILD})
endif
()
target_compile_definitions
(
SRB2SDL2 PRIVATE -DCMAKECONFIG
)
if
(
"
${
SRB2_CONFIG_ENABLE_VALGRIND
}
"
AND
"
${
CMAKE_SYSTEM_NAME
}
"
MATCHES Linux
)
find_package
(
Valgrind REQUIRED
)
target_link_libraries
(
SRB2SDL2 PRIVATE Valgrind::Valgrind
)
endif
()
add_subdirectory
(
sdl
)
# strip debug symbols into separate file when using gcc.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment