Skip to content

Commit

Permalink
- added processorcount.cmake to get the available threads for the sys…
Browse files Browse the repository at this point in the history
…tem via NPROC and NPROC_HALF

- added iwyu.cmake and add an "run-iwyu" if the "iwyu_tool" executable is available
- adjusted some includes based on include-what-you-use
  • Loading branch information
firewave committed May 22, 2020
1 parent 99b31ab commit e5b1170
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@
- implemented ATTR_NORETURN for Visual Studio
- added CMake option USE_VS_ANALYZE to enable Visual Studio Code Analysis
- added CMake option USE_GCC_ANALYZER to enable GCC Static Analysis
- added processorcount.cmake to get the available threads for the system via NPROC and NPROC_HALF
- added iwyu.cmake and add an "run-iwyu" if the "iwyu_tool" executable is available
- adjusted some includes based on include-what-you-use

create_report
- fixed some clang-tidy warnings
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,6 @@ if (WIN32)
target_link_libraries(create_image_xml PRIVATE ws2_32)
endif()

include(clang_tidy.cmake)
include(processorcount.cmake)
include(clang_tidy.cmake)
include(iwyu.cmake)
2 changes: 1 addition & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define COMMON_H_

#include <stdlib.h>

#include <sys/stat.h>
#include <endian.h>

#include <libxml/xpath.h>

Expand Down
5 changes: 5 additions & 0 deletions iwyu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
find_program(IWYU_TOOL NAMES iwyu_tool)
message(STATUS "IWYU_TOOL=${IWYU_TOOL}")
if (IWYU_TOOL)
add_custom_target(run-iwyu ${IWYU_TOOL} -p ${CMAKE_BINARY_DIR} -j ${NPROC_HALF})
endif()
3 changes: 1 addition & 2 deletions mame_regtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
#endif

#ifndef WIN32
#include <arpa/inet.h>
#include <sys/wait.h>
#include <netinet/in.h>
#define USE_VALGRIND 1
#else
#define USE_VALGRIND 0
Expand Down
9 changes: 9 additions & 0 deletions processorcount.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(ProcessorCount)
ProcessorCount(NPROC)
if(NPROC EQUAL 0)
message(FATAL_ERROR "could not get processor count")
endif()
math(EXPR NPROC_HALF "${NPROC} / 2")

message(STATUS "NPROC=${NPROC}")
message(STATUS "NPROC_HALF=${NPROC_HALF}")

0 comments on commit e5b1170

Please sign in to comment.