SDL_ttf: project: move sources in subfolders

From 37368ccd0ce1a8f50c638a9a051f73803a1c4af1 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 17 Jul 2023 18:42:48 +0200
Subject: [PATCH] project: move sources in subfolders

---
 .github/workflows/main.yml                           |  2 +-
 Android.mk                                           |  2 +-
 CMakeLists.txt                                       | 12 ++++++------
 VisualC-WinRT/SDL_ttf-UWP.vcxproj                    |  2 +-
 VisualC/SDL_ttf.vcxproj                              |  4 ++--
 VisualC/SDL_ttf.vcxproj.filters                      |  2 +-
 VisualC/glfont/glfont.vcxproj                        |  2 +-
 VisualC/showfont/showfont.vcxproj                    |  2 +-
 Xcode/SDL_ttf.xcodeproj/project.pbxproj              |  2 +-
 Xcode/showfont/showfont.xcodeproj/project.pbxproj    |  2 +-
 .../test-versioning.sh                               |  4 +++-
 glfont.c => examples/glfont.c                        |  0
 showfont.c => examples/showfont.c                    |  0
 testapp.c => examples/testapp.c                      |  0
 SDL_ttf.c => src/SDL_ttf.c                           |  0
 SDL_ttf.sym => src/SDL_ttf.sym                       |  0
 version.rc => src/version.rc                         |  0
 17 files changed, 19 insertions(+), 17 deletions(-)
 rename test-versioning.sh => build-scripts/test-versioning.sh (98%)
 rename glfont.c => examples/glfont.c (100%)
 rename showfont.c => examples/showfont.c (100%)
 rename testapp.c => examples/testapp.c (100%)
 rename SDL_ttf.c => src/SDL_ttf.c (100%)
 rename SDL_ttf.sym => src/SDL_ttf.sym (100%)
 rename version.rc => src/version.rc (100%)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ad1639f9..f7135777 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -82,7 +82,7 @@ jobs:
     - name: Check that versioning is consistent
       # We only need to run this once: arbitrarily use the Linux build
       if: ${{ runner.os == 'Linux' }}
-      run: ./test-versioning.sh
+      run: ./build-scripts/test-versioning.sh
 
     - name: Configure
       run: |
diff --git a/Android.mk b/Android.mk
index 82642817..53c5b8f7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,7 +23,7 @@ include $(CLEAR_VARS)
 
 LOCAL_MODULE := SDL3_ttf
 
-LOCAL_SRC_FILES := SDL_ttf.c.neon
+LOCAL_SRC_FILES := src/SDL_ttf.c.neon
 
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54e16988..29334312 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,7 +94,7 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
 endif()
 
 add_library(${sdl3_ttf_target_name}
-    SDL_ttf.c
+    src/SDL_ttf.c
 )
 add_library(SDL3_ttf::${sdl3_ttf_target_name} ALIAS ${sdl3_ttf_target_name})
 if(NOT TARGET SDL3_ttf::SDL3_ttf)
