diff --git a/CMakeLists.txt b/CMakeLists.txt index a230ac7a..e041504e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,25 @@ set(DWARFS_VERSION find_package(PkgConfig REQUIRED) +set(CMAKE_FIND_LIBRARY_SUFFIXES + ".a" + CACHE STRING "please look for static libs") +set(Boost_USE_STATIC_LIBS + ON + CACHE BOOL "only static boost libs") +set(BOOST_LINK_STATIC + "ON" + CACHE STRING "yes, really") +set(USE_STATIC_DEPS_ON_UNIX + ON + CACHE BOOL "yes") +set(GFLAGS_SHARED + OFF + CACHE BOOL "static") + +set(CMAKE_FIND_LIBRARY_SUFFIXES .a) +list(APPEND PKG_CONFIG_EXECUTABLE "--static") + find_package(Boost 1.67 REQUIRED COMPONENTS date_time filesystem program_options system) @@ -56,37 +75,39 @@ set(compiler_only ON CACHE BOOL "only build thrift compiler") +set(FOLLY_HAVE_ELF OFF CACHE BOOL "" FORCE) + add_subdirectory(folly EXCLUDE_FROM_ALL) add_subdirectory(fbthrift EXCLUDE_FROM_ALL) if(WITH_TESTS) - # Download and unpack googletest at configure time - configure_file(CMakeLists.txt.gtest googletest-download/CMakeLists.txt) - execute_process( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE result - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) - if(result) - message(FATAL_ERROR "CMake step for googletest failed: ${result}") - endif() - execute_process( - COMMAND ${CMAKE_COMMAND} --build . - RESULT_VARIABLE result - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) - if(result) - message(FATAL_ERROR "Build step for googletest failed: ${result}") - endif() + # # Download and unpack googletest at configure time + # configure_file(CMakeLists.txt.gtest googletest-download/CMakeLists.txt) + # execute_process( + # COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + # RESULT_VARIABLE result + # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) + # if(result) + # message(FATAL_ERROR "CMake step for googletest failed: ${result}") + # endif() + # execute_process( + # COMMAND ${CMAKE_COMMAND} --build . + # RESULT_VARIABLE result + # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) + # if(result) + # message(FATAL_ERROR "Build step for googletest failed: ${result}") + # endif() - # Prevent overriding the parent project's compiler/linker settings on Windows - set(gtest_force_shared_crt - ON - CACHE BOOL "" FORCE) + # # Prevent overriding the parent project's compiler/linker settings on Windows + # set(gtest_force_shared_crt + # ON + # CACHE BOOL "" FORCE) - # Add googletest directly to our build. This defines the gtest and gtest_main - # targets. - add_subdirectory( - ${CMAKE_CURRENT_BINARY_DIR}/googletest-src - ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) + # # Add googletest directly to our build. This defines the gtest and gtest_main + # # targets. + # add_subdirectory( + # ${CMAKE_CURRENT_BINARY_DIR}/googletest-src + # ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) enable_testing() include(GoogleTest) @@ -129,6 +150,10 @@ add_executable(dwarfs-bin src/dwarfs.cpp) add_executable(dwarfsck src/dwarfsck.cpp) add_executable(dwarfsbench src/dwarfsbench.cpp) +foreach(tgt mkdwarfs dwarfs-bin dwarfsck dwarfsbench) + target_link_options(${tgt} PRIVATE -static -static-libgcc) +endforeach() + list(APPEND BINARY_TARGETS mkdwarfs dwarfs-bin dwarfsck dwarfsbench) if(WITH_TESTS) @@ -309,6 +334,7 @@ install(FILES ${MAN_PAGES} DESTINATION share/man/man1) install(DIRECTORY include/dwarfs DESTINATION include) set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_GENERATOR "TXZ") set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") diff --git a/include/dwarfs/fstypes.h b/include/dwarfs/fstypes.h index 17c72ede..db045e7b 100644 --- a/include/dwarfs/fstypes.h +++ b/include/dwarfs/fstypes.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include diff --git a/src/dwarfs/logger.cpp b/src/dwarfs/logger.cpp index d4ffec9f..203f1375 100644 --- a/src/dwarfs/logger.cpp +++ b/src/dwarfs/logger.cpp @@ -25,7 +25,7 @@ #include #include -#include +// #include #include @@ -37,6 +37,7 @@ namespace dwarfs { namespace { +#if 0 void backtrace(std::ostream& os) { const int stack_size = 5; const int stack_offset = 2; @@ -69,6 +70,8 @@ void backtrace(std::ostream& os) { ::free(strings); } +#endif + } // namespace logger::level_type logger::parse_level(std::string_view level) { @@ -104,9 +107,9 @@ void stream_logger::write(level_type level, const std::string& output) { std::lock_guard lock(mx_); os_ << t << " " << output << "\n"; - if (threshold_ == TRACE) { - backtrace(os_); - } + // if (threshold_ == TRACE) { + // backtrace(os_); + // } } }