Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure project layout #126

Merged
merged 2 commits into from
May 14, 2024
Merged
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
190 changes: 95 additions & 95 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,71 +67,71 @@ endif()

# Target: zasm
set(zasm_SOURCES
"src/zasm/src/core/error.cpp"
"src/zasm/src/core/filestream.cpp"
"src/zasm/src/core/memorystream.cpp"
"src/zasm/src/decoder/decoder.cpp"
"src/zasm/src/encoder/encoder.cpp"
"src/zasm/src/formatter/formatter.cpp"
"src/zasm/src/program/data.cpp"
"src/zasm/src/program/instruction.cpp"
"src/zasm/src/program/program.cpp"
"src/zasm/src/program/register.cpp"
"src/zasm/src/program/saverestore.cpp"
"src/zasm/src/program/saverestore.load.cpp"
"src/zasm/src/program/saverestore.save.cpp"
"src/zasm/src/serialization/serializer.cpp"
"src/zasm/src/x86/x86.assembler.cpp"
"src/zasm/src/x86/x86.register.cpp"
"src/zasm/src/zasm.cpp"
"src/zasm/src/encoder/encoder.context.hpp"
"src/zasm/src/program/program.node.hpp"
"src/zasm/src/program/program.state.hpp"
"src/zasm/src/program/saverestorehelper.hpp"
"src/zasm/src/program/saverestoretypes.hpp"
"include/zasm/base/immediate.hpp"
"include/zasm/base/instruction.hpp"
"include/zasm/base/label.hpp"
"include/zasm/base/memory.hpp"
"include/zasm/base/meta.hpp"
"include/zasm/base/mode.hpp"
"include/zasm/base/operand.hpp"
"include/zasm/base/register.hpp"
"include/zasm/core/bitsize.hpp"
"include/zasm/core/enumflags.hpp"
"include/zasm/core/errors.hpp"
"include/zasm/core/expected.hpp"
"include/zasm/core/filestream.hpp"
"include/zasm/core/math.hpp"
"include/zasm/core/memorystream.hpp"
"include/zasm/core/objectpool.hpp"
"include/zasm/core/packed.hpp"
"include/zasm/core/stream.hpp"
"include/zasm/core/stringpool.hpp"
"include/zasm/core/strongtype.hpp"
"include/zasm/decoder/decoder.hpp"
"include/zasm/encoder/encoder.hpp"
"include/zasm/formatter/formatter.hpp"
"include/zasm/program/align.hpp"
"include/zasm/program/data.hpp"
"include/zasm/program/embeddedlabel.hpp"
"include/zasm/program/instruction.hpp"
"include/zasm/program/labeldata.hpp"
"include/zasm/program/node.hpp"
"include/zasm/program/observer.hpp"
"include/zasm/program/program.hpp"
"include/zasm/program/saverestore.hpp"
"include/zasm/program/section.hpp"
"include/zasm/program/sentinel.hpp"
"include/zasm/serialization/serializer.hpp"
"include/zasm/x86/assembler.hpp"
"include/zasm/x86/emitter.hpp"
"include/zasm/x86/memory.hpp"
"include/zasm/x86/meta.hpp"
"include/zasm/x86/mnemonic.hpp"
"include/zasm/x86/register.hpp"
"include/zasm/x86/x86.hpp"
"include/zasm/zasm.hpp"
"zasm/src/zasm/src/core/error.cpp"
"zasm/src/zasm/src/core/filestream.cpp"
"zasm/src/zasm/src/core/memorystream.cpp"
"zasm/src/zasm/src/decoder/decoder.cpp"
"zasm/src/zasm/src/encoder/encoder.cpp"
"zasm/src/zasm/src/formatter/formatter.cpp"
"zasm/src/zasm/src/program/data.cpp"
"zasm/src/zasm/src/program/instruction.cpp"
"zasm/src/zasm/src/program/program.cpp"
"zasm/src/zasm/src/program/register.cpp"
"zasm/src/zasm/src/program/saverestore.cpp"
"zasm/src/zasm/src/program/saverestore.load.cpp"
"zasm/src/zasm/src/program/saverestore.save.cpp"
"zasm/src/zasm/src/serialization/serializer.cpp"
"zasm/src/zasm/src/x86/x86.assembler.cpp"
"zasm/src/zasm/src/x86/x86.register.cpp"
"zasm/src/zasm/src/zasm.cpp"
"zasm/src/zasm/src/encoder/encoder.context.hpp"
"zasm/src/zasm/src/program/program.node.hpp"
"zasm/src/zasm/src/program/program.state.hpp"
"zasm/src/zasm/src/program/saverestorehelper.hpp"
"zasm/src/zasm/src/program/saverestoretypes.hpp"
"zasm/include/zasm/base/immediate.hpp"
"zasm/include/zasm/base/instruction.hpp"
"zasm/include/zasm/base/label.hpp"
"zasm/include/zasm/base/memory.hpp"
"zasm/include/zasm/base/meta.hpp"
"zasm/include/zasm/base/mode.hpp"
"zasm/include/zasm/base/operand.hpp"
"zasm/include/zasm/base/register.hpp"
"zasm/include/zasm/core/bitsize.hpp"
"zasm/include/zasm/core/enumflags.hpp"
"zasm/include/zasm/core/errors.hpp"
"zasm/include/zasm/core/expected.hpp"
"zasm/include/zasm/core/filestream.hpp"
"zasm/include/zasm/core/math.hpp"
"zasm/include/zasm/core/memorystream.hpp"
"zasm/include/zasm/core/objectpool.hpp"
"zasm/include/zasm/core/packed.hpp"
"zasm/include/zasm/core/stream.hpp"
"zasm/include/zasm/core/stringpool.hpp"
"zasm/include/zasm/core/strongtype.hpp"
"zasm/include/zasm/decoder/decoder.hpp"
"zasm/include/zasm/encoder/encoder.hpp"
"zasm/include/zasm/formatter/formatter.hpp"
"zasm/include/zasm/program/align.hpp"
"zasm/include/zasm/program/data.hpp"
"zasm/include/zasm/program/embeddedlabel.hpp"
"zasm/include/zasm/program/instruction.hpp"
"zasm/include/zasm/program/labeldata.hpp"
"zasm/include/zasm/program/node.hpp"
"zasm/include/zasm/program/observer.hpp"
"zasm/include/zasm/program/program.hpp"
"zasm/include/zasm/program/saverestore.hpp"
"zasm/include/zasm/program/section.hpp"
"zasm/include/zasm/program/sentinel.hpp"
"zasm/include/zasm/serialization/serializer.hpp"
"zasm/include/zasm/x86/assembler.hpp"
"zasm/include/zasm/x86/emitter.hpp"
"zasm/include/zasm/x86/memory.hpp"
"zasm/include/zasm/x86/meta.hpp"
"zasm/include/zasm/x86/mnemonic.hpp"
"zasm/include/zasm/x86/register.hpp"
"zasm/include/zasm/x86/x86.hpp"
"zasm/include/zasm/zasm.hpp"
cmake.toml
)

Expand All @@ -142,7 +142,7 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${zasm_SOURCES})

add_library(zasm::zasm ALIAS zasm)
target_include_directories(zasm PUBLIC
include
"zasm/include"
)

target_link_libraries(zasm PUBLIC
Expand All @@ -156,35 +156,35 @@ if(ZASM_BUILD_TESTS OR CMKR_ROOT_PROJECT) # tests

add_library(zasm::testdata ALIAS zasm_testdata)
target_include_directories(zasm_testdata INTERFACE
"src/testdata"
"testdata/include"
)

endif()
# Target: zasm_tests
if(ZASM_BUILD_TESTS OR CMKR_ROOT_PROJECT) # tests
set(zasm_tests_SOURCES
"src/tests/main.cpp"
"src/tests/tests/tests.assembler.cpp"
"src/tests/tests/tests.decoder.cpp"
"src/tests/tests/tests.error.cpp"
"src/tests/tests/tests.externals.cpp"
"src/tests/tests/tests.formatter.cpp"
"src/tests/tests/tests.imports.cpp"
"src/tests/tests/tests.instruction.cpp"
"src/tests/tests/tests.instructions.x64.cpp"
"src/tests/tests/tests.instructionsinfo.x64.cpp"
"src/tests/tests/tests.observer.cpp"
"src/tests/tests/tests.packed.cpp"
"src/tests/tests/tests.program.cpp"
"src/tests/tests/tests.registers.cpp"
"src/tests/tests/tests.relocation.cpp"
"src/tests/tests/tests.saverestore.cpp"
"src/tests/tests/tests.sections.cpp"
"src/tests/tests/tests.segments.cpp"
"src/tests/tests/tests.serialization.cpp"
"src/tests/tests/tests.stringpool.cpp"
"src/tests/testutils.cpp"
"src/tests/testutils.hpp"
"tests/src/main.cpp"
"tests/src/tests/tests.assembler.cpp"
"tests/src/tests/tests.decoder.cpp"
"tests/src/tests/tests.error.cpp"
"tests/src/tests/tests.externals.cpp"
"tests/src/tests/tests.formatter.cpp"
"tests/src/tests/tests.imports.cpp"
"tests/src/tests/tests.instruction.cpp"
"tests/src/tests/tests.instructions.x64.cpp"
"tests/src/tests/tests.instructionsinfo.x64.cpp"
"tests/src/tests/tests.observer.cpp"
"tests/src/tests/tests.packed.cpp"
"tests/src/tests/tests.program.cpp"
"tests/src/tests/tests.registers.cpp"
"tests/src/tests/tests.relocation.cpp"
"tests/src/tests/tests.saverestore.cpp"
"tests/src/tests/tests.sections.cpp"
"tests/src/tests/tests.segments.cpp"
"tests/src/tests/tests.serialization.cpp"
"tests/src/tests/tests.stringpool.cpp"
"tests/src/testutils.cpp"
"tests/src/testutils.hpp"
cmake.toml
)

Expand Down Expand Up @@ -214,12 +214,12 @@ endif()
# Target: zasm_benchmarks
if(ZASM_BUILD_TESTS OR CMKR_ROOT_PROJECT) # tests
set(zasm_benchmarks_SOURCES
"src/benchmark/benchmarks/benchmark.assembler.cpp"
"src/benchmark/benchmarks/benchmark.formatter.cpp"
"src/benchmark/benchmarks/benchmark.instructioninfo.cpp"
"src/benchmark/benchmarks/benchmark.serialization.cpp"
"src/benchmark/benchmarks/benchmark.stringpool.cpp"
"src/benchmark/main.cpp"
"benchmark/src/benchmarks/benchmark.assembler.cpp"
"benchmark/src/benchmarks/benchmark.formatter.cpp"
"benchmark/src/benchmarks/benchmark.instructioninfo.cpp"
"benchmark/src/benchmarks/benchmark.serialization.cpp"
"benchmark/src/benchmarks/benchmark.stringpool.cpp"
"benchmark/src/main.cpp"
cmake.toml
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>
#include <functional>
#include <testdata/instructions.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>
#include <functional>
#include <testdata/instructions.hpp>
#include <zasm/formatter/formatter.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>
#include <functional>
#include <testdata/instructions.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/x86/meta.hpp>
#include <zasm/zasm.hpp>

Expand Down Expand Up @@ -39,8 +39,7 @@ namespace zasm::benchmarks
}

state.counters["InstructionInfos"] = benchmark::Counter(
static_cast<double>(numInstructions), benchmark::Counter::kIsRate,
benchmark::Counter::OneK::kIs1000);
static_cast<double>(numInstructions), benchmark::Counter::kIsRate, benchmark::Counter::OneK::kIs1000);
}
BENCHMARK(BM_InstructionInfo)->Unit(benchmark::kMillisecond);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>
#include <functional>
#include <testdata/instructions.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::benchmarks
Expand Down Expand Up @@ -102,12 +102,10 @@ namespace zasm::benchmarks
}

state.counters["BytesEncoded"] = benchmark::Counter(
static_cast<double>(numBytesEncoded), benchmark::Counter::kIsRate,
benchmark::Counter::OneK::kIs1024);
static_cast<double>(numBytesEncoded), benchmark::Counter::kIsRate, benchmark::Counter::OneK::kIs1024);

state.counters["Instructions"] = benchmark::Counter(
static_cast<double>(numInstructions), benchmark::Counter::kIsRate,
benchmark::Counter::OneK::kIs1000);
static_cast<double>(numInstructions), benchmark::Counter::kIsRate, benchmark::Counter::OneK::kIs1000);
}
BENCHMARK_TEMPLATE(BM_SerializationWithLabels, 128)->Unit(benchmark::kMillisecond);

Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ alias = "zasm::common"
type = "static"
alias = "zasm::zasm"
sources = [
"src/zasm/**.cpp",
"zasm/src/**.cpp",
]
headers = [
"src/zasm/**.hpp",
"include/zasm/**.hpp",
"zasm/src/**.hpp",
"zasm/include/**.hpp",
]
include-directories = ["include"]
include-directories = ["zasm/include"]
link-libraries = [
"zasm::common",
"Zydis",
Expand All @@ -42,16 +42,16 @@ link-libraries = [
condition = "tests"
type = "interface"
alias = "zasm::testdata"
include-directories = ["src/testdata"]
include-directories = ["testdata/include"]

[target.zasm_tests]
condition = "tests"
type = "executable"
sources = [
"src/tests/**.cpp",
"tests/src/**.cpp",
]
headers = [
"src/tests/**.hpp",
"tests/src/**.hpp",
]
link-libraries = [
"zasm::common",
Expand All @@ -66,10 +66,10 @@ PROJECT_LABEL = "tests"
condition = "tests"
type = "executable"
sources = [
"src/benchmark/**.cpp",
"benchmark/src/**.cpp",
]
headers = [
"src/benchmark/**.hpp",
"benchmark/src/**.hpp",
]
link-libraries = [
"zasm::common",
Expand Down
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
@@ -1,7 +1,7 @@
#include "../testutils.hpp"

#include <gtest/gtest.h>
#include <testdata/instructions.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../testutils.hpp"

#include <gtest/gtest.h>
#include <testdata/instructions.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::tests
Expand All @@ -28,7 +28,7 @@ namespace zasm::tests
ASSERT_EQ(info.hasValue(), true);

ASSERT_EQ(instr.getOperandCount(), info->getVisibleOperandCount());

const auto& instrInfo = info.value();
for (std::size_t i = 0; i < instr.getOperandCount(); i++)
{
Expand Down
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,9 +2,9 @@

#include <gtest/gtest.h>
#include <sstream>
#include <testdata/instructions.hpp>
#include <zasm/core/memorystream.hpp>
#include <zasm/program/saverestore.hpp>
#include <zasm/testdata/x86/instructions.hpp>
#include <zasm/zasm.hpp>

namespace zasm::tests
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.
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.
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.
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