3
3
# Note, this needs to be run from your PROJECT directory, not the module's directory
4
4
# e.g.
5
5
# modules/melatonin_inspector/copy_cmake_assets.rb
6
- #
6
+ #
7
7
# You can run it over and over without worry...
8
8
9
9
require 'fileutils'
22
22
if !File . directory? source_dir
23
23
puts "source_dir not found, check the build_dir: " + source_dir
24
24
elsif !File . directory? target_cpp_dir
25
- puts "target_cpp_dir not found, check it: " + target_cpp_dir
25
+ puts "target_cpp_dir not found, check it: " + target_cpp_dir
26
26
else
27
-
27
+
28
28
puts "Removing existing *.cpp and InspectorBinaryData.h"
29
29
FileUtils . rm_rf Dir . glob "#{ target_cpp_dir } /*.cpp"
30
30
FileUtils . rm_f target_h_file
31
-
31
+
32
32
puts "Copying over the newly generated assets"
33
33
FileUtils . cp Dir [ "#{ source_dir } /*.cpp" ] , "#{ target_cpp_dir } /"
34
-
34
+
35
35
puts "Coping over InspectorBinaryData.h"
36
36
FileUtils . cp "#{ source_dir } /InspectorBinaryData.h" , target_h_file
37
-
37
+
38
38
puts "Rewriting #{ mela_cpp_file } with new includes"
39
39
cpp_file = File . open mela_cpp_file , 'w'
40
40
cpp_file . write "// WARNING! This file is automatically written by copy_cmake_assets.rb\n \n "
41
41
cpp_file . write "// As recommended by the JUCE MODULE API, these cpp files are included by the main module cpp\n "
42
42
cpp_file . write "// See https://github.com/juce-framework/JUCE/blob/master/docs/JUCE%20Module%20Format.md#module-cpp-files\n \n "
43
+ cpp_file . write "#include <juce_core/juce_core.h>\n "
44
+ cpp_file . write "JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE(\" -Wredundant-decls\" )\n "
43
45
cpp_file . write "// NOLINTBEGIN(bugprone-suspicious-include)\n "
44
-
46
+
45
47
Dir [ "#{ target_cpp_dir } /*.cpp" ] . each do |file |
46
48
cpp_file . write "#include \" LatestCompiledAssets/#{ File . basename ( file ) } \" \n "
47
49
end
48
- cpp_file . write "// NOLINTEND(bugprone-suspicious-include)\n \n "
50
+ cpp_file . write "// NOLINTEND(bugprone-suspicious-include)\n "
51
+ cpp_file . write "JUCE_END_IGNORE_WARNINGS_GCC_LIKE\n "
49
52
cpp_file . close
50
53
end
51
54
52
- puts "All done."
55
+ puts "All done."
0 commit comments