Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAJOR CHANGE (but not really): Move headers to src/ directory #504

Closed
wants to merge 9 commits into from

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Apr 19, 2020

This implements the proposal I made in #471, that header files live in the src/ directory alongside their *.cpp files, rather than being kept in an include/ directory.

  • Move all /include/**/*.h to /src/... (with same hierarchy)
  • Move /src/examples to /examples
  • Move /src/Qt/demo to /examples/qt-demo
  • Move /src/bindings/ to /bindings
  • Adjust source files (far fewer relative includes):
    • /src/**/*.cpp
    • /src/**/*.h
    • examples/**/*.cpp
    • tests/**/*.cpp
  • Change #include "JuceHeader.h" to #include <JuceHeader.h> everywhere, since that header isn't part of our local source for the purposes of a libopenshot build
  • Adjust all CMakeLists.txt files to account for new include path
  • Add an examples/CMakeLists.txt, and move the logic for compiling and installing the necessary components to that file
  • Add logic to tests/CMakeLists, examples/CMakeLists, /CMakeLists.txt so that build components are imported locally when needed
  • Update Doxygen.in file to build docs from new locations

This will be confusing, at first, when looking for moved files. (I've confused myself a couple of times already.) The relocated bindings directory is the one that throws me the most. But it really is much simpler this way. Both in terms of humans editing the code, and in terms of the contents of the code.

The reason src/examples, src/Qt/demo, and src/bindings got moved out of src/ is in small part practical: If there are directories in src/ without any installable headers, the install(DIRECTORY...) CMake command will end up creating empty directories in the output location. So, I wanted to avoid that.

But at the same time, the fact that that happens makes the point: none of those directories' contents are part of the libopenshot source code itself. So they really don't belong in the libopenshot source dir. It makes more sense if they're separated.

The Doxygen docs mostly come out better, now. It never could follow the parent-relative #includes, so in the past none of the source code listings' #includes linked to the header in question. Now almost all of them do, except for a few #include "../foo.h" statements in the src/effects/ or src/Qt paths. (And in theory I could eliminate those using the include path, since #include "ReaderBase.h" should mean the same thing in src/effects/Blur.h that it means anywhere else. But I haven't tackled that for this PR, so it [still] uses #include "../ReaderBase.h".)

I've tested this in CMake 3.2 and CMake 3.17 and everything worked, but I've only tested it on Linux. This branch is in the project repo, so the builders can chew on it in addition to Travis. (And if we merge #501, also AppVeyor.)

- Move all /include/**/*.h to /src/... (with same hierarchy)
- Move /src/examples to /examples
- Move /src/Qt/demo to /examples/qt-demo
- Adjust source files (far fewer relative includes):
  - /src/**/*.cpp
  - /src/**/*.h
  - examples/**/*.cpp
  - tests/**/*.cpp
- Eliminate relative includes from all examples/, tests/ source files
- Adjust all CMakeLists.txt files to account for new include path
- Add an examples/CMakeLists.txt, and move the logic for compiling
  and installing the necessary components to that file
- Add logic to tests/CMakeLists, examples/CMakeLists, /CMakeLists.txt
  so that build components are imported locally when needed
- Update Doxygen.in file to build docs from new locations
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Apr 19, 2020

Oh, I forgot to mention: This shouldn't affect anyone's builds or use of the library, since the installed output is exactly the same. It just takes a different path getting there. But it will affect developers, obviously, including anyone running OpenShot out of a build dir with PYTHONPATH=...build/src/bindings/python (that would now become PYTHONPATH=...build/bindings/python).

- Makes the generated documentation cleaner
- Use a generated 120x120px openshot-qt.png as logo image
- Add summary from project metadata to page header
- Turn off STL support, was cluttering diagrams with std::string refs
- Fix some errant documentation comments in the source files
@codecov-io
Copy link

codecov-io commented Apr 22, 2020

Codecov Report

Merging #504 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #504   +/-   ##
========================================
  Coverage    48.24%   48.25%           
========================================
  Files          128      128           
  Lines         9962     9960    -2     
========================================
  Hits          4806     4806           
+ Misses        5156     5154    -2     
Impacted Files Coverage Δ
examples/Example.cpp 0.00% <ø> (ø)
examples/ExampleHtml.cpp 0.00% <ø> (ø)
examples/qt-demo/main.cpp 0.00% <ø> (ø)
src/AudioBufferSource.cpp 0.00% <ø> (ø)
src/AudioDeviceInfo.h 0.00% <ø> (ø)
src/AudioReaderSource.cpp 0.00% <ø> (ø)
src/AudioReaderSource.h 0.00% <ø> (ø)
src/AudioResampler.cpp 0.00% <ø> (ø)
src/CacheBase.cpp 68.75% <ø> (ø)
src/CacheBase.h 75.00% <ø> (ø)
... and 117 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e7e741...c61a32a. Read the comment docs.

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2020

Codecov Report

Merging #504 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #504   +/-   ##
========================================
  Coverage    48.33%   48.34%           
========================================
  Files          128      128           
  Lines         9952     9950    -2     
========================================
  Hits          4810     4810           
+ Misses        5142     5140    -2     
Impacted Files Coverage Δ
examples/Example.cpp 0.00% <ø> (ø)
examples/ExampleHtml.cpp 0.00% <ø> (ø)
examples/qt-demo/main.cpp 0.00% <ø> (ø)
src/AudioBufferSource.cpp 0.00% <ø> (ø)
src/AudioDeviceInfo.h 0.00% <ø> (ø)
src/AudioReaderSource.cpp 0.00% <ø> (ø)
src/AudioReaderSource.h 0.00% <ø> (ø)
src/AudioResampler.cpp 0.00% <ø> (ø)
src/CacheBase.cpp 68.75% <ø> (ø)
src/CacheBase.h 75.00% <ø> (ø)
... and 117 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 972c290...8d8615f. Read the comment docs.

@jonoomph
Copy link
Member

jonoomph commented Oct 16, 2020

@ferdnyc This one seems scary to me... and lots of conflicts. I might wait on this for now. I think this is more of an emotional response, vs a technical one. Technically, nothing is wrong with this at all.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Oct 17, 2020

@ferdnyc This one seems scary to me... and lots of conflicts. I might wait on this for now. I think this is more of an emotional response, vs a technical one. Technically, nothing is wrong with this at all.

@jonoomph

Honestly, the only way to do something like this is to set it up and then commit it immediately, or pretty close. It touches every header, so conflicts are inevitable and they pile up fast... but it's mostly just a few quick git mv commands to actually set the changes up on a current branch. The file content edits are pretty much just a search-and-replace of all the #include lines, and then some CMakeLists.txt tweaks; they're way easier to redo than to try and reconcile with other changes.

If you're down with the concept, I'll re-create this as a new PR and we can get it merged quick before the conflicts pile up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants