Skip to content

Commit 9fde314

Browse files
committed
Use CMake
1 parent 14ca512 commit 9fde314

File tree

3 files changed

+30
-43
lines changed

3 files changed

+30
-43
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build/
12
*.o
23
*.swp
34
*.log

CMakeLists.txt

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required (VERSION 3.10)
2+
3+
project (Bint
4+
VERSION "0.1.0"
5+
DESCRIPTION "Bint is an arbitrary-precision arithmetic library."
6+
LANGUAGES CXX
7+
)
8+
9+
enable_testing()
10+
11+
set(CMAKE_CXX_STANDARD 17)
12+
set(CMAKE_CXX_EXTENSIONS OFF)
13+
add_compile_options(-Wall -Wextra -pedantic)
14+
15+
set(BINT_SRC Bint.cpp Bint.h)
16+
set(MATH_SRC Math.cpp Math.h)
17+
add_library(shareobjects OBJECT ${BINT_SRC} ${MATH_SRC})
18+
19+
add_executable(main main.cpp $<TARGET_OBJECTS:shareobjects>)
20+
add_executable(main-fast main.cpp ${BINT_SRC} ${MATH_SRC})
21+
set_target_properties(main-fast PROPERTIES COMPILE_FLAGS -Ofast)
22+
23+
aux_source_directory(tests TESTS)
24+
foreach(tstfile ${TESTS})
25+
string(REGEX MATCH "\/(.*)\\.[^.]*$" dummy ${tstfile})
26+
add_executable(test-${CMAKE_MATCH_1} ${tstfile} $<TARGET_OBJECTS:shareobjects>)
27+
add_test(NAME tst-${CMAKE_MATCH_1} COMMAND ./test-${CMAKE_MATCH_1})
28+
endforeach()
29+

Makefile

-43
This file was deleted.

0 commit comments

Comments
 (0)