Bläddra i källkod

Avoid hard-coding of the sample list in the build script.

Yao Wei Tjong 姚伟忠 9 år sedan
förälder
incheckning
a15abf5068

+ 1 - 1
Rakefile

@@ -319,7 +319,7 @@ task :ci do
     end
   else
     data = YAML::load(File.open('.travis.yml'))['data']
-    data['excluded_sample']["##{ENV['TRAVIS_JOB_NUMBER'].split('.').last}"].each { |name| ENV["EXCLUDE_SAMPLE_#{name}"] = '1' } if data && data['excluded_sample'] && data['excluded_sample']["##{ENV['TRAVIS_JOB_NUMBER'].split('.').last}"]
+    data['excluded_sample']["##{ENV['TRAVIS_JOB_NUMBER'].split('.').last}"].each { |name| ENV["EXCLUDED_SAMPLE_#{name}"] = '1' } if data && data['excluded_sample'] && data['excluded_sample']["##{ENV['TRAVIS_JOB_NUMBER'].split('.').last}"]
   end
   # Unshallow the clone's history when necessary
   if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && !ENV['RELEASE_TAG']

+ 4 - 0
Source/Samples/11_Physics/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 11_Physics)
 

+ 4 - 0
Source/Samples/12_PhysicsStressTest/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 12_PhysicsStressTest)
 

+ 4 - 0
Source/Samples/13_Ragdolls/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 13_Ragdolls)
 

+ 4 - 0
Source/Samples/15_Navigation/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_NAVIGATION)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 15_Navigation)
 

+ 4 - 0
Source/Samples/16_Chat/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_NETWORK)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 16_Chat)
 

+ 4 - 0
Source/Samples/17_SceneReplication/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_NETWORK OR NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 17_SceneReplication)
 

+ 4 - 0
Source/Samples/18_CharacterDemo/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 18_CharacterDemo)
 

+ 4 - 0
Source/Samples/19_VehicleDemo/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_PHYSICS)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 19_VehicleDemo)
 

+ 4 - 0
Source/Samples/21_AngelScriptIntegration/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_ANGELSCRIPT)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 21_AngelScriptIntegration)
 

+ 4 - 0
Source/Samples/22_LuaIntegration/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_LUA)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 22_LuaIntegration)
 

+ 36 - 32
Source/Samples/24_Urho2DSprite/CMakeLists.txt

@@ -1,33 +1,37 @@
-#
-# Copyright (c) 2008-2016 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 24_Urho2DSprite)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
+#
+# Copyright (c) 2008-2016 the Urho3D project.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
+# Define target name
+set (TARGET_NAME 24_Urho2DSprite)
+
+# Define source files
+define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
+
+# Setup target with resource copying
+setup_main_executable ()
+
+# Setup test cases
 setup_test ()

+ 4 - 0
Source/Samples/25_Urho2DParticle/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 25_Urho2DParticle)
 

+ 4 - 0
Source/Samples/27_Urho2DPhysics/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 27_Urho2DPhysics)
 

+ 4 - 0
Source/Samples/28_Urho2DPhysicsRope/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 28_Urho2DPhysicsRope)
 

+ 4 - 0
Source/Samples/32_Urho2DConstraints/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 32_Urho2DConstraints)
 

+ 36 - 32
Source/Samples/33_Urho2DSpriterAnimation/CMakeLists.txt

@@ -1,33 +1,37 @@
-#
-# Copyright (c) 2008-2016 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 33_Urho2DSpriterAnimation)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
+#
+# Copyright (c) 2008-2016 the Urho3D project.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
+# Define target name
+set (TARGET_NAME 33_Urho2DSpriterAnimation)
+
+# Define source files
+define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
+
+# Setup target with resource copying
+setup_main_executable ()
+
+# Setup test cases
 setup_test ()

+ 4 - 0
Source/Samples/36_Urho2DTileMap/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_URHO2D)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 36_Urho2DTileMap)
 

