Skip to content
Snippets Groups Projects
Unverified Commit 7fc05583 authored by Lars Bilke's avatar Lars Bilke Committed by GitHub
Browse files

Merge pull request #2871 from endJunction/CheckHeaders

Check headers
parents 481bab6a f0d21f0f
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include <cassert> #include <cassert>
#include <limits> #include <limits>
#include <utility> #include <list>
#include <logog/include/logog.hpp> #include <logog/include/logog.hpp>
#include <utility>
namespace GeoLib namespace GeoLib
{ {
......
...@@ -596,7 +596,7 @@ pipeline { ...@@ -596,7 +596,7 @@ pipeline {
sh 'find $CONAN_USER_HOME -name "system_reqs.txt" -exec rm {} \\;' sh 'find $CONAN_USER_HOME -name "system_reqs.txt" -exec rm {} \\;'
try { try {
configure { configure {
cmakeOptions = '-DOGS_CHECK_HEADER_COMPILATION=ON' cmakeOptions = '-DOGS_CHECK_HEADER_COMPILATION=ON -DBUILD_TESTING=OFF'
dir = 'build-check-header' dir = 'build-check-header'
} }
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "Medium.h" #include "Medium.h"
#include <string>
#include "BaseLib/ConfigTree.h" #include "BaseLib/ConfigTree.h"
#include "ParameterLib/Parameter.h" #include "ParameterLib/Parameter.h"
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
*/ */
#include <map>
#include <memory> #include <memory>
#include <string>
#include <vector> #include <vector>
namespace BaseLib namespace BaseLib
......
...@@ -10,7 +10,7 @@ include(GenerateExportHeader) ...@@ -10,7 +10,7 @@ include(GenerateExportHeader)
generate_export_header(ParameterLib) generate_export_header(ParameterLib)
target_include_directories(ParameterLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(ParameterLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(ParameterLib PRIVATE BaseLib MeshLib) target_link_libraries(ParameterLib PUBLIC MathLib PRIVATE BaseLib MeshLib)
if(OGS_USE_PCH) if(OGS_USE_PCH)
cotire(ParameterLib) cotire(ParameterLib)
......
# Supply include directories and compiler flags # Supply include directories and compiler flags
get_directory_property(INCLUDE_DIRS INCLUDE_DIRECTORIES) get_directory_property(INCLUDE_DIRS INCLUDE_DIRECTORIES)
set(CMAKE_REQUIRED_FLAGS "-c -std=gnu++14") set(CMAKE_REQUIRED_FLAGS "-c")
set(CMAKE_REQUIRED_QUIET TRUE)
add_custom_target(check-header add_custom_target(check-header
COMMAND ${CMAKE_COMMAND} -E remove -f CMakeFiles/CMakeError.log COMMAND ${CMAKE_COMMAND} -E remove -f CMakeFiles/CMakeError.log
...@@ -31,8 +30,11 @@ function(_check_header_compilation TARGET) ...@@ -31,8 +30,11 @@ function(_check_header_compilation TARGET)
get_target_property(LINK_LIBS ${TARGET} LINK_LIBRARIES) get_target_property(LINK_LIBS ${TARGET} LINK_LIBRARIES)
foreach(LIB ${LINK_LIBS}) foreach(LIB ${LINK_LIBS})
# Ignore non-existing targets or interface libs # Ignore non-existing targets or interface libs
if(NOT TARGET ${LIB})
continue()
endif()
get_target_property(LIB_TYPE ${LIB} TYPE) get_target_property(LIB_TYPE ${LIB} TYPE)
if(NOT TARGET ${LIB} OR LIB_TYPE STREQUAL "INTERFACE_LIBRARY") if(LIB_TYPE STREQUAL "INTERFACE_LIBRARY")
continue() continue()
endif() endif()
get_target_property(TARGET_INCLUDE_DIRS ${LIB} INCLUDE_DIRECTORIES) get_target_property(TARGET_INCLUDE_DIRS ${LIB} INCLUDE_DIRECTORIES)
...@@ -58,21 +60,24 @@ function(_check_header_compilation TARGET) ...@@ -58,21 +60,24 @@ function(_check_header_compilation TARGET)
continue() continue()
endif() endif()
string(REPLACE "${PROJECT_SOURCE_DIR}/" "" TEST_NAME ${FILE})
string(REPLACE "." "_" TEST_NAME ${TEST_NAME})
string(REPLACE "/" "_" TEST_NAME ${TEST_NAME})
check_cxx_source_compiles( check_cxx_source_compiles(
" "
#include \"${FILE}\" #include \"${FILE}\"
int main() { return 0; } int main() { return 0; }
" "
COMPILES ${TEST_NAME}_COMPILES
) )
if(NOT COMPILES) if(NOT ${TEST_NAME}_COMPILES)
set(HEADER_COMPILE_ERROR TRUE CACHE INTERNAL "") set(HEADER_COMPILE_ERROR TRUE CACHE INTERNAL "")
string(REPLACE "${PROJECT_SOURCE_DIR}/" "" FILE_SHORT ${FILE}) message(STATUS " Compilation failed for ${FILE}")
message(STATUS " Compilation failed for ${FILE_SHORT}")
endif() endif()
unset(COMPILES CACHE) unset(${TEST_NAME}_COMPILES CACHE)
unset(TEST_NAME)
endforeach() endforeach()
endfunction() endfunction()
...@@ -83,12 +88,17 @@ function(check_header_compilation) ...@@ -83,12 +88,17 @@ function(check_header_compilation)
set(HEADER_COMPILE_ERROR FALSE CACHE INTERNAL "") set(HEADER_COMPILE_ERROR FALSE CACHE INTERNAL "")
_check_header_compilation(BaseLib) _check_header_compilation(BaseLib)
_check_header_compilation(ChemistryLib)
_check_header_compilation(GeoLib) _check_header_compilation(GeoLib)
foreach(lib Git CMake Test)
_check_header_compilation(${lib}InfoLib)
endforeach(lib)
_check_header_compilation(MaterialLib) _check_header_compilation(MaterialLib)
_check_header_compilation(MathLib) _check_header_compilation(MathLib)
_check_header_compilation(MeshGeoToolsLib) _check_header_compilation(MeshGeoToolsLib)
_check_header_compilation(MeshLib) _check_header_compilation(MeshLib)
_check_header_compilation(NumLib) _check_header_compilation(NumLib)
_check_header_compilation(ParameterLib)
_check_header_compilation(ProcessLib) _check_header_compilation(ProcessLib)
if(HEADER_COMPILE_ERROR) if(HEADER_COMPILE_ERROR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment