added files

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-07 17:32:34 +02:00
commit 14c8b3f26b
12 changed files with 119 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*build*/

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

1
.idea/.name generated Normal file
View File

@ -0,0 +1 @@
block

2
.idea/Block.iml generated Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

7
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" />
</component>
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Block.iml" filepath="$PROJECT_DIR$/.idea/Block.iml" />
</modules>
</component>
</project>

34
CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.15..3.30)
project(block
VERSION 0.1
LANGUAGES CXX)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_property(GLOBAL PROPERTY USE_FOLDERDS ON)
find_package(Doxygen)
if(Doxygen_FOUND)
#add_subdirectory(docs)
else()
message(STATUS "Doxygen not found, not building docs")
endif()
add_subdirectory(apps/)
endif()
include(FetchContent)
# Formatting library, adds fmt::fmt Always use the full git hash, not the tag,
# safer and faster to recompile
FetchContent_Declare(
vector
GIT_REPOSITORY https://concreteserver.ddns.net/gitea/CarboHydra/Vector.git
GIT_TAG main)
FetchContent_MakeAvailable(vector)
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
#add_executable(vector main.cpp)
#install(TARGETS vector RUNTIME DESTINATION bin)

3
apps/CMakeLists.txt Normal file
View File

@ -0,0 +1,3 @@
add_executable(app main.cpp)
target_link_libraries(app PRIVATE vector)

25
apps/main.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <iostream>
#include "Vector/vector3.h"
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
Vector::Vector3 vec(1,2,3);
Vector::Vector3 vec2(2,1,3);
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec*=2;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec/=2;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
std::cout<<vec.dot(vec)<<std::endl;
std::cout<<vec.cross(vec2)<<std::endl;
vec.norm();
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec-=vec;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
return 0;
}

14
include/Block/block.h Normal file
View File

@ -0,0 +1,14 @@
//
// Created by nb on 07.07.24.
//
#ifndef BLOCK_BLOCK_H
#define BLOCK_BLOCK_H
namespace Volumes{
class block{
};
}
#endif //BLOCK_BLOCK_H

12
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
file(GLOB HEADER_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/include/Block/*.hpp")
add_library(block block.cpp ${HEADER_LIST})
target_link_libraries(block PRIVATE vector)
target_include_directories(block PUBLIC "${PROJECT_SOURCE_DIR}/include")
source_group(
TREE "${PROJECT_SOURCE_DIR}/include"
PREFIX "Header files"
FILES ${HEADER_LIST})

4
src/block.cpp Normal file
View File

@ -0,0 +1,4 @@
//
// Created by nb on 07.07.24.
//
#include "Block/block.h"