-
Notifications
You must be signed in to change notification settings - Fork 1
Serialise empty model to XML #49
base: develop
Are you sure you want to change the base?
Conversation
Schema has been used to generate XML serialisation/ deserialisation code, based on Cellml_1_2.xsd. Notes: - CodeSynthesis XSD used as follows: ./generate.sh This creates Cellml_1_2.cpp and .h. - This approach of starting with an essentially blank schema document is not my preferred approach, but I was outvoted. My personal preference would have been to work incrementally, starting with the existing schema for CellML 1.1 and making only the changes that pertain to the differences between CellML 1.1 and the draft for CellML 1.2. A demonstration of that was done as shown here: https://github.com/codecurve/libcellml/blob/04de33845306a6468d389fd8a1be25e7405221e7/src/cellml_1_2.xsd as well as the commits that followed it.
Test was previously intended to fail.
As per http://stackoverflow.com/a/6847817 Note: this had to be redone, since the CMake refactor, it somehow got lost, see 89c624b
A few remarks:
|
Thanks @agarny |
Also, copy semantics better than reference for std::string in this case, I think, since move constructor will be invoked.
I've managed to reproduce the failed Windows link on my Windows PC by setting the |
Windows build now working, see 89b2f09. |
This is in order to get Ubuntu build slave result. (This will be reverted once cmake update done on build slave).
I seem to remember reading somewhere that there is a need for CMake 3.2, so how come everything is building fine using CMake 3.1.1 on Ubuntu (through BuildBot)? Otherwise, I can see that there is a warning on the Ubuntu build: http://autotest.bioeng.auckland.ac.nz/libcellml-buildbot/builders/Unit%20Tests%20Builder%20Ubuntu%2014.04%2064%20Bit/builds/86/steps/compile/logs/stdio. I don't know what has been agreed, if anything, regarding warnings, but personally I would consider them as errors (i.e. build libCellML using |
This eliminates the warning on Linux that a deprecated header was included.
Ubuntu cmake 3.1.1 seems to do mostly the correct thing, but 3.2 is required on Windows and OS X. |
I've added #50 regarding the "compile warnings as errors" question. |
DRY (Don't Repeat Yourself) principle: set flags in one place and reuse from other locations.
On the |
Thanks @agarny for catching that. Note: Warnings are now treated as errors, and build fails.
Note that the in-memory representation of the model is unused. I think this is probably OK, since there is only one way of serialising an empty model anyway.
I'm not a big fan of this approach with regards to the bulk setting of the compiler flags. I think this should be set on a per target basis. The conditional tests for compiler options should be based on the compiler and not the platform. This is no longer needed: To work around a bug conditionally set the CXX_STANDARD propertyif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") I don't understand why this header guard has been changed to this: #ifndef SRC_API_LIBCELLML_VERSION_H_ I would also set the CMAKE_MODULE_PATH and then just include the common.cmake file. The name of the macro is misleading it really should be set_compiler_flags, and as I said earlier this should be done on per target basis. |
The header guard is in the format required by the Google style guide as I understand it: http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#The__define_Guard
|
The document string in this line isn't correct. set( CMAKE_CODEBLOCKS_EXECUTABLE "" CACHE INTERNAL "Internalise BUILD_SHARED_LIBS" FORCE ) |
Done, see b603ca1 (In reply to cellml/libcellml#49 (comment)) |
Fine by me. |
20 hours have passed since all review items have been addressed (as far as I can tell). I think this can be merged, please. |
the header file ${CMAKE_CURRENT_SOURCE_DIR}/cellml_1_2.h is listed as an API header file but this is not the case |
the ${CMAKE_INSTALL_PREFIX}/ is not required in the install(FILES command |
As suggested by @hsorby
Done, thanks. See 6896bff.
|
It gets prepended anyway, remaining string is a relative path. @hsorby pointed this out, thanks.
Done, see f7bcb5b
|
I have created another pull request onto @codecurve empty-model-01 branch with the changes to the CMake related files that make me happy. A few other points:
|
Changes to CMake related files
…include directories. It would appear gtest is not very conformant to CMake best practices.
Got a bit carried away with my deletions
As suggested by @hsorby.
… into empty-model-01 Conflicts resolved: src/CMakeLists.txt
I chatted with @hsorby, and we agreed that keeping XSD generator options for "type-naming" and "function-naming" set to
|
Rather than by adding `generated` as include search path. That way, it is clearer in source code when generated code is being used. @hsorby suggested this.
Buildbot fail was not due to any problem in code, but due to download problem. |
HI Randall, we can manually trigger a changeset to be redelivered - just ask. In this case though, the download problem for the mac machine is still there. |
I have tried to access the Mac build slave that is having trouble with the download, but either my password has been changed, or I forgot it. Anyway, I have a mirror branch in my repo (https://github.com/codecurve/libcellml/tree/empty-model-0-travis-on-02), which has Travis enabled, and as you can see, both Mac and Linux builds passing there. See https://travis-ci.org/codecurve/libcellml/builds/57134328 |
This is for #31