From 646db73f7356b3cd84701f7616fa585c9a4c1659 Mon Sep 17 00:00:00 2001 From: "liuhaibo.2020" Date: Fri, 15 May 2020 16:29:02 +0800 Subject: [PATCH] add CMakeLists.txt files --- .gitignore | 11 +- CMakeLists.txt | 26 ++++ src/3rd-party/Box2D/CMakeLists.txt | 98 +++++++++++++++ src/3rd-party/Box2D/Common/b2Math.h | 2 +- src/3rd-party/curl/CMakeLists.txt | 18 +++ src/3rd-party/imgui/CMakeLists.txt | 15 +++ src/3rd-party/nlohmann/CMakeLists.txt | 9 ++ src/3rd-party/pugixml/CMakeLists.txt | 10 ++ src/kiwano-audio/CMakeLists.txt | 16 +++ src/kiwano-imgui/CMakeLists.txt | 15 +++ src/kiwano-network/CMakeLists.txt | 11 ++ src/kiwano-physics/CMakeLists.txt | 25 ++++ src/kiwano/CMakeLists.txt | 175 ++++++++++++++++++++++++++ 13 files changed, 429 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/3rd-party/Box2D/CMakeLists.txt create mode 100644 src/3rd-party/curl/CMakeLists.txt create mode 100644 src/3rd-party/imgui/CMakeLists.txt create mode 100644 src/3rd-party/nlohmann/CMakeLists.txt create mode 100644 src/3rd-party/pugixml/CMakeLists.txt create mode 100644 src/kiwano-audio/CMakeLists.txt create mode 100644 src/kiwano-imgui/CMakeLists.txt create mode 100644 src/kiwano-network/CMakeLists.txt create mode 100644 src/kiwano-physics/CMakeLists.txt create mode 100644 src/kiwano/CMakeLists.txt diff --git a/.gitignore b/.gitignore index d2193be3..7c3945ca 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,13 @@ x64/ Debug/ Release/ +# CMake folders +/cmake-build-release/ +/cmake-build-debug/ + # Application folders .vs +.idea # vs2010 ipch/ @@ -27,4 +32,8 @@ packages/ # Resources bin *.aps -docs/ \ No newline at end of file +# Mac cache files +.DS_Store + +# Documents +docs/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..cd27226e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.16) +project(Kiwano C CXX) + +set(CMAKE_CXX_STANDARD 17) + +if (WIN32) + message(STATUS "Building on Windows platform.") +elseif (APPLE) + message(STATUS "Building on MacOS platform.") + add_compile_definitions(TARGET_OS_MAC) +elseif (UNIX) + message(STATUS "Building on UNIX-like OS platform.") +endif () + +include_directories(src/3rd-party) +include_directories(src) + +add_subdirectory(src/kiwano) +add_subdirectory(src/kiwano-audio) +add_subdirectory(src/kiwano-imgui) +add_subdirectory(src/kiwano-network) +add_subdirectory(src/kiwano-physics) +add_subdirectory(src/3rd-party/Box2D) +add_subdirectory(src/3rd-party/curl) +add_subdirectory(src/3rd-party/nlohmann) +add_subdirectory(src/3rd-party/pugixml) diff --git a/src/3rd-party/Box2D/CMakeLists.txt b/src/3rd-party/Box2D/CMakeLists.txt new file mode 100644 index 00000000..17f90b54 --- /dev/null +++ b/src/3rd-party/Box2D/CMakeLists.txt @@ -0,0 +1,98 @@ +include_directories(..) + +set(SOURCE_FILES + Collision/Shapes/b2ChainShape.cpp + Collision/Shapes/b2ChainShape.h + Collision/Shapes/b2CircleShape.cpp + Collision/Shapes/b2CircleShape.h + Collision/Shapes/b2EdgeShape.cpp + Collision/Shapes/b2EdgeShape.h + Collision/Shapes/b2PolygonShape.cpp + Collision/Shapes/b2PolygonShape.h + Collision/Shapes/b2Shape.h + Collision/b2BroadPhase.cpp + Collision/b2BroadPhase.h + Collision/b2CollideCircle.cpp + Collision/b2CollideEdge.cpp + Collision/b2CollidePolygon.cpp + Collision/b2Collision.cpp + Collision/b2Collision.h + Collision/b2Distance.cpp + Collision/b2Distance.h + Collision/b2DynamicTree.cpp + Collision/b2DynamicTree.h + Collision/b2TimeOfImpact.cpp + Collision/b2TimeOfImpact.h + Common/b2BlockAllocator.cpp + Common/b2BlockAllocator.h + Common/b2Draw.cpp + Common/b2Draw.h + Common/b2GrowableStack.h + Common/b2Math.cpp + Common/b2Math.h + Common/b2Settings.cpp + Common/b2Settings.h + Common/b2StackAllocator.cpp + Common/b2StackAllocator.h + Common/b2Timer.cpp + Common/b2Timer.h + Dynamics/Contacts/b2ChainAndCircleContact.cpp + Dynamics/Contacts/b2ChainAndCircleContact.h + Dynamics/Contacts/b2ChainAndPolygonContact.cpp + Dynamics/Contacts/b2ChainAndPolygonContact.h + Dynamics/Contacts/b2CircleContact.cpp + Dynamics/Contacts/b2CircleContact.h + Dynamics/Contacts/b2Contact.cpp + Dynamics/Contacts/b2Contact.h + Dynamics/Contacts/b2ContactSolver.cpp + Dynamics/Contacts/b2ContactSolver.h + Dynamics/Contacts/b2EdgeAndCircleContact.cpp + Dynamics/Contacts/b2EdgeAndCircleContact.h + Dynamics/Contacts/b2EdgeAndPolygonContact.cpp + Dynamics/Contacts/b2EdgeAndPolygonContact.h + Dynamics/Contacts/b2PolygonAndCircleContact.cpp + Dynamics/Contacts/b2PolygonAndCircleContact.h + Dynamics/Contacts/b2PolygonContact.cpp + Dynamics/Contacts/b2PolygonContact.h + Dynamics/Joints/b2DistanceJoint.cpp + Dynamics/Joints/b2DistanceJoint.h + Dynamics/Joints/b2FrictionJoint.cpp + Dynamics/Joints/b2FrictionJoint.h + Dynamics/Joints/b2GearJoint.cpp + Dynamics/Joints/b2GearJoint.h + Dynamics/Joints/b2Joint.cpp + Dynamics/Joints/b2Joint.h + Dynamics/Joints/b2MotorJoint.cpp + Dynamics/Joints/b2MotorJoint.h + Dynamics/Joints/b2MouseJoint.cpp + Dynamics/Joints/b2MouseJoint.h + Dynamics/Joints/b2PrismaticJoint.cpp + Dynamics/Joints/b2PrismaticJoint.h + Dynamics/Joints/b2PulleyJoint.cpp + Dynamics/Joints/b2PulleyJoint.h + Dynamics/Joints/b2RevoluteJoint.cpp + Dynamics/Joints/b2RevoluteJoint.h + Dynamics/Joints/b2RopeJoint.cpp + Dynamics/Joints/b2RopeJoint.h + Dynamics/Joints/b2WeldJoint.cpp + Dynamics/Joints/b2WeldJoint.h + Dynamics/Joints/b2WheelJoint.cpp + Dynamics/Joints/b2WheelJoint.h + Dynamics/b2Body.cpp + Dynamics/b2Body.h + Dynamics/b2ContactManager.cpp + Dynamics/b2ContactManager.h + Dynamics/b2Fixture.cpp + Dynamics/b2Fixture.h + Dynamics/b2Island.cpp + Dynamics/b2Island.h + Dynamics/b2TimeStep.h + Dynamics/b2World.cpp + Dynamics/b2World.h + Dynamics/b2WorldCallbacks.cpp + Dynamics/b2WorldCallbacks.h + Rope/b2Rope.cpp + Rope/b2Rope.h + Box2D.h) + +add_library(libbox2d ${SOURCE_FILES}) diff --git a/src/3rd-party/Box2D/Common/b2Math.h b/src/3rd-party/Box2D/Common/b2Math.h index 236c1a4a..ee6d56d7 100644 --- a/src/3rd-party/Box2D/Common/b2Math.h +++ b/src/3rd-party/Box2D/Common/b2Math.h @@ -20,7 +20,7 @@ #define B2_MATH_H #include "b2Settings.h" -#include +#include /// This function is used to ensure that a floating point number is not a NaN or infinity. inline bool b2IsValid(float32 x) diff --git a/src/3rd-party/curl/CMakeLists.txt b/src/3rd-party/curl/CMakeLists.txt new file mode 100644 index 00000000..523ca79c --- /dev/null +++ b/src/3rd-party/curl/CMakeLists.txt @@ -0,0 +1,18 @@ +include_directories(..) + +set(SOURCE_FILES + curl.h + curlbuild.h + curlrules.h + curlver.h + easy.h + mprintf.h + multi.h + stdcheaders.h + typecheck-gcc.h) + +add_library(libcurl ${SOURCE_FILES}) + +target_link_libraries(libcurl ./libs/libcurl.lib) + +set_target_properties(libcurl PROPERTIES LINKER_LANGUAGE CXX) diff --git a/src/3rd-party/imgui/CMakeLists.txt b/src/3rd-party/imgui/CMakeLists.txt new file mode 100644 index 00000000..50957205 --- /dev/null +++ b/src/3rd-party/imgui/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories(..) + +set(SOURCE_FILES + imconfig.h + imgui.cpp + imgui.h + imgui_demo.cpp + imgui_draw.cpp + imgui_internal.h + imgui_widgets.cpp + imstb_rectpack.h + imstb_textedit.h + imstb_truetype.h) + +add_library(libimgui ${SOURCE_FILES}) diff --git a/src/3rd-party/nlohmann/CMakeLists.txt b/src/3rd-party/nlohmann/CMakeLists.txt new file mode 100644 index 00000000..5d706720 --- /dev/null +++ b/src/3rd-party/nlohmann/CMakeLists.txt @@ -0,0 +1,9 @@ +include_directories(..) + +set(SOURCE_FILES + json.hpp) + +add_library(libnlohmann ${SOURCE_FILES}) + +set_target_properties(libnlohmann PROPERTIES LINKER_LANGUAGE CXX) + diff --git a/src/3rd-party/pugixml/CMakeLists.txt b/src/3rd-party/pugixml/CMakeLists.txt new file mode 100644 index 00000000..d6a7efaf --- /dev/null +++ b/src/3rd-party/pugixml/CMakeLists.txt @@ -0,0 +1,10 @@ +include_directories(..) + +set(SOURCE_FILES + pugiconfig.hpp + pugixml-impl.hpp + pugixml.hpp) + +add_library(libpugixml ${SOURCE_FILES}) + +set_target_properties(libpugixml PROPERTIES LINKER_LANGUAGE CXX) diff --git a/src/kiwano-audio/CMakeLists.txt b/src/kiwano-audio/CMakeLists.txt new file mode 100644 index 00000000..eea58eeb --- /dev/null +++ b/src/kiwano-audio/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(..) + +set(SOURCE_FILES + AudioModule.cpp + AudioModule.h + kiwano-audio.h + libraries.cpp + libraries.h + Sound.cpp + Sound.h + SoundPlayer.cpp + SoundPlayer.h + Transcoder.cpp + Transcoder.h) + +add_library(libkiwanoaudio ${SOURCE_FILES}) diff --git a/src/kiwano-imgui/CMakeLists.txt b/src/kiwano-imgui/CMakeLists.txt new file mode 100644 index 00000000..6296cac1 --- /dev/null +++ b/src/kiwano-imgui/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories(..) + +set(SOURCE_FILES + imgui_impl/imgui_impl.h + imgui_impl/imgui_impl_dx10.cpp + imgui_impl/imgui_impl_dx10.h + imgui_impl/imgui_impl_dx11.cpp + imgui_impl/imgui_impl_dx11.h + ImGuiLayer.cpp + ImGuiLayer.h + ImGuiModule.cpp + ImGuiModule.h + kiwano-imgui.h) + +add_library(libkiwanoimgui ${SOURCE_FILES}) diff --git a/src/kiwano-network/CMakeLists.txt b/src/kiwano-network/CMakeLists.txt new file mode 100644 index 00000000..f804e7ff --- /dev/null +++ b/src/kiwano-network/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories(..) + +set(SOURCE_FILES + HttpModule.cpp + HttpModule.h + HttpRequest.cpp + HttpRequest.h + HttpResponse.hpp + kiwano-network.h) + +add_library(libkiwanonetwork ${SOURCE_FILES}) diff --git a/src/kiwano-physics/CMakeLists.txt b/src/kiwano-physics/CMakeLists.txt new file mode 100644 index 00000000..7dabf36d --- /dev/null +++ b/src/kiwano-physics/CMakeLists.txt @@ -0,0 +1,25 @@ +include_directories(..) +include_directories(../3rd-party) + +set(SOURCE_FILES + Contact.cpp + Contact.h + ContactEdge.cpp + ContactEdge.h + ContactEvent.cpp + ContactEvent.h + Fixture.cpp + Fixture.h + Global.cpp + Global.h + Joint.cpp + Joint.h + kiwano-physics.h + PhysicBody.cpp + PhysicBody.h + PhysicWorld.cpp + PhysicWorld.h) + +add_library(libkiwanophysics ${SOURCE_FILES}) + +target_link_libraries(libkiwanophysics libbox2d) diff --git a/src/kiwano/CMakeLists.txt b/src/kiwano/CMakeLists.txt new file mode 100644 index 00000000..cbb8d953 --- /dev/null +++ b/src/kiwano/CMakeLists.txt @@ -0,0 +1,175 @@ +include_directories(..) + +set(SOURCE_FILES + 2d/action/Action.cpp + 2d/action/Action.h + 2d/action/ActionDelay.cpp + 2d/action/ActionDelay.h + 2d/action/ActionGroup.cpp + 2d/action/ActionGroup.h + 2d/action/ActionHelper.h + 2d/action/ActionManager.cpp + 2d/action/ActionManager.h + 2d/action/ActionTween.cpp + 2d/action/ActionTween.h + 2d/action/ActionWalk.cpp + 2d/action/ActionWalk.h + 2d/action/Animation.cpp + 2d/action/Animation.h + 2d/Actor.cpp + 2d/Actor.h + 2d/Button.cpp + 2d/Button.h + 2d/Canvas.cpp + 2d/Canvas.h + 2d/Component.cpp + 2d/Component.h + 2d/DebugActor.cpp + 2d/DebugActor.h + 2d/GifSprite.cpp + 2d/GifSprite.h + 2d/LayerActor.cpp + 2d/LayerActor.h + 2d/ShapeActor.cpp + 2d/ShapeActor.h + 2d/Sprite.cpp + 2d/Sprite.h + 2d/Stage.cpp + 2d/Stage.h + 2d/TextActor.cpp + 2d/TextActor.h + 2d/Transition.cpp + 2d/Transition.h + core/event/Event.cpp + core/event/Event.h + core/event/EventType.h + core/event/KeyEvent.cpp + core/event/KeyEvent.h + core/event/MouseEvent.cpp + core/event/MouseEvent.h + core/event/WindowEvent.cpp + core/event/WindowEvent.h + core/Allocator.cpp + core/Allocator.h + core/Any.h + core/Cloneable.h + core/Common.h + core/Director.cpp + core/Director.h + core/EventDispatcher.cpp + core/EventDispatcher.h + core/EventListener.cpp + core/EventListener.h + core/Exception.cpp + core/Exception.h + core/Function.h + core/IntrusiveList.h + core/Json.h + core/Keys.h + core/Library.cpp + core/Library.h + core/Logger.cpp + core/Logger.h + core/Module.cpp + core/Module.h + core/ObjectBase.cpp + core/ObjectBase.h + core/RefCounter.cpp + core/RefCounter.h + core/Resource.cpp + core/Resource.h + core/Serializable.h + core/Singleton.h + core/SmartPtr.hpp + core/String.cpp + core/String.h + core/Time.cpp + core/Time.h + core/Timer.cpp + core/Timer.h + core/TimerManager.cpp + core/TimerManager.h + core/Xml.h + math/Constants.h + math/EaseFunctions.h + math/Math.h + math/Matrix.hpp + math/Random.h + math/Rect.hpp + math/Scalar.h + math/Transform.hpp + math/Vec2.hpp + platform/win32/ComPtr.hpp + platform/win32/libraries.cpp + platform/win32/libraries.h + platform/win32/WindowImpl.cpp + platform/Application.cpp + platform/Application.h + platform/FileSystem.cpp + platform/FileSystem.h + platform/Input.cpp + platform/Input.h + platform/Runner.cpp + platform/Runner.h + platform/Window.cpp + platform/Window.h + render/DirectX/D2DDeviceResources.cpp + render/DirectX/D2DDeviceResources.h + render/DirectX/D3D10DeviceResources.cpp + render/DirectX/D3D10DeviceResources.h + render/DirectX/D3D11DeviceResources.cpp + render/DirectX/D3D11DeviceResources.h + render/DirectX/D3DDeviceResourcesBase.h + render/DirectX/FontCollectionLoader.cpp + render/DirectX/FontCollectionLoader.h + render/DirectX/helper.h + render/DirectX/NativePtr.h + render/DirectX/RenderContextImpl.cpp + render/DirectX/RenderContextImpl.h + render/DirectX/RendererImpl.cpp + render/DirectX/RendererImpl.h + render/DirectX/TextRenderer.cpp + render/DirectX/TextRenderer.h + render/Brush.cpp + render/Brush.h + render/Color.cpp + render/Color.h + render/Font.cpp + render/Font.h + render/Frame.cpp + render/Frame.h + render/FrameSequence.cpp + render/FrameSequence.h + render/GifImage.cpp + render/GifImage.h + render/Layer.cpp + render/Layer.h + render/NativeObject.h + render/RenderContext.cpp + render/RenderContext.h + render/Renderer.cpp + render/Renderer.h + render/Shape.cpp + render/Shape.h + render/ShapeMaker.cpp + render/ShapeMaker.h + render/StrokeStyle.cpp + render/StrokeStyle.h + render/TextLayout.cpp + render/TextLayout.h + render/TextStyle.hpp + render/Texture.cpp + render/Texture.h + render/TextureCache.cpp + render/TextureCache.h + utils/LocalStorage.cpp + utils/LocalStorage.h + utils/ResourceCache.cpp + utils/ResourceCache.h + utils/UserData.cpp + utils/UserData.h + config.h + kiwano.h + macros.h) + +add_library(libkiwano ${SOURCE_FILES})