Skip to content

Commit

Permalink
Introduced CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
XaBerr committed Apr 21, 2020
1 parent b1c7e74 commit fe0d73f
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 13,409 deletions.
32 changes: 1 addition & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
/build
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.14)

project(
"LGB-methods"
VERSION 1.0.0
DESCRIPTION "In this repository there are various implementations of the Linde, Buzo, and Gray algorithm (generalize Lloyd-Max algorithm) for the calculation of vector quantizer."
LANGUAGES CXX
)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_subdirectory(apps)
add_subdirectory(tests)
endif()

add_subdirectory(src)
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,53 @@ In this repository there are various implementations of the Linde, Buzo, and Gra

# Documentation

## LGB usage

To make this library work you must include this file.
## Requirements
<div style="background-color: #007bff; color:white; font-weight:bold; font-size:12px; display: inline-block; padding: 1px 4px; border-radius: 3px;">
c++11
</div>
<div style="background-color: #007bff; color:white; font-weight:bold; font-size:12px; display: inline-block; padding: 1px 4px; border-radius: 3px;">
CMake 3.14
</div>

## Installation
- **Manual**
Download this repository:
```sh
git clone git@github.com:XaBerr/LGB-methods.git
```
and compile it running:
```sh
rm build/ -rf;cmake -S . -B build;make -C build;
```

- **CMake module**
Module data:
```java
FetchContent_Declare(
"LGB-methods"
GIT_REPOSITORY https://github.com/XaBerr/LGB-methods.git
GIT_TAG 1.0.0
)
```

## Inclusion
All include file are avaiable in the `include` directory.
You can include each library individually:
```cpp
#include "LGB-methods/src/include.h"
#include <LGB-methods/LGB.h>
#include <LGB-methods/LGBrandom.h>
#include <LGB-methods/LGBsplit.h>
using namespace LGBm;
```
or using the single include:
```cpp
#include <LGB-methods.h>
using namespace LGBm;
```

## Usage

#### LGB
First you need to initialize the quantizer.
```cpp
LGB<float> quantizer;
Expand All @@ -35,7 +74,7 @@ quantizer.run(initialPoints);
quantizer.printVectorPoints(quantizer.codebook);
```

## LGB-random usage
#### LGB-random

To make this library work you must include this file.
```cpp
Expand Down Expand Up @@ -63,7 +102,7 @@ quantizer.run();
quantizer.printVectorPoints(quantizer.codebook);
```

## LGB-split usage
#### LGB-split

To make this library work you must include this file.
```cpp
Expand Down Expand Up @@ -124,4 +163,4 @@ perturbation = 0.01;
- **+2**: Stopped because threshold reached

## Example
Also check out the example in `src/example.cpp`.
Also check out the example in `apps/example.cpp`.
8 changes: 8 additions & 0 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
add_executable(
"${PROJECT_NAME}App"
example.cpp
)
target_link_libraries(
"${PROJECT_NAME}App"
${PROJECT_NAME}
)
2 changes: 1 addition & 1 deletion src/example.cpp → apps/example.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <iostream>
#include "include.h"
#include <LGB-methods.h>
using namespace std;
using namespace LGBm;

Expand Down
3 changes: 3 additions & 0 deletions include/LGB-methods.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "LGB-methods/LGB.h"
#include "LGB-methods/LGBrandom.h"
#include "LGB-methods/LGBsplit.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
file(
GLOB
HEADER_LISTCONFIGURE_DEPENDS
"${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h"
)
add_library(
${PROJECT_NAME}
INTERFACE
)
target_include_directories(
${PROJECT_NAME}
INTERFACE
../include
)

3 changes: 0 additions & 3 deletions src/include.h

This file was deleted.

Loading

0 comments on commit fe0d73f

Please sign in to comment.