Skip to content

Commit a997fa3

Browse files
committed
[fix] Fix build under Gentoo with x86 + x86_64 available (libunwind problem) + fix unit test issue due to header line mooving
1 parent b6faf61 commit a997fa3

File tree

12 files changed

+71
-37
lines changed

12 files changed

+71
-37
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/)
3939
############################################################
4040
# Options
4141
set(ENABLE_TESTS "no" CACHE BOOL "Enable build of internal tests.")
42+
set(ENABLE_GCC_COVERAGE "no" CACHE BOOL "Enable coverage compile flags to be enabled.")
4243

4344
############################################################
4445
#Delegate some cmake scripts
@@ -60,9 +61,28 @@ endif(ENABLE_GCC_COVERAGE)
6061
############################################################
6162
set(ENABLE_PROFILER "yes" CACHE BOOL "Enable the installation of the profiler.")
6263

64+
############################################################
65+
# search deps
66+
find_package(GTest QUIET)
67+
FIND_PACKAGE(OpenMP QUIET)
68+
find_package(LibElf QUIET)
69+
find_package(Libunwind QUIET)
70+
find_package(Qt5Widgets QUIET)
71+
find_package(Qt5WebEngineWidgets QUIET)
72+
find_package(Qt5WebKitWidgets QUIET)
73+
find_package(Qt5Network QUIET)
74+
# Check for npm if needed
75+
if (NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/webview/node_modules)
76+
find_package(Npm REQUIRED)
77+
endif()
78+
6379
############################################################
6480
#build subdirs
6581
add_subdirectory(src)
6682
if (ENABLE_PROFILER)
6783
add_subdirectory(extern-deps)
6884
endif(ENABLE_PROFILER)
85+
86+
############################################################
87+
# infos
88+
malt_print_status()

cmake/FindIniParser.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ find_path(INIPARSER_INCLUDE_DIR iniparser.h
3232

3333
############################################################
3434
find_library(INIPARSER_LIBRARY NAMES iniparser
35-
HINTS ${PC_INIPARSER_LIBDIR} ${PC_INIPARSER_LIBRARY_DIRS} ${INIPARSER_PREFIX}/lib)
35+
HINTS ${PC_INIPARSER_LIBDIR} ${PC_INIPARSER_LIBRARY_DIRS} ${INIPARSER_PREFIX}/${LIBDIR})
3636

3737
############################################################
3838
set(INIPARSER_LIBRARIES ${INIPARSER_LIBRARY} )

cmake/FindLibElf.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ find_path(LIBELF_INCLUDE_DIR libelf.h elf.h
2626

2727
############################################################
2828
find_library(LIBELF_LIBRARY NAMES elf
29-
HINTS ${LIBELF_PREFIX}/lib)
29+
HINTS ${LIBELF_PREFIX}/${LIBDIR})
3030

3131
############################################################
3232
set(LIBELF_LIBRARIES ${LIBELF_LIBRARY} )

cmake/FindLibunwind.cmake

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
2626

2727
############################################################
2828
find_library(LIBUNWIND_LIBRARY NAMES unwind
29-
HINTS ${LIBUNWIND_PREFIX}/lib)
29+
HINTS ${LIBUNWIND_PREFIX}/${LIBDIR})
3030

3131
############################################################
32-
foreach(arch x86 x86_64 ppc ppc64 aarch aarch64)
33-
find_library(LIBUNWIND_${arch} NAMES unwind-${arch}
34-
HINTS ${LIBUNWIND_PREFIX}/lib)
35-
if (LIBUNWIND_${arch})
36-
list(APPEND LIBUNWIND_ARCH_LIBRARIES ${LIBUNWIND_${arch}})
37-
endif()
38-
endforeach()
32+
set(arch ${CMAKE_SYSTEM_PROCESSOR})
33+
find_library(LIBUNWIND_${arch} NAMES unwind-${arch}
34+
HINTS ${LIBUNWIND_PREFIX}/${LIBDIR})
35+
if (LIBUNWIND_${arch})
36+
list(APPEND LIBUNWIND_ARCH_LIBRARIES ${LIBUNWIND_${arch}})
37+
endif()
3938

4039
############################################################
4140
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY} ${LIBUNWIND_ARCH_LIBRARIES})
@@ -46,7 +45,7 @@ include(FindPackageHandleStandardArgs)
4645
# handle the QUIETLY and REQUIRED arguments and set LIBUNWIND_FOUND to TRUE
4746
# if all listed variables are TRUE
4847
find_package_handle_standard_args(Libunwind DEFAULT_MSG
49-
LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
48+
LIBUNWIND_LIBRARY LIBUNWIND_LIBRARIES LIBUNWIND_INCLUDE_DIR)
5049

5150
############################################################
5251
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARY )

