Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ tags
/testrunner
/testrunner.exe
tools/daca2*.html
tools/dmake
tools/errmsg
tools/extracttests

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is generated by tools/dmake, do not edit.
# This file is generated by dmake, do not edit.

ifndef VERBOSE
VERBOSE=
Expand Down Expand Up @@ -361,7 +361,7 @@ check: all
checkcfg: cppcheck validateCFG
./test/cfg/runtests.sh

dmake: tools/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o
dmake: tools/dmake/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)

run-dmake: dmake
Expand Down Expand Up @@ -896,6 +896,6 @@ externals/simplecpp/simplecpp.o: externals/simplecpp/simplecpp.cpp externals/sim
externals/tinyxml2/tinyxml2.o: externals/tinyxml2/tinyxml2.cpp externals/tinyxml2/tinyxml2.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -w -c -o $@ externals/tinyxml2/tinyxml2.cpp

tools/dmake.o: tools/dmake.cpp cli/filelister.h lib/config.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ tools/dmake.cpp
tools/dmake/dmake.o: tools/dmake/dmake.cpp cli/filelister.h lib/config.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ tools/dmake/dmake.cpp

2 changes: 1 addition & 1 deletion cppcheck.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testrunner", "test\testrunn
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppcheck", "lib\cppcheck.vcxproj", "{C183DB5B-AD6C-423D-80CA-1F9549555A1A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "tools\dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "tools\dmake\dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
33 changes: 1 addition & 32 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1 @@
# TODO: when using ccache and matchcompiler this will accessed before the file was generated and thus the build fails
set(srcs_lib pathmatch.cpp path.cpp)
foreach(file ${srcs_lib})
if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}")
set_source_files_properties(${src} PROPERTIES GENERATED TRUE)
else()
set(src "${CMAKE_SOURCE_DIR}/lib/${file}")
endif()
set(srcs_tools ${srcs_tools} ${src})
endforeach()

add_executable(dmake EXCLUDE_FROM_ALL
dmake.cpp
${CMAKE_SOURCE_DIR}/cli/filelister.cpp
${srcs_tools}
${CMAKE_SOURCE_DIR}/lib/utils.cpp
$<TARGET_OBJECTS:simplecpp_objs>
)
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib)
target_externals_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/externals/simplecpp)
if (WIN32 AND NOT BORLAND)
if(NOT MINGW)
target_link_libraries(dmake Shlwapi.lib)
else()
target_link_libraries(dmake shlwapi)
endif()
endif()

add_custom_target(run-dmake $<TARGET_FILE:dmake>
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS dmake)
add_subdirectory(dmake)
32 changes: 32 additions & 0 deletions tools/dmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# TODO: when using ccache and matchcompiler this will accessed before the file was generated and thus the build fails
set(srcs_lib pathmatch.cpp path.cpp)
foreach(file ${srcs_lib})
if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}")
set_source_files_properties(${src} PROPERTIES GENERATED TRUE)
else()
set(src "${CMAKE_SOURCE_DIR}/lib/${file}")
endif()
set(srcs_tools ${srcs_tools} ${src})
endforeach()

add_executable(dmake EXCLUDE_FROM_ALL
dmake.cpp
${CMAKE_SOURCE_DIR}/cli/filelister.cpp
${srcs_tools}
${CMAKE_SOURCE_DIR}/lib/utils.cpp
$<TARGET_OBJECTS:simplecpp_objs>
)
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib)
target_externals_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/externals/simplecpp)
if (WIN32 AND NOT BORLAND)
if(NOT MINGW)
target_link_libraries(dmake Shlwapi.lib)
else()
target_link_libraries(dmake shlwapi)
endif()
endif()

add_custom_target(run-dmake $<TARGET_FILE:dmake>
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS dmake)
8 changes: 4 additions & 4 deletions tools/dmake.cpp → tools/dmake/dmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void getDeps(const std::string &filename, std::vector<std::string> &depfi
getDeps("lib" + filename.substr(filename.find('/')), depfiles);
else if (startsWith(filename, "test/"))
getDeps("cli" + filename.substr(filename.find('/')), depfiles);
else if (startsWith(filename, "tools/"))
else if (startsWith(filename, "tools"))
getDeps("cli" + filename.substr(filename.find('/')), depfiles);
else if (startsWith(filename, "lib/")) {
for (const std::string & external : externalfolders)
Expand Down Expand Up @@ -306,7 +306,7 @@ int main(int argc, char **argv)
}

std::vector<std::string> toolsfiles;
err = getCppFiles(toolsfiles, "tools/", false);
err = getCppFiles(toolsfiles, "tools/dmake/", false);
if (!err.empty()) {
std::cerr << err << std::endl;
return EXIT_FAILURE;
Expand Down Expand Up @@ -442,7 +442,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

fout << "# This file is generated by tools/dmake, do not edit.\n\n";
fout << "# This file is generated by dmake, do not edit.\n\n";

fout << "ifndef VERBOSE\n"
<< " VERBOSE=\n"
Expand Down Expand Up @@ -671,7 +671,7 @@ int main(int argc, char **argv)
fout << "\t./testrunner -q\n\n";
fout << "checkcfg:\tcppcheck validateCFG\n";
fout << "\t./test/cfg/runtests.sh\n\n";
fout << "dmake:\ttools/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o\n";
fout << "dmake:\ttools/dmake/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o\n";
fout << "\t$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)\n\n";
fout << "run-dmake: dmake\n";
fout << "\t./dmake" << (release ? " --release" : "") << "\n\n"; // Make CI in release builds happy
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void f2() {
```
From this we can see that the usage of `Token::Match()` in `f1()` has been optimized, whereas the one in `f2()` couldn't be optimized (the string wasn't inline on the `Token::Match()` call). **The developer doesn't need to use this tool during development but should be aware of these optimizations**. *Building with this optimization, cppcheck can get a boost of 2x of speed-up.*

### * tools/dmake.cpp
### * tools/dmake/dmake.cpp

Automatically generates the main `Makefile` for Cppcheck (**the main `Makefile` should not be modified manually**). To build and run the `dmake` tool execute:
```shell
Expand Down