@@ -120,7 +120,7 @@ endif()
 sdl_add_warning_options(${sdl3_ttf_target_name} WARNING_AS_ERROR ${SDL3TTF_WERROR})
 if(WIN32 AND SDL3TTF_BUILD_SHARED_LIBS)
     target_sources(${sdl3_ttf_target_name} PRIVATE
-        version.rc
+        src/version.rc
     )
 endif()
 set_target_properties(${sdl3_ttf_target_name} PROPERTIES
@@ -168,7 +168,7 @@ if(SDL3TTF_BUILD_SHARED_LIBS)
     sdl_target_link_options_no_undefined(${sdl3_ttf_target_name})
 endif()
 
-sdl_target_link_option_version_file(${sdl3_ttf_target_name} "${CMAKE_CURRENT_SOURCE_DIR}/SDL_ttf.sym")
+sdl_target_link_option_version_file(${sdl3_ttf_target_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/SDL_ttf.sym")
 
 if(SDL3TTF_BUILD_SHARED_LIBS)
     # Make sure static library dependencies are built with -fPIC when building a shared SDL3_ttf
@@ -342,9 +342,9 @@ if(SDL3TTF_INSTALL)
 endif()
 
 if(SDL3TTF_SAMPLES)
-    add_executable(glfont glfont.c)
-    add_executable(showfont showfont.c)
-    add_executable(testapp testapp.c)
+    add_executable(glfont examples/glfont.c)
+    add_executable(showfont examples/showfont.c)
+    add_executable(testapp examples/testapp.c)
 
     set(OpenGL_GL_PREFERENCE GLVND)
     find_package(OpenGL)
diff --git a/VisualC-WinRT/SDL_ttf-UWP.vcxproj b/VisualC-WinRT/SDL_ttf-UWP.vcxproj
index 67065310..070d505c 100644
--- a/VisualC-WinRT/SDL_ttf-UWP.vcxproj
+++ b/VisualC-WinRT/SDL_ttf-UWP.vcxproj
@@ -120,7 +120,7 @@
     <ClCompile Include="..\external\harfbuzz\src\hb-static.cc" />
     <ClCompile Include="..\external\harfbuzz\src\hb-ucd.cc" />
     <ClCompile Include="..\external\harfbuzz\src\hb-unicode.cc" />
-    <ClCompile Include="..\SDL_ttf.c" />
+    <ClCompile Include="..\src\SDL_ttf.c" />
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{18665277-e558-4484-93f4-e4dc7bb614cb}</ProjectGuid>
diff --git a/VisualC/SDL_ttf.vcxproj b/VisualC/SDL_ttf.vcxproj
index 2ad33bb1..112d3add 100644
--- a/VisualC/SDL_ttf.vcxproj
+++ b/VisualC/SDL_ttf.vcxproj
@@ -340,7 +340,7 @@
     <ClCompile Include="..\external\harfbuzz\src\hb-static.cc" />
     <ClCompile Include="..\external\harfbuzz\src\hb-ucd.cc" />
     <ClCompile Include="..\external\harfbuzz\src\hb-unicode.cc" />
-    <ClCompile Include="..\SDL_ttf.c">
+    <ClCompile Include="..\src\SDL_ttf.c">
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -352,7 +352,7 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="Version.rc">
+    <ResourceCompile Include="src\version.rc">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/VisualC/SDL_ttf.vcxproj.filters b/VisualC/SDL_ttf.vcxproj.filters
index 1b6e08d9..9bbed9a7 100644
--- a/VisualC/SDL_ttf.vcxproj.filters
+++ b/VisualC/SDL_ttf.vcxproj.filters
@@ -21,7 +21,7 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\SDL_ttf.c">
+    <ClCompile Include="..\src\SDL_ttf.c">
       <Filter>Sources</Filter>
     </ClCompile>
     <ClCompile Include="..\external\freetype\src\autofit\autofit.c">
diff --git a/VisualC/glfont/glfont.vcxproj b/VisualC/glfont/glfont.vcxproj
index c3d2c6ec..d07993d4 100644
--- a/VisualC/glfont/glfont.vcxproj
+++ b/VisualC/glfont/glfont.vcxproj
@@ -234,7 +234,7 @@
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\glfont.c">
+    <ClCompile Include="..\..\examples\glfont.c">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/VisualC/showfont/showfont.vcxproj b/VisualC/showfont/showfont.vcxproj
index 5e78a7c2..60e7e2b6 100644
--- a/VisualC/showfont/showfont.vcxproj
+++ b/VisualC/showfont/showfont.vcxproj
@@ -234,7 +234,7 @@
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\showfont.c">
+    <ClCompile Include="..\..\examples\showfont.c">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/Xcode/SDL_ttf.xcodeproj/project.pbxproj b/Xcode/SDL_ttf.xcodeproj/project.pbxproj
index f008591d..fb2da835 100644
--- a/Xcode/SDL_ttf.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_ttf.xcodeproj/project.pbxproj
@@ -316,7 +316,7 @@
 		F384BE47261EC9470028A248 /* hb-fallback-shape.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "hb-fallback-shape.cc"; path = "../external/harfbuzz/src/hb-fallback-shape.cc"; sourceTree = "<group>"; };
 		F384BE60261ECD9F0028A248 /* HarfBuzz-LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "HarfBuzz-LICENSE.txt"; sourceTree = "<group>"; };
 		F384BE61261ECD9F0028A248 /* FreeType-LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "FreeType-LICENSE.txt"; sourceTree = "<group>"; };
-		F567D67A01CD962A01F3E8B9 /* SDL_ttf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_ttf.c; path = ../SDL_ttf.c; sourceTree = SOURCE_ROOT; };
+		F567D67A01CD962A01F3E8B9 /* SDL_ttf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_ttf.c; path = ../src/SDL_ttf.c; sourceTree = SOURCE_ROOT; };
 		F59C710600D5CB5801000001 /* SDL_ttf.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL_ttf.info; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
diff --git a/Xcode/showfont/showfont.xcodeproj/project.pbxproj b/Xcode/showfont/showfont.xcodeproj/project.pbxproj
index ec116d8e..41e4bf70 100644
--- a/Xcode/showfont/showfont.xcodeproj/project.pbxproj
+++ b/Xcode/showfont/showfont.xcodeproj/project.pbxproj
@@ -94,7 +94,7 @@
 		F3ED80B3281D9E8900C33C5B /* showfont.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = showfont.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		F3ED80B9281D9E8900C33C5B /* showfont.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = showfont.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		F3ED80BB281D9E8900C33C5B /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = "<group>"; };
-		F3ED80CA281D9ECB00C33C5B /* showfont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = showfont.c; path = ../../showfont.c; sourceTree = SOURCE_ROOT; };
+		F3ED80CA281D9ECB00C33C5B /* showfont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = showfont.c; path = ../../examples/showfont.c; sourceTree = SOURCE_ROOT; };
 		F3ED80CD281D9ED600C33C5B /* SDL_ttf.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_ttf.xcodeproj; path = ../SDL_ttf.xcodeproj; sourceTree = "<group>"; };
 		F3ED80E1281D9F2100C33C5B /* showfont.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = showfont.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		F3ED80E4281DA17800C33C5B /* SDL3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL3.framework; path = ../macOS/SDL3.framework; sourceTree = "<group>"; };
diff --git a/test-versioning.sh b/build-scripts/test-versioning.sh
similarity index 98%
rename from test-versioning.sh
rename to build-scripts/test-versioning.sh
index cceb9b3e..6fedcbef 100755
--- a/test-versioning.sh
+++ b/build-scripts/test-versioning.sh
@@ -4,6 +4,8 @@
 
 set -eu
 
+cd `dirname $0`/..
+
 # Needed so sed doesn't report illegal byte sequences on macOS
 export LC_CTYPE=C
 
@@ -39,7 +41,7 @@ else
     not_ok "CMakeLists.txt $version disagrees with SDL_ttf.h $ref_version"
 fi
 
-for rcfile in version.rc VisualC/Version.rc; do
+for rcfile in src/version.rc VisualC/Version.rc; do
     tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r')
     ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
 
diff --git a/glfont.c b/examples/glfont.c
similarity index 100%
rename from glfont.c
rename to examples/glfont.c
diff --git a/showfont.c b/examples/showfont.c
similarity index 100%
rename from showfont.c
rename to examples/showfont.c
diff --git a/testapp.c b/examples/testapp.c
similarity index 100%
rename from testapp.c
rename to examples/testapp.c
diff --git a/SDL_ttf.c b/src/SDL_ttf.c
similarity index 100%
rename from SDL_ttf.c
rename to src/SDL_ttf.c
diff --git a/SDL_ttf.sym b/src/SDL_ttf.sym
similarity index 100%
rename from SDL_ttf.sym
rename to src/SDL_ttf.sym
diff --git a/version.rc b/src/version.rc
similarity index 100%
rename from version.rc
rename to src/version.rc