Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake & MSVC Support #43

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Clang

on:
push:
branches:
- master

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: KyleMayes/install-llvm-action@v2
with:
version: "17.0.0"
arch: "arm64"

- uses: lukka/get-cmake@latest

- uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
runVcpkgInstall: true
vcpkgJsonGlob: vcpkg.json

- uses: threeal/cmake-action@main
with:
generator: Ninja
c-compiler: clang
cxx-compiler: clang++
options: CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
34 changes: 34 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: GCC

on:
push:
branches:
- master


jobs:
build:
runs-on:
ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64

- uses: lukka/get-cmake@latest

- uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
runVcpkgInstall: true
vcpkgJsonGlob: vcpkg.json

- uses: threeal/cmake-action@main
with:
generator: Unix Makefiles
c-compiler: gcc
cxx-compiler: g++
options: CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
32 changes: 32 additions & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: MSVC

on:
push:
branches:
- master

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64

- uses: lukka/get-cmake@latest

- uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
runVcpkgInstall: true
vcpkgJsonGlob: vcpkg.json

- uses: threeal/cmake-action@main
with:
generator: Ninja
c-compiler: cl
cxx-compiler: cl
options: CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
64 changes: 8 additions & 56 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,59 +1,11 @@
test
drcom.conf
test.conf
dogcom
main
.vscode
out/
build/

# Prerequisites
*.d
.idea/
.vscode/
.vs/

# Object files
*.o
*.ko
*.obj
*.elf
.DS_Store
*/.DS_Store

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
modules.order
Module.symvers
Mkfile.old
dkms.conf
*.stackdump
*/*.c
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.28.0)
project(dogcom)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(include)
file(GLOB_RECURSE SOURCE src/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCE})

find_package(Boost REQUIRED system log)
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::boost Boost::system Boost::log)

find_package(cryptopp CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp::cryptopp)
49 changes: 0 additions & 49 deletions Makefile

This file was deleted.

53 changes: 4 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,13 @@
# dogcom [![travis-ci](https://travis-ci.org/mchome/dogcom.svg "Build status")](https://travis-ci.org/mchome/dogcom) [![badge](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg "build with love")](https://github.com/mchome/dogcom) [![version](https://img.shields.io/badge/stable%20-%20v1.6.2-4dc71f.svg "stable version")](https://github.com/mchome/dogcom/tree/v1.6.2)
# dogcom

[Drcom-generic](https://github.com/drcoms/drcom-generic) implementation in C.

```
Usage:
dogcom -m <dhcp/pppoe> -c <FILEPATH> [options <argument>]...

Options:
--mode <dhcp/pppoe>, -m <dhcp/pppoe> set your dogcom mode
--conf <FILEPATH>, -c <FILEPATH> import configuration file
--bindip <IPADDR>, -b <IPADDR> bind your ip address(default is 0.0.0.0)
--log <LOGPATH>, -l <LOGPATH> specify log file
--802.1x, -x enable 802.1x
--daemon, -d set daemon flag
--eternal, -e set eternal flag
--verbose, -v set verbose flag
--help, -h display this help
```

Config file is compatible with [drcom-generic](https://github.com/drcoms/drcom-generic).

#### Example:

```bash
$ dogcom -m dhcp -c dogcom.conf
$ dogcom -m dhcp -c dogcom.conf -l /tmp/dogcom.log -v
$ dogcom -m dhcp -c dogcom.conf -d # (PS: only on Linux build)
$ dogcom -m pppoe -c dogcom.conf -x # (PS: only on Linux build)
$ dogcom -m pppoe -c dogcom.conf -e # eternal dogcoming (default times is 5)
$ dogcom -m pppoe -c dogcom.conf -v
$ dogcom -m dhcp -c dogcom.conf -b 10.2.3.12 -v
```

#### To build:

```bash
$ make # Linux
$ make win32=y # Windows(MinGW)
$ make test=y # For testing purposes
$ make force_encrypt=y # Force open encrypt mode in PPPoE version
```

#### Openwrt-package
[https://github.com/mchome/openwrt-dogcom](https://github.com/mchome/openwrt-dogcom)

#### Tutorial
[![asciicast](https://asciinema.org/a/9j7cj1s61jiczx2s0206tosjr.png)](https://asciinema.org/a/9j7cj1s61jiczx2s0206tosjr)
![MSVC on Win](https://github.com/tsurumi-yizhou/dogcom/actions/workflows/msvc.yml/badge.svg)
![GCC on Linux](https://github.com/tsurumi-yizhou/dogcom/actions/workflows/gcc.yml/badge.svg)
![LLVM on OSX](https://github.com/tsurumi-yizhou/dogcom/actions/workflows/clang.yml/badge.svg)

### Thanks:
- [gdut-drcom](https://github.com/chenhaowen01/gdut-drcom 'chenhaowen01')
- [jlu-drcom-client](https://github.com/drcoms/jlu-drcom-client/tree/master/C-version 'feix')
- [leetking](https://github.com/leetking 'leetking')

### Special thanks:
- [Drcom-generic](https://github.com/drcoms/drcom-generic 'ly0')

### License:
Expand Down
Loading