cmake/macros.cmake

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ ENDMACRO(malt_setup_internal_gmock_and_gtest)
2626
############################################################
2727
# Setup google test by either using the internal one of using the one is current system if avail
2828
MACRO(malt_setup_google_tests)
29-
# search system on
30-
find_package(GTest QUIET)
31-
3229
# if avail use the system one, otherwise use embeded one
3330
if (NOT GTEST_FOUND)
3431
malt_setup_internal_gmock_and_gtest()
@@ -71,3 +68,42 @@ MACRO(malt_enable_cxx_11)
7168
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
7269
endif()
7370
ENDMACRO(malt_enable_cxx_11)
71+
72+
###########################################################
73+
# Print a summary status to help ensuring everything
74+
# is correct
75+
function(malt_print_status)
76+
# Prepare some vars for printing
77+
list(JOIN MALT_CXX_FLAGS " " MALT_CXX_FLAGS_STR)
78+
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
79+
if (CMAKE_BUILD_TYPE STREQUAL "")
80+
list(JOIN CMAKE_CXX_FLAGS " " CMAKE_BUILD_TYPE_FLAGS)
81+
else()
82+
list(JOIN CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER} " " CMAKE_BUILD_TYPE_FLAGS)
83+
endif()
84+
85+
# Print summary
86+
message(STATUS "==============================================================")
87+
message(STATUS "| OS : ${CMAKE_HOST_SYSTEM_NAME}")
88+
message(STATUS "| Compiler familly : ${CMAKE_CXX_COMPILER_ID}")
89+
message(STATUS "| Compiler : ${CMAKE_CXX_COMPILER}")
90+
message(STATUS "--------------------------------------------------------------")
91+
message(STATUS "| tests : ${ENABLE_TESTS}")
92+
message(STATUS "| profiler : ${ENABLE_PROFILER}")
93+
message(STATUS "| gcc-coverage : ${ENABLE_GCC_COVERAGE}")
94+
message(STATUS "| valgrind : ${ENABLE_VALGRIND}")
95+
message(STATUS "--------------------------------------------------------------")
96+
message(STATUS "| libunwind : ${LIBUNWIND_LIBRARIES}")
97+
message(STATUS "| libelf : ${LIBELF_LIBRARY}")
98+
#message(STATUS "| iniparser : ${INIPARSER_LIBRARY}")
99+
message(STATUS "| gtest : ${GTEST_INCLUDE_DIR}")
100+
message(STATUS "| qt5-widgets : ${Qt5Widgets_INCLUDE_DIRS}")
101+
message(STATUS "| qt5-web-egnine : ${Qt5WebEngineWidgets_INCLUDE_DIRS}")
102+
message(STATUS "| qt5-network : ${Qt5Network_INCLUDE_DIRS}")
103+
message(STATUS "--------------------------------------------------------------")
104+
message(STATUS "| CMake build type : ${CMAKE_BUILD_TYPE}")
105+
message(STATUS "| CMake cxxflags : ${CMAKE_BUILD_TYPE_FLAGS}")
106+
message(STATUS "| User cxxflags : ${CMAKE_CXX_FLAGS}")
107+
message(STATUS "| All cxxflags : ${CMAKE_BUILD_TYPE_FLAGS} ${MALT_CXX_FLAGS_STR} ${CMAKE_CXX_FLAGS}")
108+
message(STATUS "==============================================================")
109+
endfunction()

src/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
############################################################
1313
check_nodejs()
1414

15-
############################################################
16-
# Find the QtWidgets library
17-
find_package(Qt5Widgets QUIET)
18-
find_package(Qt5WebEngineWidgets QUIET)
19-
find_package(Qt5WebKitWidgets QUIET)
20-
find_package(Qt5Network QUIET)
21-
2215
############################################################
2316
if (Qt5WebEngineWidgets_FOUND OR Qt5WebKitWidgets_FOUND)
2417
set(Qt5Webkit_FOUND OK)

src/lib/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
# AUTHOR : Sébastien Valat (ECR) - 2014 - 2015
1010
############################################################
1111

12-
############################################################
13-
#Find
14-
find_package(LibElf QUIET)
15-
find_package(Libunwind QUIET)
16-
1712
############################################################
1813
#set default
1914
if (LIBUNWIND_FOUND)

src/lib/core/tests/TestSymbolSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ TEST(TestSymbolSolver, solveBacktraceExe)
8888
#ifndef NDEBUG
8989
EXPECT_EQ(__FILE__, file);
9090
EXPECT_EQ("testCalleeExe(MALT::BacktraceStack&)", func);
91-
EXPECT_EQ(60, site->line);
91+
EXPECT_EQ(62, site->line);
9292
#endif
9393
}
9494

@@ -118,7 +118,7 @@ TEST(TestSymbolSolver, solveBacktraceLib)
118118
EXPECT_NE(0, site->file);
119119
EXPECT_NE(-1, site->file);
120120
EXPECT_EQ("testCalleeLib(MALT::BacktraceStack&)", func);
121-
EXPECT_EQ(10, site->line);
121+
EXPECT_EQ(19, site->line);
122122
#endif
123123
}
124124

src/lib/stack-tree/from-v2/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ include_directories(../)
1515

1616
############################################################
1717
#Enable openMP if present to use paralle tests
18-
FIND_PACKAGE(OpenMP QUIET)
1918
if(OPENMP_FOUND)
2019
message(STATUS "OpenMP found for unit tests")
2120
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -g")

src/lib/stack-tree/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set(TEST_NAMES TestStackSTLHashMap TestRLockFreeTree)
1919

2020
############################################################
2121
#Enable openMP if present to use paralle tests
22-
FIND_PACKAGE(OpenMP QUIET)
2322
if(OPENMP_FOUND)
2423
message(STATUS "OpenMP found for unit tests")
2524
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -g")

0 commit comments

Comments
 (0)