Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jonylu7 committed Mar 8, 2024
2 parents 68f0f5d + 79f36c1 commit 75004e8
Show file tree
Hide file tree
Showing 206 changed files with 72,356 additions and 455 deletions.
285 changes: 185 additions & 100 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,168 +6,253 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (MSVC)
set(TARGET_COMPILE_OPTIONS
/W4
/W4
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/build)
else()
else ()
set(TARGET_COMPILE_OPTIONS
-Wall -Wextra -pedantic
-Wall -Wextra -pedantic
)
endif()
endif ()

if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# see https://github.com/ntut-open-source-club/practical-tools-for-simple-design/issues/22
set(CMAKE_RC_FLAGS="-C 1252")
endif()
endif ()

option(PTSD_ENABLE_PCH "Turn on PCH to increase compilation speed" OFF)

include(cmake/Dependencies.cmake)

set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
set(SRC_FILES
${SRC_DIR}/Core/Context.cpp
${SRC_DIR}/Core/DebugMessageCallback.cpp
${SRC_DIR}/Core/VertexArray.cpp
${SRC_DIR}/Core/VertexBuffer.cpp
${SRC_DIR}/Core/IndexBuffer.cpp
${SRC_DIR}/Core/Shader.cpp
${SRC_DIR}/Core/Program.cpp
${SRC_DIR}/Core/Texture.cpp
${SRC_DIR}/Core/TextureUtils.cpp

${SRC_DIR}/Util/LoadTextFile.cpp
${SRC_DIR}/Util/Logger.cpp
${SRC_DIR}/Util/Time.cpp
${SRC_DIR}/Util/Input.cpp
${SRC_DIR}/Util/SFX.cpp
${SRC_DIR}/Util/BGM.cpp
${SRC_DIR}/Util/Image.cpp
${SRC_DIR}/Util/Text.cpp
${SRC_DIR}/Util/TransformUtils.cpp
${SRC_DIR}/Util/GameObject.cpp
${SRC_DIR}/Util/Renderer.cpp
${SRC_DIR}/Util/Color.cpp
${SRC_DIR}/Util/Animation.cpp
${SRC_DIR}/Util/MissingTexture.cpp

${SRC_DIR}/App.cpp
${SRC_DIR}/Giraffe.cpp
${SRC_DIR}/GiraffeText.cpp
${SRC_DIR}/Cat.cpp
${SRC_DIR}/Core/Context.cpp
${SRC_DIR}/Core/DebugMessageCallback.cpp
${SRC_DIR}/Core/VertexArray.cpp
${SRC_DIR}/Core/VertexBuffer.cpp
${SRC_DIR}/Core/IndexBuffer.cpp
${SRC_DIR}/Core/Shader.cpp
${SRC_DIR}/Core/Program.cpp
${SRC_DIR}/Core/Texture.cpp
${SRC_DIR}/Core/TextureUtils.cpp


${SRC_DIR}/Util/LoadTextFile.cpp
${SRC_DIR}/Util/Logger.cpp
${SRC_DIR}/Util/Time.cpp
${SRC_DIR}/Util/Input.cpp
${SRC_DIR}/Util/SFX.cpp
${SRC_DIR}/Util/BGM.cpp
${SRC_DIR}/Util/Image.cpp
${SRC_DIR}/Util/Text.cpp
${SRC_DIR}/Util/TransformUtils.cpp
${SRC_DIR}/Util/GameObject.cpp
${SRC_DIR}/Util/Renderer.cpp
${SRC_DIR}/Util/Color.cpp
${SRC_DIR}/Util/Animation.cpp
${SRC_DIR}/Util/MissingTexture.cpp

${SRC_DIR}/Util/ImageArray.cpp
${SRC_DIR}/Util/CustomizableImage.cpp

${SRC_DIR}/imgui/imgui.cpp
${SRC_DIR}/imgui/imgui_demo.cpp
${SRC_DIR}/imgui/imgui_draw.cpp
${SRC_DIR}/imgui/imgui_impl_sdl2.cpp
${SRC_DIR}/imgui/imgui_tables.cpp
${SRC_DIR}/imgui/imgui_widgets.cpp
${SRC_DIR}/imgui/imgui_impl_sdlrenderer2.cpp
${SRC_DIR}/imgui/imgui_impl_opengl3.cpp

${SRC_DIR}/App.cpp
${SRC_DIR}/Grid.cpp

${SRC_DIR}/Structure/Structure.cpp
${SRC_DIR}/Structure/WayPoint.cpp
${SRC_DIR}/Structure/WayPointTool.cpp
${SRC_DIR}/Structure/IWayPointStructure.cpp
${SRC_DIR}/Structure/HighLight.cpp
${SRC_DIR}/UIScriptProcess.cpp

# ${SRC_DIR}/Structure/Buildings.cpp
${SRC_DIR}/Structure/Barracks.cpp
${SRC_DIR}/Structure/OreRefinery.cpp
${SRC_DIR}/Structure/PowerPlants.cpp
${SRC_DIR}/Structure/WarFactory.cpp
#${SRC_DIR}/Structure/ADVPowerPlants.cpp

${SRC_DIR}/Scene/DefaultScene.cpp
${SRC_DIR}/Camera.cpp
${SRC_DIR}/SpriteSheet.cpp
${SRC_DIR}/UI.cpp


)
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(INCLUDE_FILES
${INCLUDE_DIR}/Core/Context.hpp
${INCLUDE_DIR}/Core/DebugMessageCallback.hpp
${INCLUDE_DIR}/Core/VertexArray.hpp
${INCLUDE_DIR}/Core/VertexBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.inl
${INCLUDE_DIR}/Core/IndexBuffer.hpp
${INCLUDE_DIR}/Core/Shader.hpp
${INCLUDE_DIR}/Core/Program.hpp
${INCLUDE_DIR}/Core/Texture.hpp
${INCLUDE_DIR}/Core/TextureUtils.hpp
${INCLUDE_DIR}/Core/Drawable.hpp

${INCLUDE_DIR}/Util/LoadTextFile.hpp
${INCLUDE_DIR}/Util/Logger.hpp
${INCLUDE_DIR}/Util/Time.hpp
${INCLUDE_DIR}/Util/Input.hpp
${INCLUDE_DIR}/Util/Keycode.hpp
${INCLUDE_DIR}/Util/SFX.hpp
${INCLUDE_DIR}/Util/BGM.hpp
${INCLUDE_DIR}/Util/Image.hpp
${INCLUDE_DIR}/Util/Text.hpp
${INCLUDE_DIR}/Util/Transform.hpp
${INCLUDE_DIR}/Util/TransformUtils.hpp
${INCLUDE_DIR}/Util/GameObject.hpp
${INCLUDE_DIR}/Util/Renderer.hpp
${INCLUDE_DIR}/Util/Color.hpp
${INCLUDE_DIR}/Util/TransparentImage.hpp
${INCLUDE_DIR}/Util/Base64.hpp
${INCLUDE_DIR}/Util/Animation.hpp

${INCLUDE_DIR}/App.hpp
${INCLUDE_DIR}/Giraffe.hpp
${INCLUDE_DIR}/GiraffeText.hpp
${INCLUDE_DIR}/Cat.hpp
${INCLUDE_DIR}/config.hpp
${INCLUDE_DIR}/Core/Context.hpp
${INCLUDE_DIR}/Core/DebugMessageCallback.hpp
${INCLUDE_DIR}/Core/VertexArray.hpp
${INCLUDE_DIR}/Core/VertexBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.inl
${INCLUDE_DIR}/Core/IndexBuffer.hpp
${INCLUDE_DIR}/Core/Shader.hpp
${INCLUDE_DIR}/Core/Program.hpp
${INCLUDE_DIR}/Core/Texture.hpp
${INCLUDE_DIR}/Core/TextureUtils.hpp
${INCLUDE_DIR}/Core/Drawable.hpp


${INCLUDE_DIR}/Util/LoadTextFile.hpp
${INCLUDE_DIR}/Util/Logger.hpp
${INCLUDE_DIR}/Util/Time.hpp
${INCLUDE_DIR}/Util/Input.hpp
${INCLUDE_DIR}/Util/Keycode.hpp
${INCLUDE_DIR}/Util/SFX.hpp
${INCLUDE_DIR}/Util/BGM.hpp
${INCLUDE_DIR}/Util/Image.hpp
${INCLUDE_DIR}/Util/Text.hpp
${INCLUDE_DIR}/Util/Transform.hpp
${INCLUDE_DIR}/Util/TransformUtils.hpp
${INCLUDE_DIR}/Util/GameObject.hpp
${INCLUDE_DIR}/Util/Renderer.hpp
${INCLUDE_DIR}/Util/Color.hpp
${INCLUDE_DIR}/Util/Animation.hpp
${INCLUDE_DIR}/Util/MissingTexture.hpp

${INCLUDE_DIR}/Util/ImageArray.hpp
${INCLUDE_DIR}/Util/CustomizableImage.hpp


${INCLUDE_DIR}/UI.hpp
${INCLUDE_DIR}/App.hpp
${INCLUDE_DIR}/Tile.hpp
${INCLUDE_DIR}/config.hpp

${INCLUDE_DIR}/config.hpp


${INCLUDE_DIR}/Sprite.hpp
${INCLUDE_DIR}/Settings.hpp
${INCLUDE_DIR}/Camera.hpp

${INCLUDE_DIR}/Structure/Structure.hpp
${INCLUDE_DIR}/Structure/WayPoint.hpp
${INCLUDE_DIR}/Structure/WayPointTool.h
${INCLUDE_DIR}/Structure/IWayPointStructure.hpp
${INCLUDE_DIR}/HighLight.h
${INCLUDE_DIR}/UIScriptProcess.h

#${INCLUDE_DIR}/Structure/Buildings.hpp
${INCLUDE_DIR}/Structure/Barracks.hpp
${INCLUDE_DIR}/Structure/OreRefinery.hpp
${INCLUDE_DIR}/Structure/PowerPlants.hpp
${INCLUDE_DIR}/Structure/WarFactory.hpp
${INCLUDE_DIR}/Structure/ADVPowerPlants.hpp

${INCLUDE_DIR}/imgui/imconfig.h
${INCLUDE_DIR}/imgui/imgui.h
${INCLUDE_DIR}/imgui/imgui_impl_sdl2.h
${INCLUDE_DIR}/imgui/imgui_internal.h
${INCLUDE_DIR}/imgui/imstb_rectpack.h
${INCLUDE_DIR}/imgui/imstb_textedit.h
${INCLUDE_DIR}/imgui/imstb_truetype.h
${INCLUDE_DIR}/imgui/imgui_impl_sdlrenderer2..h
${INCLUDE_DIR}/imgui/imgui_impl_opengl3.h
${INCLUDE_DIR}/imgui/imgui_impl_opengl3_loader.h

${INCLUDE_DIR}/Scene/Scene.hpp

${INCLUDE_DIR}/Core/Context.hpp
${INCLUDE_DIR}/Core/DebugMessageCallback.hpp
${INCLUDE_DIR}/Core/VertexArray.hpp
${INCLUDE_DIR}/Core/VertexBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.hpp
${INCLUDE_DIR}/Core/UniformBuffer.inl
${INCLUDE_DIR}/Core/IndexBuffer.hpp
${INCLUDE_DIR}/Core/Shader.hpp
${INCLUDE_DIR}/Core/Program.hpp
${INCLUDE_DIR}/Core/Texture.hpp


)

set(TEST_DIR ${CMAKE_SOURCE_DIR}/test)
set(TEST_FILES
${TEST_DIR}/SimpleTest.cpp
${TEST_DIR}/NotSimpleTest.cpp
${TEST_DIR}/TransformTest.cpp
${TEST_DIR}/SimpleTest.cpp
${TEST_DIR}/NotSimpleTest.cpp
${TEST_DIR}/TransformTest.cpp
)

add_executable(Sample
${SRC_FILES}
${SRC_DIR}/main.cpp
${SRC_FILES}
${SRC_DIR}/main.cpp
)
target_link_libraries(Sample
SDL2::SDL2main # IDK what happens if we don't link SDL2main
${DEPENDENCY_LINK_LIBRARIES}
SDL2::SDL2main # IDK what happens if we don't link SDL2main
${DEPENDENCY_LINK_LIBRARIES}
)
target_include_directories(Sample SYSTEM PRIVATE
${DEPENDENCY_INCLUDE_DIRS}
${DEPENDENCY_INCLUDE_DIRS}
)
target_include_directories(Sample PRIVATE
${INCLUDE_DIR}
${INCLUDE_DIR}
)
if (${PTSD_ENABLE_PCH})
target_precompile_headers(Sample PRIVATE
include/pch.hpp
include/pch.hpp
)
endif()
endif ()
target_compile_options(Sample PRIVATE
${TARGET_COMPILE_OPTIONS}
${TARGET_COMPILE_OPTIONS}
)


enable_testing()

add_executable(Tests
${TEST_FILES}
${SRC_FILES}
${TEST_FILES}
${SRC_FILES}
)
target_link_libraries(Tests
GTest::gtest_main
${DEPENDENCY_LINK_LIBRARIES}
GTest::gtest_main
${DEPENDENCY_LINK_LIBRARIES}
)
target_include_directories(Tests SYSTEM PRIVATE
${DEPENDENCY_INCLUDE_DIRS}
lib/googletest/googletest/include
lib/googletest/googlemock/include
${DEPENDENCY_INCLUDE_DIRS}
lib/googletest/googletest/include
lib/googletest/googlemock/include
)
target_include_directories(Tests PRIVATE
${INCLUDE_DIR}
${INCLUDE_DIR}
)
target_compile_options(Tests PRIVATE
${TARGET_COMPILE_OPTIONS}
${TARGET_COMPILE_OPTIONS}
)

add_executable(AudioTest
${TEST_DIR}/Interactive/Audio.cpp
${SRC_FILES}
${TEST_DIR}/Interactive/Audio.cpp
${SRC_FILES}
)
target_link_libraries(AudioTest
GTest::gtest_main
${DEPENDENCY_LINK_LIBRARIES}
GTest::gtest_main
${DEPENDENCY_LINK_LIBRARIES}
)
target_include_directories(AudioTest SYSTEM PRIVATE
${DEPENDENCY_INCLUDE_DIRS}
lib/googletest/googletest/include
lib/googletest/googlemock/include
${DEPENDENCY_INCLUDE_DIRS}
lib/googletest/googletest/include
lib/googletest/googlemock/include
)
target_include_directories(AudioTest PRIVATE
${INCLUDE_DIR}
${INCLUDE_DIR}
)
target_compile_options(AudioTest PRIVATE
${TARGET_COMPILE_OPTIONS}
${TARGET_COMPILE_OPTIONS}
)


include(GoogleTest)
gtest_discover_tests(Tests)
Loading

0 comments on commit 75004e8

Please sign in to comment.