+ 4 - 0
Source/Samples/39_CrowdNavigation/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_NAVIGATION)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 39_CrowdNavigation)
 

+ 4 - 0
Source/Samples/41_DatabaseDemo/CMakeLists.txt

@@ -20,6 +20,10 @@
 # THE SOFTWARE.
 #
 
+if (NOT URHO3D_DATABASE_ODBC AND NOT URHO3D_DATABASE_SQLITE)
+    return ()
+endif ()
+
 # Define target name
 set (TARGET_NAME 41_DatabaseDemo)
 

+ 7 - 57
Source/Samples/CMakeLists.txt

@@ -45,60 +45,10 @@ macro (add_sample_subdirectory SOURCE_DIR)
 endmacro ()
 
 # Add samples
-add_sample_subdirectory (01_HelloWorld)
-add_sample_subdirectory (02_HelloGUI)
-add_sample_subdirectory (03_Sprites)
-add_sample_subdirectory (04_StaticScene)
-add_sample_subdirectory (05_AnimatingScene)
-add_sample_subdirectory (06_SkeletalAnimation)
-add_sample_subdirectory (07_Billboards)
-add_sample_subdirectory (08_Decals)
-add_sample_subdirectory (09_MultipleViewports)
-add_sample_subdirectory (10_RenderToTexture)
-add_sample_subdirectory (14_SoundEffects)
-add_sample_subdirectory (20_HugeObjectCount)
-add_sample_subdirectory (23_Water)
-add_sample_subdirectory (26_ConsoleInput)
-add_sample_subdirectory (29_SoundSynthesis)
-add_sample_subdirectory (30_LightAnimation)
-add_sample_subdirectory (31_MaterialAnimation)
-add_sample_subdirectory (34_DynamicGeometry)
-add_sample_subdirectory (35_SignedDistanceFieldText)
-add_sample_subdirectory (37_UIDrag)
-add_sample_subdirectory (38_SceneAndUILoad)
-if (URHO3D_PHYSICS)
-    add_sample_subdirectory (11_Physics)
-    add_sample_subdirectory (12_PhysicsStressTest)
-    add_sample_subdirectory (13_Ragdolls)
-    add_sample_subdirectory (18_CharacterDemo)
-    add_sample_subdirectory (19_VehicleDemo)
-endif ()
-if (URHO3D_NAVIGATION)
-    add_sample_subdirectory (15_Navigation)
-    add_sample_subdirectory (39_CrowdNavigation)
-endif ()
-if (URHO3D_NETWORK)
-    add_sample_subdirectory (16_Chat)
-endif ()
-if (URHO3D_NETWORK AND URHO3D_PHYSICS)
-    add_sample_subdirectory (17_SceneReplication)
-endif ()
-if (URHO3D_ANGELSCRIPT)
-    add_sample_subdirectory (21_AngelScriptIntegration)
-endif ()
-if (URHO3D_LUA)
-    add_sample_subdirectory (22_LuaIntegration)
-endif ()
-if (URHO3D_URHO2D)
-    add_sample_subdirectory (24_Urho2DSprite)
-    add_sample_subdirectory (25_Urho2DParticle)
-    add_sample_subdirectory (27_Urho2DPhysics)
-    add_sample_subdirectory (28_Urho2DPhysicsRope)
-    add_sample_subdirectory (32_Urho2DConstraints)
-    add_sample_subdirectory (33_Urho2DSpriterAnimation)
-    add_sample_subdirectory (36_Urho2DTileMap)
-endif ()
-add_sample_subdirectory (40_Localization)
-if (URHO3D_DATABASE_ODBC OR URHO3D_DATABASE_SQLITE)
-    add_sample_subdirectory (41_DatabaseDemo)
-endif ()
+file (GLOB_RECURSE DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CMakeLists.txt)
+foreach (DIR ${DIRS})
+    get_filename_component (DIR ${DIR} PATH)
+    if (DIR)
+        add_sample_subdirectory (${DIR})
+    endif ()
+endforeach ()