-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CMake support #7
Comments
Hello @FlorianRhiem , thank you for your interest and readiness to help! |
Good to hear! I just started setting something up and noticed that the way you include your files, you require your users to clone the repo or download the source as |
The way it is right now is intentional. Current schema of
To include new submodule: The idea to ship
Such structure of the project is not final, and in some sens is an experiment. |
Alright, I see the benefit in submodule use. I'll just use the parent as include directory for building then. The three #include "oatpp/test/parser/json/mapping/DeserializerTest.hpp"
#include "oatpp/test/parser/json/mapping/DTOMapperPerfTest.hpp"
#include "oatpp/test/parser/json/mapping/DTOMapperTest.hpp"
int main() {
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest);
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperPerfTest);
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperTest);
return 0;
} The deserializer test fails with:
Both DTOMapper tests result in:
|
Tests currently are not in the actual state. I plan to get back to them some time later. You may just comment-out them for now |
Hey @FlorianRhiem I just checked these tests, and they should work just fine. Can you please add this and check ones again: #include "oatpp/test/parser/json/mapping/DeserializerTest.hpp"
#include "oatpp/test/parser/json/mapping/DTOMapperPerfTest.hpp"
#include "oatpp/test/parser/json/mapping/DTOMapperTest.hpp"
#include "oatpp/core/concurrency/SpinLock.hpp"
#include <iostream>
class Logger : public oatpp::base::Logger {
private:
oatpp::concurrency::SpinLock::Atom m_atom;
public:
Logger() : m_atom(false) {}
void log(v_int32 priority, const std::string& tag, const std::string& message) override {
oatpp::concurrency::SpinLock lock(m_atom);
std::cout << tag << ":" << message << "\n";
}
};
int main() {
oatpp::base::Environment::init();
oatpp::base::Environment::setLogger(new Logger()); // set Logger to print logs
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest);
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperPerfTest);
OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperTest);
oatpp::base::Environment::setLogger(nullptr); // free Logger
std::cout << "\nEnvironment:\n";
std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n";
std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n";
oatpp::base::Environment::destroy();
return 0;
} |
Thank you for the code example and verifying that it should work. It still crashes for me (macOS 10.12 using AppleClang 9) as |
Strange, because I also tested on MacOS 10.13 ... If you manage to find out the reason, that's will be great. Please let me know if you have any questions. |
I've found the cause of the issue: In You are using |
To clarify: With "seems to work" I mean that it works as long as only the (moved) String |
I see, Thanks a lot, this is great help and great issue:) |
Hey @FlorianRhiem |
Hello and thank you for your work!
Currently there are no files for any build systems aside from the shell script calling g++ that you provide with the examples. I think it'd be nice to have a CMakeLists.txt along with the source code to build and install the library, run the tests, etc. Would that be alright for you, or is the lack of something like that based on the project's zero dependency principle? If you simply don't use CMake yourself, then I could prepare a pull request during the weekend.
The text was updated successfully, but these errors were encountered: