-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add use of compile time option #276
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
#include "mylib/lib.hpp" | ||
|
||
// test external pac | ||
#include <Eigen/Dense> | ||
#include <fmt/core.h> | ||
#include <fmt/ranges.h> | ||
Check warning on line 5 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 5 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 5 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
|
||
#ifdef HAS_EIGEN | ||
# include <Eigen/Dense> | ||
#endif | ||
|
||
// test std libraries | ||
#include <iostream> | ||
Check warning on line 12 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 12 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 12 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <string> | ||
Check warning on line 13 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 13 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 13 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <string_view> | ||
Check warning on line 14 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 14 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 14 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <vector> | ||
|
||
// test c libraries | ||
#include <cassert> | ||
Check warning on line 18 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 18 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 18 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <cctype> | ||
Check warning on line 19 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 19 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 19 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <cstddef> | ||
Check warning on line 20 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 20 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 20 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <cstdint> | ||
Check warning on line 21 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 21 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 21 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
#include <cstring> | ||
Check warning on line 22 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 22 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 22 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
|
||
int main() { | ||
fmt::print("Hello from fmt{}", "!"); | ||
int main() | ||
Check warning on line 24 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, gcc, true, true)
Check warning on line 24 in tests/myproj/src/main/main.cpp GitHub Actions / Test (windows-2022, llvm, true, true)
Check warning on line 24 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
|
||
{ | ||
fmt::print("Hello from main{}\n", "!"); | ||
|
||
Eigen::VectorXd eigen_vec = Eigen::Vector3d(1, 2, 3); | ||
fmt::print("[{}]", fmt::join(eigen_vec, ", ")); | ||
auto eigen_vec = std::vector<int>() = {1, 2, 3}; | ||
fmt::print("[{}]\n", fmt::join(eigen_vec, ", ")); | ||
Check warning on line 29 in tests/myproj/src/main/main.cpp GitHub Actions / Test (ubuntu-22.04, gcc, true, true)
|
||
|
||
#if !defined(__MINGW32__) && !defined(__MSYS__)// TODO fails | ||
#if defined(HAS_EIGEN) && !defined(__MINGW32__) && !defined(__MSYS__) // TODO fails | ||
Eigen::VectorXd eigen_vec2 = Eigen::VectorXd::LinSpaced(10, 0, 1); | ||
fmt::print("[{}]", fmt::join(eigen_vec2, ", ")); | ||
fmt::print("[{}]\n", fmt::join(eigen_vec2, ", ")); | ||
#endif | ||
|
||
// trigger address sanitizer | ||
// int *p = nullptr; | ||
// *p = 1; | ||
|
||
// trigger compiler warnings, clang-tidy, and cppcheck | ||
int a; | ||
int a = some_fun(); | ||
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
Check warning on line 41 in tests/myproj/src/main/main.cpp GitHub Actions / Test (macos-12, llvm, true, true)
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to export this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be passed from the builder of this library. project_options doesn't provide a specific mechanism for this.