Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ out/
# Precompiled Headers
*.gch
*.pch
pch/pch.cpp

# Compiled Dynamic libraries
*.so
Expand Down
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,31 @@ endif ()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

file(GENERATE OUTPUT ${ark_SOURCE_DIR}/pch/pch.cpp CONTENT "")
add_library(PCH OBJECT ${ark_SOURCE_DIR}/pch/pch.cpp)
target_precompile_headers(PCH PRIVATE ${ark_SOURCE_DIR}/pch/pch.hpp)
target_include_directories(PCH PRIVATE ${ark_SOURCE_DIR}/pch)
target_compile_features(PCH PRIVATE cxx_std_20)
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR APPLE)
target_compile_options(PCH PRIVATE -fvisibility=hidden -fno-semantic-interposition -Wno-gnu-label-as-value)
endif()

# files needed for the library ArkReactor
file(GLOB_RECURSE SOURCE_FILES
${ark_SOURCE_DIR}/src/arkreactor/*.cpp
${ark_SOURCE_DIR}/lib/fmt/src/format.cc)

add_library(ArkReactor SHARED ${SOURCE_FILES})
enable_lto(ArkReactor)
target_precompile_headers(ArkReactor REUSE_FROM PCH)
target_include_directories(ArkReactor
PUBLIC
${ark_SOURCE_DIR}/include)
target_compile_features(ArkReactor PRIVATE cxx_std_20)

if (ARK_UNITY_BUILD)
set_target_properties(ArkReactor PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE BATCH UNITY_BUILD_BATCH_SIZE 16)
set_source_files_properties(src/arkreactor/VM/VM.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION true)
set_source_files_properties(${ark_SOURCE_DIR}/src/arkreactor/VM/VM.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION true)
endif ()

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR APPLE)
Expand Down Expand Up @@ -192,6 +202,7 @@ if (ARK_TESTS)
${ark_SOURCE_DIR}/src/arkscript/JsonCompiler.cpp
${ark_SOURCE_DIR}/src/arkscript/REPL/Utils.cpp)
add_executable(unittests ${SOURCES})
target_precompile_headers(unittests REUSE_FROM PCH)
target_include_directories(unittests PUBLIC ${ark_SOURCE_DIR}/tests/unittests)

target_include_directories(unittests SYSTEM PUBLIC ${ark_SOURCE_DIR}/lib/dtl/dtl)
Expand Down Expand Up @@ -261,6 +272,7 @@ if (ARK_BUILD_EXE)

add_subdirectory("${ark_SOURCE_DIR}/lib/clipp" EXCLUDE_FROM_ALL)

target_precompile_headers(arkscript REUSE_FROM PCH)
target_include_directories(arkscript SYSTEM PUBLIC "${ark_SOURCE_DIR}/lib/clipp/include")
target_link_libraries(arkscript PUBLIC ArkReactor replxx clipp)
target_compile_features(arkscript PRIVATE cxx_std_20)
Expand Down
2 changes: 0 additions & 2 deletions include/Ark/Builtins/Builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#ifndef ARK_BUILTINS_BUILTINS_HPP
#define ARK_BUILTINS_BUILTINS_HPP

#include <vector>

#include <Ark/VM/Value.hpp>
#include <Ark/Exceptions.hpp>

Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/AST/BaseParser.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef SRC_BASEPARSER_HPP
#define SRC_BASEPARSER_HPP

#include <string>
#include <vector>
#include <initializer_list>

#include <Ark/Platform.hpp>
#include <Ark/Compiler/AST/Predicates.hpp>
#include <Ark/Compiler/AST/utf8_char.hpp>
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/AST/Import.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef ARK_COMPILER_AST_IMPORT_HPP
#define ARK_COMPILER_AST_IMPORT_HPP

#include <vector>
#include <string>
#include <numeric>

#include <Ark/Platform.hpp>

namespace Ark::internal
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/AST/Namespace.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef ARK_COMPILER_AST_NAMESPACE_HPP
#define ARK_COMPILER_AST_NAMESPACE_HPP

#include <string>
#include <vector>
#include <memory>

namespace Ark::internal
{
class Node;
Expand Down
5 changes: 0 additions & 5 deletions include/Ark/Compiler/AST/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#ifndef COMPILER_AST_NODE_HPP
#define COMPILER_AST_NODE_HPP

#include <variant>
#include <ostream>
#include <string>
#include <vector>

#include <Ark/Compiler/AST/Namespace.hpp>
#include <Ark/Compiler/Common.hpp>
#include <Ark/Platform.hpp>
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/AST/Optimizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef COMPILER_AST_OPTIMIZER_HPP
#define COMPILER_AST_OPTIMIZER_HPP

#include <functional>
#include <unordered_map>
#include <string>

#include <Ark/Platform.hpp>
#include <Ark/Compiler/Pass.hpp>
#include <Ark/Compiler/AST/Node.hpp>
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/AST/Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#include <Ark/Utils.hpp>
#include <Ark/Platform.hpp>

#include <string>
#include <optional>
#include <vector>

#include <utf8.hpp>

namespace Ark::internal
Expand Down
3 changes: 0 additions & 3 deletions include/Ark/Compiler/AST/Predicates.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef SRC_PREDICATES_HPP
#define SRC_PREDICATES_HPP

#include <string>
#include <cctype>

#include <Ark/Compiler/AST/utf8_char.hpp>

namespace Ark::internal
Expand Down
6 changes: 0 additions & 6 deletions include/Ark/Compiler/AST/utf8_char.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef SRC_UTF8_CHAR_HPP
#define SRC_UTF8_CHAR_HPP

#include <array>
#include <string>
#include <limits>

#undef max

namespace Ark::internal
{
class utf8_char_t
Expand Down
5 changes: 0 additions & 5 deletions include/Ark/Compiler/BytecodeReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#ifndef ARK_COMPILER_BYTECODEREADER_HPP
#define ARK_COMPILER_BYTECODEREADER_HPP

#include <vector>
#include <string>
#include <cinttypes>
#include <optional>

#include <Ark/Platform.hpp>
#include <Ark/Compiler/Common.hpp>
#include <Ark/VM/Value.hpp>
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef ARK_COMPILER_COMMON_HPP
#define ARK_COMPILER_COMMON_HPP

#include <array>
#include <string_view>
#include <vector>
#include <cinttypes>
#include <Ark/Constants.hpp>

namespace Ark
Expand Down
2 changes: 0 additions & 2 deletions include/Ark/Compiler/Instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#ifndef ARK_COMPILER_INSTRUCTIONS_HPP
#define ARK_COMPILER_INSTRUCTIONS_HPP

#include <array>

namespace Ark::internal
{
/**
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/IntermediateRepresentation/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef ARK_COMPILER_INTERMEDIATEREPRESENTATION_ENTITY_HPP
#define ARK_COMPILER_INTERMEDIATEREPRESENTATION_ENTITY_HPP

#include <cinttypes>
#include <vector>
#include <string>

#include <Ark/Compiler/IntermediateRepresentation/Word.hpp>
#include <Ark/Compiler/Instructions.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#ifndef ARK_COMPILER_INTERMEDIATEREPRESENTATION_IRCOMPILER_HPP
#define ARK_COMPILER_INTERMEDIATEREPRESENTATION_IRCOMPILER_HPP

#include <vector>
#include <string>

#include <Ark/Platform.hpp>
#include <Ark/Logger.hpp>
#include <Ark/Compiler/Common.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include <Ark/Compiler/ValTableElem.hpp>
#include <Ark/Compiler/IntermediateRepresentation/Entity.hpp>

#include <optional>
#include <functional>

namespace Ark::internal
{
class ARK_API IROptimizer final
Expand Down
2 changes: 0 additions & 2 deletions include/Ark/Compiler/IntermediateRepresentation/InstLoc.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef ARK_COMPILER_INTERMEDIATEREPRESENTATION_INSTLOC_HPP
#define ARK_COMPILER_INTERMEDIATEREPRESENTATION_INSTLOC_HPP

#include <cstdint>

namespace Ark::internal
{
// pp (2 bytes), ip (2 bytes), filename id (2 bytes), line (4 bytes) -> 10 bytes per record
Expand Down
5 changes: 0 additions & 5 deletions include/Ark/Compiler/Lowerer/ASTLowerer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
#ifndef ARK_COMPILER_LOWERER_ASTLOWERER_HPP
#define ARK_COMPILER_LOWERER_ASTLOWERER_HPP

#include <vector>
#include <string>
#include <cinttypes>
#include <optional>

#include <Ark/Platform.hpp>
#include <Ark/Logger.hpp>
#include <Ark/Compiler/Instructions.hpp>
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/Lowerer/LocalsLocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef ARK_COMPILER_LOWERER_LOCALSLOCATOR_HPP
#define ARK_COMPILER_LOWERER_LOCALSLOCATOR_HPP

#include <vector>
#include <string>
#include <optional>

namespace Ark::internal
{
class LocalsLocator
Expand Down
3 changes: 0 additions & 3 deletions include/Ark/Compiler/Macros/Executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#ifndef ARK_COMPILER_EXECUTOR_HPP
#define ARK_COMPILER_EXECUTOR_HPP

#include <optional>
#include <unordered_map>

#include <Ark/Compiler/AST/Node.hpp>

namespace Ark::internal
Expand Down
3 changes: 0 additions & 3 deletions include/Ark/Compiler/Macros/MacroScope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

#include <Ark/Compiler/AST/Node.hpp>

#include <unordered_map>
#include <string>

namespace Ark::internal
{
class MacroScope
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/Macros/Processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#include <Ark/Compiler/Macros/MacroScope.hpp>
#include <Ark/Compiler/Pass.hpp>

#include <unordered_map>
#include <optional>
#include <string>

namespace Ark::internal
{
class MacroExecutor;
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/NameResolution/NameResolutionPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef ARK_COMPILER_NAMERESOLUTIONPASS_HPP
#define ARK_COMPILER_NAMERESOLUTIONPASS_HPP

#include <vector>
#include <string>
#include <unordered_set>

#include <Ark/Platform.hpp>
#include <Ark/Compiler/Pass.hpp>
#include <Ark/Compiler/NameResolution/ScopeResolver.hpp>
Expand Down
6 changes: 0 additions & 6 deletions include/Ark/Compiler/NameResolution/ScopeResolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#ifndef ARK_COMPILER_NAMERESOLUTION_SCOPERESOLVER_HPP
#define ARK_COMPILER_NAMERESOLUTION_SCOPERESOLVER_HPP

#include <string>
#include <optional>
#include <memory>
#include <vector>
#include <utility>

#include <Ark/Compiler/NameResolution/StaticScope.hpp>

namespace Ark::internal
Expand Down
7 changes: 0 additions & 7 deletions include/Ark/Compiler/NameResolution/StaticScope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
#ifndef ARK_COMPILER_NAMERESOLUTION_STATICSCOPE_HPP
#define ARK_COMPILER_NAMERESOLUTION_STATICSCOPE_HPP

#include <string>
#include <optional>
#include <memory>
#include <vector>
#include <ranges>
#include <unordered_set>

#include <Ark/Platform.hpp>

namespace Ark::internal
Expand Down
6 changes: 0 additions & 6 deletions include/Ark/Compiler/Package/ImportSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#ifndef ARK_COMPILER_IMPORTSOLVER_HPP
#define ARK_COMPILER_IMPORTSOLVER_HPP

#include <stack>
#include <vector>
#include <string>
#include <filesystem>
#include <unordered_map>

#include <Ark/Platform.hpp>
#include <Ark/Compiler/Pass.hpp>
#include <Ark/Compiler/AST/Node.hpp>
Expand Down
6 changes: 0 additions & 6 deletions include/Ark/Compiler/Serialization/IEEE754Serializer.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef ARK_COMPILER_SERIALIZATION_IEEE754SERIALIZER_HPP
#define ARK_COMPILER_SERIALIZATION_IEEE754SERIALIZER_HPP

#include <climits>
#include <cmath>
#include <limits>
#include <vector>
#include <bit>

namespace Ark::internal::ieee754
{
// Narrowing conversion from long long to double, 9223372036854775807 becomes 9223372036854775808.
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/Serialization/IntegerSerializer.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef ARK_COMPILER_SERIALIZATION_INTEGERSERIALIZER_HPP
#define ARK_COMPILER_SERIALIZATION_INTEGERSERIALIZER_HPP

#include <span>
#include <vector>
#include <concepts>

namespace Ark::internal
{
void serializeToVecLE(std::integral auto number, std::vector<uint8_t>& out)
Expand Down
3 changes: 0 additions & 3 deletions include/Ark/Compiler/ValTableElem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#ifndef ARK_COMPILER_VALTABLEELEM_HPP
#define ARK_COMPILER_VALTABLEELEM_HPP

#include <variant>
#include <string>

#include <Ark/Compiler/AST/Node.hpp>

namespace Ark::internal
Expand Down
4 changes: 0 additions & 4 deletions include/Ark/Compiler/Welder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#ifndef ARK_COMPILER_WELDER_HPP
#define ARK_COMPILER_WELDER_HPP

#include <string>
#include <vector>
#include <filesystem>

#include <Ark/Compiler/Common.hpp>
#include <Ark/Compiler/AST/Node.hpp>
#include <Ark/Compiler/AST/Parser.hpp>
Expand Down
2 changes: 0 additions & 2 deletions include/Ark/Constants.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#ifndef INCLUDE_ARK_CONSTANTS_HPP_IN
#define INCLUDE_ARK_CONSTANTS_HPP_IN

#include <string_view>

// clang-format off
constexpr int ARK_VERSION_MAJOR = @ARK_VERSION_MAJOR@;
constexpr int ARK_VERSION_MINOR = @ARK_VERSION_MINOR@;
Expand Down
Loading
Loading