diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
commit | 60072c1d8089ffd3294e76636198d14710be95b8 (patch) | |
tree | 511d459e9afe69ca58d05880eb53ce44a9a183c6 | |
parent | 660996bd750dbb5fcdce85845ee6b260f3ed23eb (diff) | |
download | YAGE-60072c1d8089ffd3294e76636198d14710be95b8.tar.gz YAGE-60072c1d8089ffd3294e76636198d14710be95b8.zip |
Restructuring
-rw-r--r-- | CMakeLists.txt | 91 | ||||
-rw-r--r-- | yage/CMakeLists.txt | 33 | ||||
-rw-r--r-- | yage/base/CMakeLists.txt | 13 | ||||
-rw-r--r-- | yage/base/camera2d.cpp (renamed from src/camera2d.cpp) | 0 | ||||
-rw-r--r-- | yage/base/camera2d.h (renamed from include/YAGE/camera2d.h) | 0 | ||||
-rw-r--r-- | yage/base/glslprogram.cpp (renamed from src/glslprogram.cpp) | 0 | ||||
-rw-r--r-- | yage/base/glslprogram.h (renamed from include/YAGE/glslprogram.h) | 0 | ||||
-rw-r--r-- | yage/base/imageloader.cpp (renamed from src/imageloader.cpp) | 0 | ||||
-rw-r--r-- | yage/base/imageloader.h (renamed from include/YAGE/imageloader.h) | 0 | ||||
-rw-r--r-- | yage/base/inputmanager.cpp (renamed from src/inputmanager.cpp) | 0 | ||||
-rw-r--r-- | yage/base/inputmanager.h (renamed from include/YAGE/inputmanager.h) | 0 | ||||
-rw-r--r-- | yage/base/iomanager.cpp (renamed from src/iomanager.cpp) | 0 | ||||
-rw-r--r-- | yage/base/iomanager.h (renamed from include/YAGE/iomanager.h) | 0 | ||||
-rw-r--r-- | yage/base/picopng.cpp (renamed from src/picopng.cpp) | 0 | ||||
-rw-r--r-- | yage/base/picopng.h (renamed from include/YAGE/picopng.h) | 0 | ||||
-rw-r--r-- | yage/base/resourcemanager.cpp (renamed from src/resourcemanager.cpp) | 0 | ||||
-rw-r--r-- | yage/base/resourcemanager.h (renamed from include/YAGE/resourcemanager.h) | 0 | ||||
-rw-r--r-- | yage/base/sprite.cpp (renamed from src/sprite.cpp) | 0 | ||||
-rw-r--r-- | yage/base/sprite.h (renamed from include/YAGE/sprite.h) | 0 | ||||
-rw-r--r-- | yage/base/spritebatch.cpp (renamed from src/spritebatch.cpp) | 0 | ||||
-rw-r--r-- | yage/base/spritebatch.h (renamed from include/YAGE/spritebatch.h) | 0 | ||||
-rw-r--r-- | yage/base/spritesheet.h (renamed from include/YAGE/spritesheet.h) | 0 | ||||
-rw-r--r-- | yage/base/texture.h (renamed from include/YAGE/texture.h) | 0 | ||||
-rw-r--r-- | yage/base/texturecache.cpp (renamed from src/texturecache.cpp) | 0 | ||||
-rw-r--r-- | yage/base/texturecache.h (renamed from include/YAGE/texturecache.h) | 0 | ||||
-rw-r--r-- | yage/base/vertex.h (renamed from include/YAGE/vertex.h) | 0 | ||||
-rw-r--r-- | yage/base/window.cpp (renamed from src/window.cpp) | 0 | ||||
-rw-r--r-- | yage/base/window.h (renamed from include/YAGE/window.h) | 0 | ||||
-rw-r--r-- | yage/math/CMakeLists.txt | 1 | ||||
-rw-r--r-- | yage/math/math.h (renamed from include/YAGE/Math/math.h) | 0 | ||||
-rw-r--r-- | yage/math/matrix.h (renamed from include/YAGE/Math/matrix.h) | 0 | ||||
-rw-r--r-- | yage/physics/CMakeLists.txt | 6 | ||||
-rw-r--r-- | yage/physics/README.org (renamed from include/YAGE/Physics/README.org) | 0 | ||||
-rw-r--r-- | yage/physics/body.cpp (renamed from src/body.cpp) | 0 | ||||
-rw-r--r-- | yage/physics/body.h (renamed from include/YAGE/Physics/body.h) | 0 | ||||
-rw-r--r-- | yage/physics/collider.h (renamed from include/YAGE/Physics/collider.h) | 0 | ||||
-rw-r--r-- | yage/physics/collisionbody.h (renamed from include/YAGE/Physics/collisionbody.h) | 0 | ||||
-rw-r--r-- | yage/physics/particlebody.cpp (renamed from src/particlebody.cpp) | 0 | ||||
-rw-r--r-- | yage/physics/particlebody.h (renamed from include/YAGE/Physics/particlebody.h) | 0 | ||||
-rw-r--r-- | yage/physics/physics.h (renamed from include/YAGE/Physics/physics.h) | 0 | ||||
-rw-r--r-- | yage/physics/rectanglecollider.cpp (renamed from src/rectanglecollider.cpp) | 0 | ||||
-rw-r--r-- | yage/physics/rectanglecollider.h (renamed from include/YAGE/Physics/rectanglecollider.h) | 0 | ||||
-rw-r--r-- | yage/physics/rigidbody.cpp (renamed from src/rigidbody.cpp) | 0 | ||||
-rw-r--r-- | yage/physics/rigidbody.h (renamed from include/YAGE/Physics/rigidbody.h) | 0 | ||||
-rw-r--r-- | yage/yage.h (renamed from include/YAGE/yage.h) | 0 |
45 files changed, 81 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 05359e78..7897ad1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,81 +1,46 @@ -# ---------------------------------------------------------------------------- -# CMakeLists.txt -# -# Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License -# See file LICENSE for more details -# ---------------------------------------------------------------------------- - cmake_minimum_required(VERSION 3.0) # yage library cmakelists.txt -project(yage) - -# set version numbers -set(YAGE_MAJOR_VERSION 0) -set(YAGE_MINOR_VERSION 1) -set(YAGE_PATCH_VERSION 1) -set(YAGE_VERSION - "v${YAGE_MAJOR_VERSION}.${YAGE_MINOR_VERSION}.${YAGE_PATCH_VERSION}") +project(YetAnotherGameEngine) # set standard set(CMAKE_CXX_STANDARD 14) # set the test sources -set(YAGE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src") -set(YAGE_TEST_DIR "${PROJECT_SOURCE_DIR}/test") +set(YAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src) +set(YAGE_TEST_DIR ${PROJECT_SOURCE_DIR}/test) set(YAGE_LIBRARIES ${PROJECT_NAME}) -# add include directory -set(YAGE_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include") - # set binary directory -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin") - -# add sources to library -set(YAGE_SOURCES - "${PROJECT_SOURCE_DIR}/src/body.cpp" - "${PROJECT_SOURCE_DIR}/src/camera2d.cpp" - "${PROJECT_SOURCE_DIR}/src/glslprogram.cpp" - "${PROJECT_SOURCE_DIR}/src/imageloader.cpp" - "${PROJECT_SOURCE_DIR}/src/inputmanager.cpp" - "${PROJECT_SOURCE_DIR}/src/iomanager.cpp" - "${PROJECT_SOURCE_DIR}/src/particlebody.cpp" - "${PROJECT_SOURCE_DIR}/src/picopng.cpp" - "${PROJECT_SOURCE_DIR}/src/rectanglecollider.cpp" - "${PROJECT_SOURCE_DIR}/src/resourcemanager.cpp" - "${PROJECT_SOURCE_DIR}/src/rigidbody.cpp" - "${PROJECT_SOURCE_DIR}/src/spritebatch.cpp" - "${PROJECT_SOURCE_DIR}/src/sprite.cpp" - "${PROJECT_SOURCE_DIR}/src/texturecache.cpp" - "${PROJECT_SOURCE_DIR}/src/window.cpp") - -add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) # find libraries find_package(OpenGL REQUIRED) find_package(GLEW REQUIRED) + +# todo: change this to find_package include(FindPkgConfig) pkg_search_module(SDL2 REQUIRED sdl2) -# set include directory -include_directories(${YAGE_INCLUDE_DIR}) - -# make it a static library -add_library(${PROJECT_NAME} ${YAGE_SOURCES}) - -set(YAGE_LIB_DEP_L "yage;${OPENGL_LIBRARIES};${GLEW_LIBRARIES};${SDL2_LIBRARIES}") - -# enable tests -enable_testing() -set(SIMULATION_RUNS 1000) - -function(make_test test_name cycles) - add_executable(${test_name} "${YAGE_TEST_DIR}/${test_name}.cpp") - target_link_libraries(${test_name} gtest_main ${YAGE_LIB_DEP_L}) - add_test(NAME ${test_name} COMMAND ${test_name} --gtest_repeat=${cycles} --gtest_break_on_failure) -endfunction(make_test) - -make_test(yagetest ${SIMULATION_RUNS}) -make_test(matrixtest ${SIMULATION_RUNS}) -make_test(particlebodytest ${SIMULATION_RUNS}) -make_test(windowtest ${SIMULATION_RUNS}) +# adding libraries +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/yage) + +if(ENABLE_TESTING) + # enable tests + enable_testing() + set(SIMULATION_RUNS 1000) + + function(make_test test_name cycles) + add_executable(${test_name} ${YAGE_TEST_DIR}/${test_name}.cpp) + target_link_libraries(${test_name} + gtest_main + yage) + add_test(NAME ${test_name} COMMAND ${test_name} --gtest_repeat=${cycles} --gtest_break_on_failure) + endfunction(make_test) + + make_test(yagetest ${SIMULATION_RUNS}) + make_test(matrixtest ${SIMULATION_RUNS}) + make_test(particlebodytest ${SIMULATION_RUNS}) + make_test(windowtest ${SIMULATION_RUNS}) +endif(ENABLE_TESTING) diff --git a/yage/CMakeLists.txt b/yage/CMakeLists.txt new file mode 100644 index 00000000..d45ffa90 --- /dev/null +++ b/yage/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_policy(SET CMP0048 NEW) + +project(yage + VERSION 0.1.1.0 + LANGUAGES CXX + ) + +include(base/CMakeLists.txt) +include(physics/CMakeLists.txt) +include(math/CMakeLists.txt) + +set(YAGE_SOURCES + ${YAGE_BASE_SOURCES} + ${YAGE_PHYSICS_SOURCES} + ${YAGE_MATH_SOURCES} + ) + +set(${PROJECT_NAME}_DIR + ${PROJECT_SOURCE_DIR}) + +add_library(${PROJECT_NAME} + ${YAGE_SOURCES} + ) + +target_include_directories(${PROJECT_NAME} + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ) + +target_link_libraries(${PROJECT_NAME} + ${OPENGL_LIBRARIES} + ${GLEW_LIBRARIES} + ${SDL2_LIBRARIES} + ) diff --git a/yage/base/CMakeLists.txt b/yage/base/CMakeLists.txt new file mode 100644 index 00000000..acdb78bf --- /dev/null +++ b/yage/base/CMakeLists.txt @@ -0,0 +1,13 @@ +set(YAGE_BASE_SOURCES + base/imageloader.cpp + base/window.cpp + base/texturecache.cpp + base/glslprogram.cpp + base/spritebatch.cpp + base/resourcemanager.cpp + base/sprite.cpp + base/inputmanager.cpp + base/picopng.cpp + base/camera2d.cpp + base/iomanager.cpp + ) diff --git a/src/camera2d.cpp b/yage/base/camera2d.cpp index 292f998a..292f998a 100644 --- a/src/camera2d.cpp +++ b/yage/base/camera2d.cpp diff --git a/include/YAGE/camera2d.h b/yage/base/camera2d.h index a60893ac..a60893ac 100644 --- a/include/YAGE/camera2d.h +++ b/yage/base/camera2d.h diff --git a/src/glslprogram.cpp b/yage/base/glslprogram.cpp index 11a3191e..11a3191e 100644 --- a/src/glslprogram.cpp +++ b/yage/base/glslprogram.cpp diff --git a/include/YAGE/glslprogram.h b/yage/base/glslprogram.h index fbe5ac5c..fbe5ac5c 100644 --- a/include/YAGE/glslprogram.h +++ b/yage/base/glslprogram.h diff --git a/src/imageloader.cpp b/yage/base/imageloader.cpp index 812110d8..812110d8 100644 --- a/src/imageloader.cpp +++ b/yage/base/imageloader.cpp diff --git a/include/YAGE/imageloader.h b/yage/base/imageloader.h index 8d5c5cd1..8d5c5cd1 100644 --- a/include/YAGE/imageloader.h +++ b/yage/base/imageloader.h diff --git a/src/inputmanager.cpp b/yage/base/inputmanager.cpp index d429abd7..d429abd7 100644 --- a/src/inputmanager.cpp +++ b/yage/base/inputmanager.cpp diff --git a/include/YAGE/inputmanager.h b/yage/base/inputmanager.h index 84728fff..84728fff 100644 --- a/include/YAGE/inputmanager.h +++ b/yage/base/inputmanager.h diff --git a/src/iomanager.cpp b/yage/base/iomanager.cpp index 93ab41c9..93ab41c9 100644 --- a/src/iomanager.cpp +++ b/yage/base/iomanager.cpp diff --git a/include/YAGE/iomanager.h b/yage/base/iomanager.h index 95abd652..95abd652 100644 --- a/include/YAGE/iomanager.h +++ b/yage/base/iomanager.h diff --git a/src/picopng.cpp b/yage/base/picopng.cpp index dcc4b367..dcc4b367 100644 --- a/src/picopng.cpp +++ b/yage/base/picopng.cpp diff --git a/include/YAGE/picopng.h b/yage/base/picopng.h index 095bf68a..095bf68a 100644 --- a/include/YAGE/picopng.h +++ b/yage/base/picopng.h diff --git a/src/resourcemanager.cpp b/yage/base/resourcemanager.cpp index 473ea37e..473ea37e 100644 --- a/src/resourcemanager.cpp +++ b/yage/base/resourcemanager.cpp diff --git a/include/YAGE/resourcemanager.h b/yage/base/resourcemanager.h index 3c5081c4..3c5081c4 100644 --- a/include/YAGE/resourcemanager.h +++ b/yage/base/resourcemanager.h diff --git a/src/sprite.cpp b/yage/base/sprite.cpp index 68e08e5d..68e08e5d 100644 --- a/src/sprite.cpp +++ b/yage/base/sprite.cpp diff --git a/include/YAGE/sprite.h b/yage/base/sprite.h index 5b9baf91..5b9baf91 100644 --- a/include/YAGE/sprite.h +++ b/yage/base/sprite.h diff --git a/src/spritebatch.cpp b/yage/base/spritebatch.cpp index ac98130b..ac98130b 100644 --- a/src/spritebatch.cpp +++ b/yage/base/spritebatch.cpp diff --git a/include/YAGE/spritebatch.h b/yage/base/spritebatch.h index 7235bd25..7235bd25 100644 --- a/include/YAGE/spritebatch.h +++ b/yage/base/spritebatch.h diff --git a/include/YAGE/spritesheet.h b/yage/base/spritesheet.h index 2b70ad8b..2b70ad8b 100644 --- a/include/YAGE/spritesheet.h +++ b/yage/base/spritesheet.h diff --git a/include/YAGE/texture.h b/yage/base/texture.h index d1fdcbf2..d1fdcbf2 100644 --- a/include/YAGE/texture.h +++ b/yage/base/texture.h diff --git a/src/texturecache.cpp b/yage/base/texturecache.cpp index fda5fcd9..fda5fcd9 100644 --- a/src/texturecache.cpp +++ b/yage/base/texturecache.cpp diff --git a/include/YAGE/texturecache.h b/yage/base/texturecache.h index 414c9ec3..414c9ec3 100644 --- a/include/YAGE/texturecache.h +++ b/yage/base/texturecache.h diff --git a/include/YAGE/vertex.h b/yage/base/vertex.h index 15b46ed9..15b46ed9 100644 --- a/include/YAGE/vertex.h +++ b/yage/base/vertex.h diff --git a/src/window.cpp b/yage/base/window.cpp index 143b1d5d..143b1d5d 100644 --- a/src/window.cpp +++ b/yage/base/window.cpp diff --git a/include/YAGE/window.h b/yage/base/window.h index 8639e075..8639e075 100644 --- a/include/YAGE/window.h +++ b/yage/base/window.h diff --git a/yage/math/CMakeLists.txt b/yage/math/CMakeLists.txt new file mode 100644 index 00000000..761ab59f --- /dev/null +++ b/yage/math/CMakeLists.txt @@ -0,0 +1 @@ +set(YAGE_MATH_SOURCES) diff --git a/include/YAGE/Math/math.h b/yage/math/math.h index b729dbe6..b729dbe6 100644 --- a/include/YAGE/Math/math.h +++ b/yage/math/math.h diff --git a/include/YAGE/Math/matrix.h b/yage/math/matrix.h index 3992acfe..3992acfe 100644 --- a/include/YAGE/Math/matrix.h +++ b/yage/math/matrix.h diff --git a/yage/physics/CMakeLists.txt b/yage/physics/CMakeLists.txt new file mode 100644 index 00000000..46c97596 --- /dev/null +++ b/yage/physics/CMakeLists.txt @@ -0,0 +1,6 @@ +set(YAGE_PHYSICS_SOURCES + physics/rectanglecollider.cpp + physics/rigidbody.cpp + physics/particlebody.cpp + physics/body.cpp + ) diff --git a/include/YAGE/Physics/README.org b/yage/physics/README.org index 0620cc93..0620cc93 100644 --- a/include/YAGE/Physics/README.org +++ b/yage/physics/README.org diff --git a/src/body.cpp b/yage/physics/body.cpp index 8d38e70a..8d38e70a 100644 --- a/src/body.cpp +++ b/yage/physics/body.cpp diff --git a/include/YAGE/Physics/body.h b/yage/physics/body.h index bd33a9ac..bd33a9ac 100644 --- a/include/YAGE/Physics/body.h +++ b/yage/physics/body.h diff --git a/include/YAGE/Physics/collider.h b/yage/physics/collider.h index 2fd2ff89..2fd2ff89 100644 --- a/include/YAGE/Physics/collider.h +++ b/yage/physics/collider.h diff --git a/include/YAGE/Physics/collisionbody.h b/yage/physics/collisionbody.h index 715c4a54..715c4a54 100644 --- a/include/YAGE/Physics/collisionbody.h +++ b/yage/physics/collisionbody.h diff --git a/src/particlebody.cpp b/yage/physics/particlebody.cpp index bdb81eac..bdb81eac 100644 --- a/src/particlebody.cpp +++ b/yage/physics/particlebody.cpp diff --git a/include/YAGE/Physics/particlebody.h b/yage/physics/particlebody.h index a0b9bdad..a0b9bdad 100644 --- a/include/YAGE/Physics/particlebody.h +++ b/yage/physics/particlebody.h diff --git a/include/YAGE/Physics/physics.h b/yage/physics/physics.h index 900f4b6a..900f4b6a 100644 --- a/include/YAGE/Physics/physics.h +++ b/yage/physics/physics.h diff --git a/src/rectanglecollider.cpp b/yage/physics/rectanglecollider.cpp index 64887278..64887278 100644 --- a/src/rectanglecollider.cpp +++ b/yage/physics/rectanglecollider.cpp diff --git a/include/YAGE/Physics/rectanglecollider.h b/yage/physics/rectanglecollider.h index c009f665..c009f665 100644 --- a/include/YAGE/Physics/rectanglecollider.h +++ b/yage/physics/rectanglecollider.h diff --git a/src/rigidbody.cpp b/yage/physics/rigidbody.cpp index dcab5f2f..dcab5f2f 100644 --- a/src/rigidbody.cpp +++ b/yage/physics/rigidbody.cpp diff --git a/include/YAGE/Physics/rigidbody.h b/yage/physics/rigidbody.h index 67ccb4ca..67ccb4ca 100644 --- a/include/YAGE/Physics/rigidbody.h +++ b/yage/physics/rigidbody.h diff --git a/include/YAGE/yage.h b/yage/yage.h index 6157e6bf..6157e6bf 100644 --- a/include/YAGE/yage.h +++ b/yage/yage.h |