Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Atraxus committed May 4, 2023
2 parents 4e04072 + 541a0af commit a39556f
Show file tree
Hide file tree
Showing 257 changed files with 3,240 additions and 2,923 deletions.
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@
bin/
bin-int/
build/
Intern/RayCore/doc/*/
Intern/RAY-Core/doc/*/
Intern/RAY-Core/tests/output/**
out/

# Files
*.user
*.code-workspace
/CMakeSettings.json
/Tests/output/*
/Tests/output-new/*
/Tests/oldray_files/unittestData
/Tests/oldray_files/spec1-first_rzp02/data
/Tests/oldray_files/spec1-first_rzp4mm/data
/Tests/oldray_files/spec1+first_rzp4mm/data
/Tests/.ipynb_checkpoints/*
CMakeCache.txt
cmake.check_cache
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)


# ---- Project ----
project(RAYX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# -----------------


# ---- Subdirectories ----
add_subdirectory(Intern)
add_subdirectory(Extern)
add_subdirectory(Tests)
# ------------------------


# ---- Options ----
option(WERROR "add -Werror option" "NO") # inactive per default
option(VULKAN "include the VulkanTracer" "YES") # activated per default
option(H5 "include the H5Writer" "YES") # active per default
# ------------------


# -------CodeCoverage-------
# ---- Code Coverage ----
option(BUILD_WITH_GCOV "Add Code Coverage to build" FALSE)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Extern/cmake)
#set(BUILD_WITH_GCOV TRUE)
Expand All @@ -29,4 +38,4 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug" AND BUILD_WITH
# setup_target_for_coverage_gcovr_html(NAME ${PROJECT_NAME}_coverage_gcovr_html
# EXECUTABLE ${CMAKE_PROJECT_NAME}_tst)
endif()
# ---------------------------
# -----------------------
3 changes: 1 addition & 2 deletions Extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)

add_subdirectory(googletest)

# CLI
# cli11
# CLI11
set(CLI11_SANITIZERS OFF)
set(CLI11_BUILD_DOCS OFF)
set(CLI11_BUILD_TESTS OFF)
Expand Down
43 changes: 10 additions & 33 deletions Intern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

# ---- Project ----
project(Intern)
cmake_policy(SET CMP0054 NEW)
# -----------------

# Enable all warnings
if(MSVC)
message(STATUS "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
message(STATUS "GCC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") # -Wconversion -Wsign-conversion")
endif()

if(WERROR STREQUAL "YES")
if(MSVC)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Werror") # -O3 finds more errors!
endif()

message(STATUS "Werror mode")
endif()

if(VULKAN STREQUAL "NO")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D NO_VULKAN")
message(STATUS "Vulkan disabled")
endif()

if(H5 STREQUAL "NO")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D NO_H5")
message(STATUS "H5 disabled")
endif()

# Release repo
# ---- Build options ----
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/release)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib/release)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib/release)

# Debug repo
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/debug)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/lib/debug)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/lib/debug)
# -----------------------


add_subdirectory(RayCore)
add_subdirectory(TerminalApp)
# ---- Subdirectories ----
add_subdirectory(RAY-Core)
add_subdirectory(RAY-CLI)
add_subdirectory(RAY-X)
# ------------------------
39 changes: 39 additions & 0 deletions Intern/RAY-CLI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)


# ---- Project ----
project(RAY-CLI VERSION 0.5.0.0)
file(GLOB_RECURSE SOURCE ${PROJECT_SOURCE_DIR}/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCE})
# ------------------


# ---- Git Info ----
set(_build_version "unknown")
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _build_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "GIT hash: ${_build_version}")
else()
message(STATUS "GIT not found")
endif()
string(TIMESTAMP _time_stamp)
# Config file for the project (e.g. git hash can be referenced in the code)
configure_file(TerminalAppConfig.h.in TerminalAppConfig.h)
# ------------------


# ---- Dependencies ----
target_link_libraries(${PROJECT_NAME} PRIVATE
CLI11::CLI11
RAY-Core
${PYTHON_LIBRARIES}
)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_BINARY_DIR})
# ----------------------
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <filesystem>

#include "CommandParser.h"
#include "RayCore.h"
#include "RAY-Core.h"
#include "TerminalAppConfig.h"

class TerminalApp {
Expand Down
File renamed without changes.
File renamed without changes.
116 changes: 116 additions & 0 deletions Intern/RAY-Core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

# ---- Add tests ----
add_subdirectory(tests)
# -------------------


# ---- Project ----
project(RAY-Core)
file(GLOB_RECURSE SOURCE ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_library(${PROJECT_NAME} SHARED ${SOURCE})
# -----------------


# ---- Warnings ----
if(MSVC)
message(STATUS "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /W2 /wd4251) # /WX)
else()
message(STATUS "GCC")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic) #-Werror)

# Enable werror if requested (mostly used for CI)
if(WERROR STREQUAL "YES")
target_compile_options(${PROJECT_NAME} PRIVATE -O3 -Werror)
message(STATUS "Werror mode")
endif()
endif()
# ------------------


# ---- Disable Vulkan/H5 ----
if(VULKAN STREQUAL "NO")
target_compile_definitions(${PROJECT_NAME} PUBLIC NO_VULKAN)
message(STATUS "Vulkan disabled")
else()
find_package(Vulkan 1.3.216 REQUIRED)
target_link_libraries(${PROJECT_NAME}
PUBLIC Vulkan::Vulkan
)
endif()
if(H5 STREQUAL "NO")
target_compile_definitions(${PROJECT_NAME} PUBLIC NO_H5)
message(STATUS "H5 disabled")
else()
if(UNIX)
target_include_directories(${PROJECT_NAME} PUBLIC /usr/include/hdf5/serial)
target_link_directories(${PROJECT_NAME} PUBLIC /usr/lib/x86_64-linux-gnu/hdf5/serial)
target_link_libraries(${PROJECT_NAME} PUBLIC hdf5)
else()
find_package(HDF5 REQUIRED)
target_link_libraries(${PROJECT_NAME}
PUBLIC HDF5::HDF5
)
endif()
endif()
# -------------------------


# ---- PCH ----
target_precompile_headers(${PROJECT_NAME} PUBLIC raycorePCH.h)
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
# -------------


# ---- Defines ----
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(COMPILE_PLATFORM RAYX_PLATFORM_GCC)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILE_PLATFORM RAYX_PLATFORM_MSVC)
else()
set(COMPILE_PLATFORM UNKNOWN)
endif()

target_compile_definitions(${PROJECT_NAME}
PRIVATE RAYX_BUILD_DLL
PUBLIC ${COMPILE_PLATFORM}
PROJECT_DIR="${CMAKE_SOURCE_DIR}"
$<$<CONFIG:Debug>:RAYX_DEBUG_MODE>
$<$<CONFIG:RelWithDebInfo>:RAYX_DEBUG_MODE>
)
# -----------------


# ---- Dependencies ----
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src)
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/src)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
${PROJECT_SOURCE_DIR}/../../Extern/glm/glm/
${PROJECT_SOURCE_DIR}/../../Extern/rapidxml-1.13/
${PROJECT_SOURCE_DIR}/../../Extern/HighFive/include/
${PROJECT_SOURCE_DIR}/../../Extern/VMA/include/
)
# ----------------------


# ---- Compile Shaders ----
if(NOT VULKAN STREQUAL "NO")
# The following code is used to always compile the shader.
# This is most likely not an optimal solution, but it will work
# until we find a better one.
add_dependencies(${PROJECT_NAME} COMPILE_SHADER)
set(COMPILED_SHADER ${CMAKE_BINARY_DIR}/bin/comp.spv)
set(COMPILED_SHADER_FAKE ${CMAKE_BINARY_DIR}/bin/___comp.spv) # this exists so file cannot be found -> always execute command

add_custom_command(
OUTPUT
${COMPILED_SHADER}
${COMPILED_SHADER_FAKE}
COMMAND "glslc"
ARGS ${PROJECT_SOURCE_DIR}/src/Tracer/shader/main-glsl.comp -o ${COMPILED_SHADER} -fshader-stage=compute
)

add_custom_target(COMPILE_SHADER ALL DEPENDS ${COMPILED_SHADER})
endif()
# ------------------------
3 changes: 3 additions & 0 deletions Intern/RAY-Core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RAY-Core documentation

RAY-Core is the core library of the RAY-X project.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <array>

#include "Debug/Instrumentor.h"
#include "Beamline/Objects/Objects.h"
#include "Debug/Instrumentor.h"

namespace RAYX {
Beamline::Beamline() = default;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ OpticalElement::OpticalElement(const DesignObject& dobj) {

m_position = dobj.parsePosition();
m_orientation = dobj.parseOrientation();

// TODO remove later! 42 means uninitialized.
m_behaviour.m_type = 42;
}

Element OpticalElement::intoElement() const {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include <sstream>
#include <utility>

#include "Beamline/Beamline.h"
#include "Beamline/Objects/Objects.h"
#include "Data/xml.h"
#include "Debug/Debug.h"
#include "Debug/Instrumentor.h"
#include "Beamline/Beamline.h"
#include "Beamline/Objects/Objects.h"

namespace RAYX {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <filesystem>

#include "Core.h"
#include "Beamline/Beamline.h"
#include "Core.h"
namespace RAYX {

RAYX_API Beamline importBeamline(const std::filesystem::path&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <iostream>
#include <utility>

#include "Debug/Debug.h"
#include "Beamline/EnergyDistribution.h"
#include "Beamline/LightSource.h"
#include "Debug/Debug.h"
#include "Shared/Constants.h"
#include "utils.h"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a39556f

Please sign in to comment.