[FEAT] Update CMake project.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
build
|
build
|
||||||
|
.PVS-Studio/State/ReportState.json
|
||||||
|
|||||||
18
.vscode/c_cpp_properties.json
vendored
18
.vscode/c_cpp_properties.json
vendored
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Linux",
|
|
||||||
"includePath": [
|
|
||||||
"${workspaceFolder}/**"
|
|
||||||
],
|
|
||||||
"defines": [],
|
|
||||||
"compilerPath": "/usr/bin/gcc",
|
|
||||||
"cStandard": "gnu17",
|
|
||||||
"cppStandard": "gnu++14",
|
|
||||||
"intelliSenseMode": "linux-gcc-x64",
|
|
||||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
|
||||||
"configurationProvider": "ms-vscode.cmake-tools"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 4
|
|
||||||
}
|
|
||||||
27
.vscode/launch.json
vendored
27
.vscode/launch.json
vendored
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "(gdb) Lancer",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/build/raytracing_tests",
|
|
||||||
"args": [],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"environment": [],
|
|
||||||
"console": "externalTerminal",
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"setupCommands": [
|
|
||||||
{
|
|
||||||
"description": "Activer l'impression en mode Pretty pour gdb",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"cmake.sourceDirectory": "/home/jbnadal/sources/jb/raytracing_challenge",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Raytracer"
|
"Raytracer"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,19 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
project(raytracing_challenge)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
project(raytracing_challenge
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
VERSION 0.1
|
||||||
|
DESCRIPTION "Raytracing Challenge in c++"
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
|
||||||
include_directories("${CMAKE_SOURCE_DIR}/src")
|
|
||||||
|
|
||||||
add_executable(
|
|
||||||
raytracing_tests
|
|
||||||
|
|
||||||
src/tuple.cpp
|
|
||||||
|
|
||||||
tests/main.cpp
|
|
||||||
tests/chapitre01_tuples.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(raytracing)
|
||||||
|
add_subdirectory(apps)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
|||||||
11
apps/CMakeLists.txt
Normal file
11
apps/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
project(main)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
add_executable(raytracer main.cpp)
|
||||||
|
# We need hello.h and the hello library
|
||||||
|
target_link_libraries(raytracer
|
||||||
|
PRIVATE raytracing)
|
||||||
40
apps/main.cpp
Normal file
40
apps/main.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*!
|
||||||
|
* main.cpp
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024, NADAL Jean-Baptiste. All rights reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @Author: NADAL Jean-Baptiste
|
||||||
|
* @Date: 30/01/2024
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
|
||||||
|
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
|
||||||
|
|
||||||
|
|
||||||
|
#include <raytracing.h>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
printf("Later Here we will have main function\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
15
raytracing/CMakeLists.txt
Normal file
15
raytracing/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
project(raytracing)
|
||||||
|
|
||||||
|
add_library(raytracing
|
||||||
|
src/tuple.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME}
|
||||||
|
PUBLIC ${PROJECT_SOURCE_DIR}/include
|
||||||
|
PUBLIC ${PROJECT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
28
raytracing/include/raytracing.h
Normal file
28
raytracing/include/raytracing.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*!
|
||||||
|
* raytracing.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024, NADAL Jean-Baptiste. All rights reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @Author: NADAL Jean-Baptiste
|
||||||
|
* @Date: 29/01/2024
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "tuple.h"
|
||||||
@@ -137,14 +137,14 @@ float Tuple::w(void) const
|
|||||||
|
|
||||||
bool Tuple::is_point(void)
|
bool Tuple::is_point(void)
|
||||||
{
|
{
|
||||||
return (m_w == kRaytracerTuplePoint) ? true : false;
|
return float_equal(m_w, kRaytracerTuplePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bool Tuple::is_vector(void)
|
bool Tuple::is_vector(void)
|
||||||
{
|
{
|
||||||
return (m_w == kRaytracerTupleVector) ? true : false;
|
return float_equal(m_w, kRaytracerTupleVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
21
tests/CMakeLists.txt
Normal file
21
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
project(main_test)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
add_executable(main_test
|
||||||
|
main_test.cpp
|
||||||
|
|
||||||
|
chapitre01_tuples.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
||||||
|
|
||||||
|
target_link_libraries(main_test
|
||||||
|
PRIVATE raytracing)
|
||||||
Reference in New Issue
Block a user