Skip to content

Commit

Permalink
Move source dirs into flashlight dir and fix include paths (#216)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: flashlight/flashlight#216

Change project structure in the following ways:
- Creating a new `flashlight` directory inside of the project root.
- Moving the "flashlight core" to `flashlight/fl`
- Moving `app` to `flashlight/app`
- Moving `lib` to `flashlight/lib`
- Moving `ext` to `flashlight/ext`
- I'll change include directories throughout the project to reflect the new location -- generally, `s|#include "flashlight/flashlight|#include flashlight/fl|g`.
- I won't be touching namespaces at this time.

The new project structure will roughly be:
```
[project root]
    flashlight/
        app/
        ext/
        lib/
        fl/
            nn/
                modules/
                    Conv2D.h
    bindings/
    cmake/
    docs/
    ...
```

This fixes installation issues and makes it so that the name of the directory containing the project doesn't create problems for header portability/is needed for `vcpkg`.

See [this document](https://fb.quip.com/aLksAcfobRSP) for the motivation/more details.

### Command summary:

flashlight core
```
hg mv deeplearning/projects/flashlight deeplearning/projects/fl
mkdir deeplearning/projects/flashlight/flashlight
hg mv deeplearning/projects/fl deeplearning/projects/flashlight/flashlight
```

```
# lib
hg mv deeplearning/projects/flashlight/lib deeplearning/projects/flashlight/flashlight/
hg mv deeplearning/projects/flashlight/ext deeplearning/projects/flashlight/flashlight/
hg mv deeplearning/projects/flashlight/app deeplearning/projects/flashlight/flashlight/
```

Adjust headers:
```
find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.cuh" -o -name "*.cu"  -o -name "*.hpp" \) \
    | xargs sed -i 's|#include "flashlight/flashlight|#include "flashlight/fl|g'
```

Adjust `TARGETS`:
```
find . -type f -name "TARGETS" \
    | xargs sed -i 's|deeplearning/projects/flashlight/flashlight|deeplearning/projects/flashlight/flashlight/fl|g'

find . -type f -name "TARGETS" \
    | xargs sed -i 's|deeplearning/projects/flashlight/lib|deeplearning/projects/flashlight/flashlight/lib|g'

find . -type f -name "TARGETS" \
    | xargs sed -i 's|deeplearning/projects/flashlight/ext|deeplearning/projects/flashlight/flashlight/ext|g'

find . -type f -name "TARGETS" \
    | xargs sed -i 's|deeplearning/projects/flashlight/app|deeplearning/projects/flashlight/flashlight/app|g'
```

Fix include directories in targets:
```

find . -type f -name "TARGETS" \
    | xargs sed -i 's|"-Ideeplearning/projects/"|"-Ideeplearning/projects/flashlight"|g'
```

Reviewed By: syhw, tlikhomanenko

Differential Revision: D24634434

fbshipit-source-id: d8bbfb2cdfedeaf68754bb38109efd4822e20fc7
  • Loading branch information
jacobkahn authored and facebook-github-bot committed Oct 30, 2020
1 parent 6c4db18 commit f5e175f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion recipes/self_training/pseudo_labeling/AnalyzeDataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "recipes/self_training/pseudo_labeling/Dataset.h"

#include <flashlight/flashlight/meter/EditDistanceMeter.h>
#include <flashlight/fl/meter/EditDistanceMeter.h>
#include <gflags/gflags.h>
#include <glog/logging.h>

Expand Down
2 changes: 1 addition & 1 deletion recipes/utilities/convlm_serializer/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <fstream>

#include <flashlight/ext/common/SequentialBuilder.h>
#include <flashlight/flashlight/contrib/contrib.h>
#include <flashlight/fl/contrib/contrib.h>
#include <flashlight/lib/common/String.h>
#include <flashlight/lib/common/System.h>
#include <glog/logging.h>
Expand Down
2 changes: 1 addition & 1 deletion recipes/utilities/convlm_serializer/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <string>
#include <vector>

#include <flashlight/flashlight/flashlight.h>
#include <flashlight/fl/flashlight.h>

struct ConvLMParamState {
const std::string moduleName;
Expand Down

0 comments on commit f5e175f

Please sign in to comment.