mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added a CMake profiling build type.
This commit is contained in:
parent
863063ee47
commit
4a13694794
|
@ -119,7 +119,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set up compiler flags for debug or release builds.
|
# Set up compiler and linker flags for debug, profiling or release builds.
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
# Enable the C++11 standard and disable optimizations as it's a debug build.
|
# Enable the C++11 standard and disable optimizations as it's a debug build.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O0")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O0")
|
||||||
|
@ -132,6 +132,10 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
if(NOT APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
if(NOT APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
|
||||||
endif()
|
endif()
|
||||||
|
elseif(CMAKE_BUILD_TYPE MATCHES Profiling)
|
||||||
|
# For the profiling build, we enable optimizations and supply the required profiler flags.
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -pg -g")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2 -pg")
|
||||||
else()
|
else()
|
||||||
# Enable the C++11 standard and enable optimizations as it's a release build.
|
# Enable the C++11 standard and enable optimizations as it's a release build.
|
||||||
# This will also disable all assert() macros. Strip the binary as well.
|
# This will also disable all assert() macros. Strip the binary as well.
|
||||||
|
|
17
INSTALL.md
17
INSTALL.md
|
@ -47,14 +47,27 @@ cmake .
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
To generate a debug build, run this instead:
|
To create a debug build, run this instead:
|
||||||
```
|
```
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug .
|
cmake -DCMAKE_BUILD_TYPE=Debug .
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
Keep in mind though that a debug version will be much slower due to all compiler optimizations being disabled.
|
Keep in mind though that a debug version will be much slower due to all compiler optimizations being disabled.
|
||||||
|
|
||||||
To build with CEC support, add the corresponding option, for example:
|
To create a profiling build, run this:
|
||||||
|
```
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Profiling .
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then profile the code with valgrind:
|
||||||
|
```
|
||||||
|
valgrind --tool=callgrind ./emulationstation
|
||||||
|
```
|
||||||
|
|
||||||
|
The output file from valgrind can be loaded into a tool such as KCachegrind for data analysis.
|
||||||
|
|
||||||
|
To build ES with CEC support, add the corresponding option, for example:
|
||||||
|
|
||||||
```
|
```
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -DCEC=on .
|
cmake -DCMAKE_BUILD_TYPE=Debug -DCEC=on .
|
||||||
|
|
Loading…
Reference in a new issue