Skip to content

Commit

Permalink
crashpad;
Browse files Browse the repository at this point in the history
移除 automic queue;
  • Loading branch information
RealChuan committed Apr 23, 2024
1 parent 185196b commit 5d56f11
Show file tree
Hide file tree
Showing 31 changed files with 276 additions and 300 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ jobs:
shell: bash
run: |
brew install ninja
pip3 install setuptools
ninja --version
cmake --version
clang --version
- name: Install dependencies on ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install ninja-build
sudo apt-get install ninja-build clang libcurl4-openssl-dev
ninja --version
cmake --version
gcc --version
Expand All @@ -83,11 +84,12 @@ jobs:
${{ runner.os }}-
save-always: true

- name: Enable Developer Command Prompt
- name: Configure msvc for amd64
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1.12.1
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: Configure windows
if: startsWith(matrix.os, 'windows')
shell: bash
Expand All @@ -99,7 +101,7 @@ jobs:
-DCMAKE_CXX_COMPILER=cl \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
|| (cat ./build/vcpkg_installed/vcpkg/issue_body.md && exit 1)
- name: Configure macos or ubuntu
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
Expand All @@ -109,7 +111,7 @@ jobs:
-B ./build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
|| (cat ./build/vcpkg_installed/vcpkg/issue_body.md && exit 1)
- name: Build
shell: bash
run: |
Expand Down
5 changes: 0 additions & 5 deletions AtomicQueue/CMakeLists.txt

This file was deleted.

71 changes: 0 additions & 71 deletions AtomicQueue/atomicqueue.hpp

This file was deleted.

101 changes: 0 additions & 101 deletions AtomicQueue/atomicqueue_unittest.cc

This file was deleted.

6 changes: 4 additions & 2 deletions Breakpad/breakpad.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#pragma once

#include <utils/object.hpp>

#include <memory>
#include <string>

namespace google_breakpad {
class ExceptionHandler;
}

class Breakpad
class Breakpad : noncopyable
{
public:
Breakpad(const std::string &dump_path);
explicit Breakpad(const std::string &dump_path);
~Breakpad();

private:
Expand Down
10 changes: 8 additions & 2 deletions Breakpad/main.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#include "breakpad.hpp"

auto main(int argc, char *argv[]) -> int
void crash()
{
Breakpad breakpad("./");
int *p = nullptr;
*p = 1;
}

auto main(int argc, char *argv[]) -> int
{
Breakpad breakpad("./");

crash();

return 0;
}
88 changes: 18 additions & 70 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,74 +1,16 @@
# 设定版本号
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.25.1)

if(CMAKE_HOST_WIN32)
set(CMAKE_TOOLCHAIN_FILE
"C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
elseif(CMAKE_HOST_APPLE)
set(CMAKE_TOOLCHAIN_FILE
"/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
elseif(CMAKE_HOST_UNIX)
set(CMAKE_TOOLCHAIN_FILE
"/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
endif()
include(cmake/vcpkg.cmake)

# 设定工程名
project(
Cpp-Examples
VERSION 0.1
VERSION 0.0.1
DESCRIPTION "This is Cpp-Examples"
HOMEPAGE_URL "https://github.com/RealChuan/Cpp-Examples"
LANGUAGES C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CURRENT_SOURCE_DIR ON)

# set(CMAKE_CXX_FLAGS_DEBUG "-O0") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_DEBUG_POSTFIX d)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE
RelWithDebInfo
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CURRENT_PLATFORM "-64")
else()
set(CURRENT_PLATFORM "-32")
endif()

message(STATUS "Current Platform is ${CURRENT_PLATFORM}")

# 设定可执行二进制文件的目录
set(EXECUTABLE_OUTPUT_PATH
${PROJECT_SOURCE_DIR}/bin${CURRENT_PLATFORM}/${CMAKE_BUILD_TYPE}) # 源文件目录
# 设定存放编译出来的库文件的目录
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin${CURRENT_PLATFORM}/libs)
# 并且把该目录设为连接目录
link_directories(${LIBRARY_OUTPUT_PATH})

include_directories(${PROJECT_SOURCE_DIR})

message("CMAKE_MAJOR_VERSION: ${CMAKE_MAJOR_VERSION}")
message("CMAKE_MINOR_VERSION: ${CMAKE_MINOR_VERSION}")
message("CMAKE_PATCH_VERSION: ${CMAKE_PATCH_VERSION}")
message("CMAKE_TWEAK_VERSION: ${CMAKE_TWEAK_VERSION}")
message("CMAKE_VERSION: ${CMAKE_VERSION}")
message("CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
message("CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")
message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
include(cmake/common.cmake)

find_package(unofficial-breakpad CONFIG REQUIRED)
if(unofficial-breakpad_FOUND)
Expand All @@ -94,15 +36,23 @@ find_package(CURL CONFIG REQUIRED)
if(CURL_FOUND)
message(STATUS "found CURL")
endif()
find_package(crashpad)
# vcpkg install crashpad, it is not good for linux
if(crashpad_FOUND)
message(STATUS "found crashpad")
endif()

include(CTest)
enable_testing()

add_subdirectory(Algorithm)
add_subdirectory(AtomicQueue)
add_subdirectory(BinaryTree)
add_subdirectory(Breakpad)
add_subdirectory(ByteOrder)
add_subdirectory(CountDownLatch)
if(crashpad_FOUND)
add_subdirectory(Crashpad)
endif()
add_subdirectory(Curl)
add_subdirectory(DesignPattern)
add_subdirectory(Glog)
Expand All @@ -113,12 +63,10 @@ add_subdirectory(Mutex)
add_subdirectory(OpenSSL)
add_subdirectory(Thread)

if(CMAKE_HOST_WIN32)

elseif(CMAKE_HOST_APPLE)

elseif(CMAKE_HOST_UNIX)
if(CMAKE_HOST_LINUX)
add_subdirectory(Client)
add_subdirectory(Icmp)
add_subdirectory(Server)
endif()

include(cmake/build_info.cmake)
Loading

0 comments on commit 5d56f11

Please sign in to comment.