Migrating to CMake, WIP
This commit is contained in:
26
CMakeLists.txt
Normal file
26
CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
project (Kraken)
|
||||
|
||||
macro (add_sources)
|
||||
file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
foreach (_src ${ARGN})
|
||||
if (_relPath)
|
||||
list (APPEND SRCS "${_relPath}/${_src}")
|
||||
else()
|
||||
list (APPEND SRCS "${_src}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (_relPath)
|
||||
# propagate SRCS to parent directory
|
||||
set (SRCS ${SRCS} PARENT_SCOPE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
add_subdirectory(kraken)
|
||||
|
||||
add_library(kraken ${SRCS})
|
||||
9
kraken/CMakeLists.txt
Normal file
9
kraken/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
include_directories(public)
|
||||
add_sources(vector2.cpp)
|
||||
add_sources(vector3.cpp)
|
||||
add_sources(vector4.cpp)
|
||||
add_sources(triangle3.cpp)
|
||||
add_sources(quaternion.cpp)
|
||||
add_sources(matrix4.cpp)
|
||||
add_sources(aabb.cpp)
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <GL/glew.h>
|
||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||
#elif defined(__linux__) || defined(__unix__) || defined(__posix__)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#include "KREngine-common.h"
|
||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||
|
||||
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
#define KRMAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
@@ -26,4 +28,4 @@ namespace kraken {
|
||||
const Vector3 getXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &default_value);
|
||||
} // namespace kraken
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "assert.h"
|
||||
#include "KRHelpers.h"
|
||||
|
||||
namespace kraken {
|
||||
|
||||
AABB::AABB()
|
||||
{
|
||||
min = Vector3::Min();
|
||||
@@ -332,3 +334,6 @@ Vector3 AABB::nearestPoint(const Vector3 & v) const
|
||||
{
|
||||
return Vector3(KRCLAMP(v.x, min.x, max.x), KRCLAMP(v.y, min.y, max.y), KRCLAMP(v.z, min.z, max.z));
|
||||
}
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
#include "KREngine-common.h"
|
||||
#include "public/kraken.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "public/Matrix4.h"
|
||||
namespace kraken {
|
||||
|
||||
Matrix4::Matrix4() {
|
||||
// Default constructor - Initialize with an identity matrix
|
||||
@@ -443,3 +444,5 @@ Matrix4 Matrix4::Scaling(const Vector3 &v)
|
||||
return m;
|
||||
}
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
#include <functional> // for hash<>
|
||||
|
||||
#include "Vector2.h"
|
||||
#include "Vector3.h"
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
|
||||
namespace kraken {
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#define KRAKEN_VECTOR2_H
|
||||
|
||||
#include <functional> // for hash<>
|
||||
#include <limits> // for std::numeric_limits<>
|
||||
#include <math.h> // for sqrtf
|
||||
|
||||
namespace kraken {
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
#include "KREngine-common.h"
|
||||
#include "public/kraken.h"
|
||||
|
||||
namespace kraken {
|
||||
|
||||
const Vector3 Vector3_ZERO(0.0f, 0.0f, 0.0f);
|
||||
|
||||
//default constructor
|
||||
@@ -412,3 +413,6 @@ bool Vector3::operator <(const Vector3& b) const
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
|
||||
Reference in New Issue
Block a user