Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Toolchain flags api#197

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
coder137 merged 21 commits intomainfromtoolchain_flags_api
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
21 commits
Select commitHold shift + click to select a range
9a2f2d0
Shifted flag_api.h header to `toolchain` but implementation remains i…
coder137Feb 22, 2022
c458223
Shifted function_lock to toolchain
coder137Feb 22, 2022
29b8f00
Updated toolchain.h with ToolchainSchema and FunctionLock for FlagApi
coder137Feb 22, 2022
3f1dc27
Updated TODO statements
coder137Feb 22, 2022
1eee2f8
Updated files with removed flag_api.h
coder137Feb 23, 2022
2e5b4d4
Update toolchain.h
coder137Mar 15, 2022
2f81b18
Update target.h
coder137Mar 15, 2022
e1c8435
Removed TargetState from TargetInfo and added to target.h
coder137Mar 16, 2022
31d3b03
Updated *_api header files
coder137Mar 16, 2022
fa205c0
Updated unit tests for toolchain lock expectations
coder137Mar 16, 2022
6e714fc
Updated flag_api.h with getter apis
coder137Mar 16, 2022
6c54266
Added test case of toolchain_flag_api
coder137Mar 16, 2022
9659697
Updated toolchain flag api test and target_info initialize API
coder137Mar 16, 2022
69581be
Updated bootstrap files
coder137Mar 16, 2022
3744dae
Update function_lock.h
coder137Mar 16, 2022
d4f7f79
Update tests
coder137Mar 17, 2022
ac47802
Update main.buildcc.cpp
coder137Mar 17, 2022
33b4a4f
Update toolchain.h
coder137Mar 17, 2022
61f679e
Added toolchain.cpp
coder137Mar 17, 2022
790566c
Update build_buildcc.cpp
coder137Mar 17, 2022
aed12a3
Update toolchain_utils.rst
coder137Mar 17, 2022
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
2 changes: 2 additions & 0 deletionsbootstrap/src/build_buildcc.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,6 +63,7 @@ void buildcc_cb(BaseTarget &target, const BaseGenerator &schema_gen,
// TOOLCHAIN
target.GlobSources("lib/toolchain/src/api");
target.GlobSources("lib/toolchain/src/common");
target.GlobSources("lib/toolchain/src/toolchain");
target.AddIncludeDir("lib/toolchain/include");
target.GlobHeaders("lib/toolchain/include/toolchain");
target.GlobHeaders("lib/toolchain/include/toolchain/api");
Expand All@@ -72,6 +73,7 @@ void buildcc_cb(BaseTarget &target, const BaseGenerator &schema_gen,
target.GlobSources("lib/target/src/common");
target.GlobSources("lib/target/src/generator");
target.GlobSources("lib/target/src/api");
target.GlobSources("lib/target/src/target_info");
target.GlobSources("lib/target/src/target");
target.GlobSources("lib/target/src/target/friend");

Expand Down
4 changes: 2 additions & 2 deletionsbuildcc/lib/args/test/test_persistent_storage.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,8 +16,8 @@ TEST_GROUP(PersistentStorageTestGroup)
};
// clang-format on

buildcc::BaseToolchain gcc(buildcc::ToolchainId::Gcc, "gcc", "as", "gcc", "g++",
"ar", "ld");
staticbuildcc::BaseToolchain gcc(buildcc::ToolchainId::Gcc, "gcc", "as", "gcc",
"g++","ar", "ld");

TEST(PersistentStorageTestGroup, BasicUsage) {
buildcc::PersistentStorage persistent;
Expand Down
6 changes: 4 additions & 2 deletionsbuildcc/lib/target/cmake/common_target_src.cmake
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,6 @@ set(COMMON_TARGET_SRCS
include/target/api/include_api.h
include/target/api/lib_api.h
include/target/api/pch_api.h
include/target/api/flag_api.h
include/target/api/deps_api.h

src/api/sync_api.cpp
Expand All@@ -38,6 +37,10 @@ set(COMMON_TARGET_SRCS
src/generator/generator.cpp
include/target/generator.h

# Target Info
src/target_info/target_info.cpp
include/target/target_info.h

# Target friend
src/target/friend/compile_pch.cpp
src/target/friend/compile_object.cpp
Expand All@@ -49,6 +52,5 @@ set(COMMON_TARGET_SRCS
# Target
src/target/target.cpp
src/target/build.cpp
include/target/target_info.h
include/target/target.h
)
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/deps_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetEnv
template <typename T> class DepsApi {
public:
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/include_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetConfig
// - TargetEnv
template <typename T> class IncludeApi {
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/lib_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetEnv
// T::GetTargetPath
template <typename T> class LibApi {
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/pch_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetConfig
// - TargetEnv
template <typename T> class PchApi {
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/source_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetConfig
// - TargetEnv
template <typename T> class SourceApi {
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/sync_api.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ enum class SyncOption {

// Requires
// - TargetStorer
// - TargetState
template <typename T> class SyncApi {
public:
/**
Expand Down
7 changes: 7 additions & 0 deletionsbuildcc/lib/target/include/target/api/target_getter.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,8 @@

#include "toolchain/toolchain.h"

#include "target/common/target_state.h"

#include "taskflow/taskflow.hpp"

namespace fs = std::filesystem;
Expand All@@ -32,6 +34,11 @@ namespace buildcc::internal {

template <typename T> class TargetGetter {
public:
// Target State
const TargetState &GetState() const;
bool IsBuilt() const;
bool IsLocked() const;

const std::string &GetName() const;
const Toolchain &GetToolchain() const;
TargetType GetType() const;
Expand Down
15 changes: 1 addition & 14 deletionsbuildcc/lib/target/include/target/api/target_info_getter.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,16 +26,10 @@ namespace buildcc::internal {

// Requires
// - TargetStorer
// - TargetState
// - TargetEnv
// - TargetConfig
template <typename T> class TargetInfoGetter {
public:
// Target State
const TargetState &GetState() const;
bool IsBuilt() const;
bool IsLocked() const;

// Target Env
const fs::path &GetTargetRootDir() const;
const fs::path &GetTargetBuildDir() const;
Expand All@@ -51,14 +45,7 @@ template <typename T> class TargetInfoGetter {
const std::vector<std::string> &GetExternalLibDeps() const;
const fs_unordered_set &GetIncludeDirs() const;
const fs_unordered_set &GetLibDirs() const;
const std::unordered_set<std::string> &GetPreprocessorFlags() const;
const std::unordered_set<std::string> &GetCommonCompileFlags() const;
const std::unordered_set<std::string> &GetPchCompileFlags() const;
const std::unordered_set<std::string> &GetPchObjectFlags() const;
const std::unordered_set<std::string> &GetAsmCompileFlags() const;
const std::unordered_set<std::string> &GetCCompileFlags() const;
const std::unordered_set<std::string> &GetCppCompileFlags() const;
const std::unordered_set<std::string> &GetLinkFlags() const;

const fs_unordered_set &GetCompileDependencies() const;
const fs_unordered_set &GetLinkDependencies() const;
};
Expand Down
1 change: 1 addition & 0 deletionsbuildcc/lib/target/include/target/generator.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@

namespace buildcc {

// TODO, Make this private
struct UserGeneratorSchema : public internal::GeneratorSchema {
fs_unordered_set inputs;
};
Expand Down
12 changes: 5 additions & 7 deletionsbuildcc/lib/target/include/target/target.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,22 +140,20 @@ class Target : public internal::BuilderInterface,
std::string name_;
TargetType type_;
internal::TargetSerialization serialization_;

// Friend classes
internal::CompilePch compile_pch_;
internal::CompileObject compile_object_;
internal::LinkTarget link_target_;

//
TargetState state_;
env::Command command_;
tf::Taskflow tf_;

// Task states
tf::Task target_start_task_;
tf::Task target_end_task_;

std::mutex task_state_mutex_;
env::TaskState task_state_{env::TaskState::SUCCESS};

//
env::Command command_;
tf::Taskflow tf_;
};

typedef Target BaseTarget;
Expand Down
14 changes: 8 additions & 6 deletionsbuildcc/lib/target/include/target/target_info.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,13 +21,10 @@

#include "toolchain/toolchain.h"

#include "target/common/function_lock.h"
#include "target/common/target_config.h"
#include "target/common/target_env.h"
#include "target/common/target_state.h"

#include "target/api/deps_api.h"
#include "target/api/flag_api.h"
#include "target/api/include_api.h"
#include "target/api/lib_api.h"
#include "target/api/pch_api.h"
Expand All@@ -39,6 +36,7 @@

namespace buildcc {

// TODO, Make this private
struct UserTargetSchema : public internal::TargetSchema {
fs_unordered_set sources;
fs_unordered_set headers;
Expand All@@ -65,7 +63,9 @@ class TargetInfo : public internal::SourceApi<TargetInfo>,
public:
TargetInfo(const BaseToolchain &toolchain, const TargetEnv &env,
const TargetConfig &config = TargetConfig())
: toolchain_(toolchain), env_(env), config_(config) {}
: toolchain_(toolchain), env_(env), config_(config) {
Initialize();
}

private:
// Inputs
Expand All@@ -87,10 +87,12 @@ class TargetInfo : public internal::SourceApi<TargetInfo>,
TargetEnv env_;
TargetConfig config_;

//
UserTargetSchema user_;

FunctionLock lock_;
TargetState state_;

private:
void Initialize();
};

typedef TargetInfo BaseTargetInfo;
Expand Down
46 changes: 45 additions & 1 deletionbuildcc/lib/target/src/api/flag_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "target/api/flag_api.h"
#include "toolchain/api/flag_api.h"

#include "target/target_info.h"

Expand DownExpand Up@@ -76,6 +76,50 @@ template <typename T> void FlagApi<T>::AddLinkFlag(const std::string &flag) {
t.user_.link_flags.insert(flag);
}

template <typename T>
const std::unordered_set<std::string> &
FlagApi<T>::GetPreprocessorFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.preprocessor_flags;
}
template <typename T>
const std::unordered_set<std::string> &
FlagApi<T>::GetCommonCompileFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.common_compile_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetPchCompileFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.pch_compile_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetPchObjectFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.pch_object_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetAsmCompileFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.asm_compile_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetCCompileFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.c_compile_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetCppCompileFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.cpp_compile_flags;
}
template <typename T>
const std::unordered_set<std::string> &FlagApi<T>::GetLinkFlags() const {
const T &t = static_cast<const T &>(*this);
return t.user_.link_flags;
}

template class FlagApi<TargetInfo>;
template class FlagApi<Toolchain>;

} // namespace buildcc::internal
19 changes: 19 additions & 0 deletionsbuildcc/lib/target/src/api/target_getter.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,25 @@

namespace buildcc::internal {

// Target State
template <typename T> const TargetState &TargetGetter<T>::GetState() const {
const T &t = static_cast<const T &>(*this);

return t.state_;
}

template <typename T> bool TargetGetter<T>::IsBuilt() const {
const T &t = static_cast<const T &>(*this);

return t.state_.IsBuilt();
}

template <typename T> bool TargetGetter<T>::IsLocked() const {
const T &t = static_cast<const T &>(*this);

return t.lock_.IsLocked();
}

template <typename T> const fs::path &TargetGetter<T>::GetBinaryPath() const {
const T &t = static_cast<const T &>(*this);

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp