Compare commits
3 Commits
6bcfd52b07
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 5317575aeb | |||
| c0e3c1257d | |||
| 088004d494 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
build/
|
||||
CPM_modules/
|
||||
@@ -2,33 +2,32 @@ cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
project(cyberiadamlpp VERSION 1.0)
|
||||
|
||||
find_package(LibXml2 REQUIRED)
|
||||
if(!LibXml2_FOUND)
|
||||
message(FATAL_ERROR "Cannot find libxml2 library")
|
||||
endif()
|
||||
include(cmake/CPM.cmake)
|
||||
|
||||
set(cyberiadaml_DIR /usr/lib/cmake)
|
||||
find_package(cyberiadaml REQUIRED)
|
||||
if(!cyberiadaml_FOUND)
|
||||
message(FATAL_ERROR "Cannot find libcyberiadaml library")
|
||||
endif()
|
||||
CPMAddPackage(
|
||||
NAME libcyberiadaml
|
||||
VERSION 1.0.0
|
||||
URL https://git.gogacoder.com/gogacoder/libcyberiadaml/archive/v1.0.0.zip
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_library(cyberiadamlpp SHARED cyberiadamlpp.cpp)
|
||||
add_library(cyberiadamlpp SHARED src/cyberiadamlpp.cpp)
|
||||
target_include_directories(cyberiadamlpp PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:include/cyberiada>
|
||||
"${cyberiadaml_INCLUDE_DIRS}")
|
||||
"${cyberiadaml_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
target_link_directories(cyberiadamlpp PUBLIC "${cyberiadaml_LIBRARY}")
|
||||
target_link_libraries(cyberiadamlpp PUBLIC "${cyberiadaml_LIBRARIES}")
|
||||
target_link_libraries(cyberiadamlpp PUBLIC "${cyberiadaml_LIBRARIES}" cyberiadaml)
|
||||
|
||||
add_executable(cyberiadapp main.cpp)
|
||||
add_executable(cyberiadapp src/main.cpp)
|
||||
target_include_directories(cyberiadapp PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include/cyberiada>)
|
||||
$<INSTALL_INTERFACE:include/cyberiada>
|
||||
)
|
||||
target_link_directories(cyberiadapp PUBLIC "${PROJECT_BINARY_DIR}")
|
||||
target_link_libraries(cyberiadapp PUBLIC cyberiadamlpp)
|
||||
|
||||
@@ -63,7 +62,8 @@ foreach(f ${test_files})
|
||||
file(COPY_FILE
|
||||
"${f}"
|
||||
"${PROJECT_BINARY_DIR}/tests/${fname}"
|
||||
ONLY_IF_DIFFERENT)
|
||||
ONLY_IF_DIFFERENT
|
||||
)
|
||||
endforeach()
|
||||
|
||||
file(COPY_FILE
|
||||
@@ -78,8 +78,10 @@ install(EXPORT cyberiadamlpp DESTINATION lib/cmake)
|
||||
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cyberiadamlpp-config.cmake.in
|
||||
${PROJECT_BINARY_DIR}/cyberiadamlpp-config.cmake @ONLY)
|
||||
${PROJECT_BINARY_DIR}/cyberiadamlpp-config.cmake @ONLY
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${PROJECT_BINARY_DIR}/cyberiadamlpp-config.cmake
|
||||
DESTINATION lib/cmake)
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
59
Makefile.old
59
Makefile.old
@@ -1,59 +0,0 @@
|
||||
LIB_TARGET_STATIC := libcyberiadamlpp.a
|
||||
LIB_TARGET_DYNAMIC := libcyberiadamlpp.so
|
||||
|
||||
ifeq ($(DYNAMIC), 1)
|
||||
LIB_TARGET := $(LIB_TARGET_DYNAMIC)
|
||||
else
|
||||
LIB_TARGET := $(LIB_TARGET_STATIC)
|
||||
endif
|
||||
|
||||
TESTS_DIR := tests
|
||||
MAIN_TARGET := cyberiadapp
|
||||
LIB_SOURCES := cyberiadamlpp.cpp
|
||||
MAIN_SOURCES := main.cpp
|
||||
LIB_OBJECTS := $(patsubst %.cpp, %.o, $(LIB_SOURCES))
|
||||
MAIN_OBJECTS := $(patsubst %.cpp, %.o, $(MAIN_SOURCES))
|
||||
TEST_SOURCES := $(wildcard $(addsuffix /*.cpp, $(TESTS_DIR)))
|
||||
TEST_OBJECTS := $(patsubst %.cpp, %.o, $(TEST_SOURCES))
|
||||
TEST_TARGETS := $(patsubst %.cpp, %.test, $(TEST_SOURCES))
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS := -Werror -Wall -Wshadow -Wconversion -fPIC -g3 -D__DEBUG__
|
||||
LFLAGS :=
|
||||
else
|
||||
CFLAGS := -fPIC
|
||||
LFLAGS :=
|
||||
endif
|
||||
|
||||
INCLUDE := -I. -I/usr/include/libxml2 -I./cyberiadaml
|
||||
LIBS := -L/usr/lib -lxml2 -L./cyberiadaml -lcyberiadaml
|
||||
MAIN_LIBS := -L. -lcyberiadamlpp
|
||||
|
||||
$(LIB_TARGET): $(LIB_OBJECTS)
|
||||
ifeq ($(DYNAMIC), 1)
|
||||
g++ -shared $(LIBS) $(LIB_OBJECTS) -o $@
|
||||
else
|
||||
ar rcs $@ $(LIB_OBJECTS)
|
||||
endif
|
||||
|
||||
$(MAIN_TARGET): $(MAIN_OBJECTS) $(LIB_TARGET) $(LIB_ORJECTS)
|
||||
g++ $(MAIN_OBJECTS) -Wl,-\( $(LIBS) $(MAIN_LIBS) -Wl,-\) -o $@
|
||||
|
||||
%.test: %.o $(LIB_TARGET)
|
||||
g++ $< -Wl,-\( $(LIBS) $(MAIN_LIBS) -Wl,-\) -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
g++ -c $< $(CFLAGS) $(INCLUDE) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o $(TARGET) $(MAIN_TARGET) $(LIB_TARGET_STATIC) $(LIB_TARGET_DYNAMIC)
|
||||
rm -f $(TESTS_DIR)/*~ $(TESTS_DIR)/*.o $(TESTS_DIR)/*.test.graphml $(TESTS_DIR)/*.test.txt $(TEST_TARGETS)
|
||||
|
||||
main: $(MAIN_TARGET)
|
||||
|
||||
tests: $(TEST_TARGETS)
|
||||
@echo >/dev/null
|
||||
|
||||
all: $(LIB_TARGET) $(MAIN_TARGET) $(TEST_TARGETS)
|
||||
|
||||
.PHONY: all clean main tests
|
||||
@@ -21,6 +21,7 @@
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include <algorithm>
|
||||
#include <cyberiada/cyberiadaml.h>
|
||||
#include <sstream>
|
||||
#include "cyberiadamlpp.h"
|
||||
|
||||
@@ -2077,7 +2078,7 @@ void Document::load(const String& path, DocumentFormat f)
|
||||
int res = cyberiada_init_sm_document(&doc);
|
||||
CYB_ASSERT(res == CYBERIADA_NO_ERROR);
|
||||
|
||||
res = cyberiada_read_sm_document(&doc, path.c_str(), CyberiadaXMLFormat(f));
|
||||
res = cyberiada_read_sm_document(&doc, path.c_str(), CyberiadaXMLFormat(f), CYBERIADA_NO_ERROR);
|
||||
if (res != CYBERIADA_NO_ERROR) {
|
||||
cyberiada_cleanup_sm_document(&doc);
|
||||
CYB_CHECK_RESULT(res);
|
||||
@@ -2344,7 +2345,7 @@ void Document::save(const String& path, DocumentFormat f) const
|
||||
throw AssertException("Internal save error: " + e.str());
|
||||
}
|
||||
|
||||
res = cyberiada_write_sm_document(&doc, path.c_str(), CyberiadaXMLFormat(f));
|
||||
res = cyberiada_write_sm_document(&doc, path.c_str(), CyberiadaXMLFormat(f), CYBERIADA_NO_ERROR);
|
||||
if (res != CYBERIADA_NO_ERROR) {
|
||||
cyberiada_cleanup_sm_document(&doc);
|
||||
CYB_CHECK_RESULT(res);
|
||||
Reference in New Issue
Block a user