Skip to content

Commit

Permalink
Add ctest
Browse files Browse the repository at this point in the history
- update README.md
- remove deprecated files
  • Loading branch information
heat1q committed Jan 2, 2021
1 parent 627c33c commit 78374ef
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 671 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ dkms.conf
.vscode/*
codes/*

CMakeFiles/*
CMakeFiles/*
*.cmake
CMakeCache*
Testing/*
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.10)
# set the project name
project(LDPC-Simulator)

enable_testing()

set(CMAKE_CXX_FLAGS "-O3 -fopenmp -Wall -pthread")
set(SIM_FLAGS "" CACHE STRING "Compile flags (see flags.txt)")
set(BASE_SRC "src/core/gf2.cpp" "src/core/functions.cpp" "src/core/ldpc.cpp" "src/decoding/decoder.cpp" "src/sim/channel.cpp" "src/sim/ldpcsim.cpp")
Expand All @@ -12,14 +14,16 @@ add_executable(ldpcsim "src/sim_cpu.cpp" ${BASE_SRC})
target_compile_definitions(ldpcsim PRIVATE LOG_FRAME_TIME=1 ${SIM_FLAGS})

# add the executable
add_executable(ldpc_tests "tests/init.cpp" ${BASE_SRC})
target_compile_definitions(ldpc_tests PRIVATE ${SIM_FLAGS})
add_executable(ldpctest "tests/init.cpp" ${BASE_SRC})
target_compile_definitions(ldpctest PRIVATE ${SIM_FLAGS})

# shared library
add_library(ldpc SHARED "src/shared.cpp" ${BASE_SRC})
target_compile_definitions(ldpc PRIVATE LOG_FRAME_TIME=1 LIB_SHARED=1 ${SIM_FLAGS})

# specify the C++ standard
target_compile_features(ldpcsim PRIVATE cxx_std_17)
target_compile_features(ldpc_tests PRIVATE cxx_std_17)
target_compile_features(ldpctest PRIVATE cxx_std_17)
target_compile_features(ldpc PRIVATE cxx_std_17)

add_test(NAME ldpctest COMMAND ldpctest ./tests/code/h.txt -G ./tests/code/g.txt)
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
### Getting Started
Building the binary:

`$ cmake . `

`$ make ldpc_sim` produces an executeable containing the simulator, which is used by e.g. the commandline. See **Running the Simulator**.
```
$ cmake .
$ cmake --build . --target TARGET
```
where the target can be the following:
* `--target ldpcsim` produces an executeable containing the simulator, which is used by e.g. the commandline. See **Running the Simulator**.

`$ make ldpc` produces a shared library containing the simulator for external usage. See **Python Wrapper**.
* `--target ldpc` produces a shared library containing the simulator for external usage. See **Python Wrapper**.

### Running the Simulator
After successful build the simulator can be executed. Note the usage:
```
$./ldpc_sim --help
$ ./ldpcsim --help
Usage: ldpc [options] codefile output-file snr-range
Positional arguments:
Expand Down
Loading

0 comments on commit 78374ef

Please sign in to comment.