Migrated to CMake
This commit is contained in:
parent
f75ac99625
commit
6d41159e36
|
@ -8,7 +8,10 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repo
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@main
|
||||
- name: Build dc
|
||||
run: make clean all
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
make
|
||||
|
|
|
@ -34,3 +34,6 @@ dc
|
|||
|
||||
# Manual
|
||||
dc.1
|
||||
|
||||
# CMake folders
|
||||
build
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
project(dc)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
||||
-Wall -Wextra -Werror -pedantic-errors \
|
||||
-fstack-protector-strong -D_FORTIFY_SOURCE=2 \
|
||||
-Wformat-security -fsanitize=address -fsanitize=undefined \
|
||||
-fstack-clash-protection -Wundef -Wshadow -Wpointer-arith \
|
||||
-Wcast-align -Wwrite-strings -ftrapv -std=c++20 -O3")
|
||||
|
||||
add_executable(dc main.cpp)
|
||||
include_directories(src)
|
||||
add_subdirectory(src)
|
||||
|
||||
target_link_libraries(dc src)
|
42
Makefile
42
Makefile
|
@ -1,42 +0,0 @@
|
|||
TARGET = dc
|
||||
CC = clang++
|
||||
#CC = g++
|
||||
CXXFLAGS = -Wall -Wextra -Werror -pedantic-errors -fstack-protector-strong \
|
||||
-D_FORTIFY_SOURCE=2 -Wformat-security -fsanitize=address -fsanitize=undefined \
|
||||
-fstack-clash-protection -Wundef -Wshadow -Wpointer-arith \
|
||||
-Wcast-align -Wwrite-strings -ftrapv -std=c++20 -O3
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): main.o eval.a math.a stack.a macro.a
|
||||
$(CC) $(CXXFLAGS) $^ -o $@
|
||||
|
||||
main.o: main.cpp
|
||||
$(CC) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
eval.a: eval.o
|
||||
ar rcs $@ $^
|
||||
|
||||
math.a: math.o
|
||||
ar rcs $@ $^
|
||||
|
||||
stack.a: stack.o
|
||||
ar rcs $@ $^
|
||||
|
||||
macro.a: macro.o
|
||||
ar rcs $@ $^
|
||||
|
||||
eval.o: src/eval.cpp
|
||||
$(CC) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
math.o: src/math.cpp
|
||||
$(CC) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
stack.o: src/stack.cpp
|
||||
$(CC) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
macro.o: src/macro.cpp
|
||||
$(CC) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a src/*.gch $(TARGET)
|
|
@ -47,12 +47,13 @@ Some of the supported features are:
|
|||
And much more. You can find the complete manual [here](https://github.com/ice-bit/dc/blob/master/man.md).
|
||||
|
||||
## Installation
|
||||
`dc` is written in C++20 without using any additional dependency. In order to build it, issue the following commands:
|
||||
`dc` is written in C++20 without using any additional dependency. In order to build it, install a recent version of CMake and issue
|
||||
the following command:
|
||||
```sh
|
||||
$> make clean all
|
||||
$> mkdir build && cd build
|
||||
$> cmake .. && make
|
||||
```
|
||||
|
||||
A new binary called `dc` will be created in your local folder.
|
||||
A new statically-compiled binary called `dc` will be created in your local folder.
|
||||
|
||||
To generate a man page from the `man.md` document, use the following command(note: needs pandoc):
|
||||
```sh
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
project(src)
|
||||
|
||||
set(HEADER_FILES
|
||||
eval.h
|
||||
macro.h
|
||||
math.h
|
||||
operation.h
|
||||
stack.h
|
||||
types.h)
|
||||
|
||||
set(SOURCE_FILES
|
||||
eval.cpp
|
||||
macro.cpp
|
||||
math.cpp
|
||||
stack.cpp)
|
||||
|
||||
add_library(src STATIC ${SOURCE_FILES} ${HEADER_FILES})
|
Loading…
Reference in New Issue