From 19f7a90a8c84804d5e44f005d0b85749c0905bcc Mon Sep 17 00:00:00 2001 From: trotFunky Date: Thu, 16 May 2019 15:19:41 +0200 Subject: [PATCH] =?UTF-8?q?R=C3=A9agencement=20pour=20le=20TP=20XML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + snippets/CMakeLists.txt | 22 ---------- xmlParser/CMakeLists.txt | 49 ++++++++++++++++++++++ {snippets => xmlParser}/Circle.cpp | 0 {snippets => xmlParser}/Circle.h | 0 {snippets => xmlParser}/DrawingElement.cpp | 0 {snippets => xmlParser}/DrawingElement.h | 0 {snippets => xmlParser}/Group.cpp | 0 {snippets => xmlParser}/Group.h | 0 {snippets => xmlParser}/gTestXMLParser.cpp | 0 {snippets => xmlParser}/xmlParser.cpp | 0 {snippets => xmlParser}/xmlParser.h | 0 12 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 xmlParser/CMakeLists.txt rename {snippets => xmlParser}/Circle.cpp (100%) rename {snippets => xmlParser}/Circle.h (100%) rename {snippets => xmlParser}/DrawingElement.cpp (100%) rename {snippets => xmlParser}/DrawingElement.h (100%) rename {snippets => xmlParser}/Group.cpp (100%) rename {snippets => xmlParser}/Group.h (100%) rename {snippets => xmlParser}/gTestXMLParser.cpp (100%) rename {snippets => xmlParser}/xmlParser.cpp (100%) rename {snippets => xmlParser}/xmlParser.h (100%) diff --git a/.gitignore b/.gitignore index 43ba924..e5e7b89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/.idea/ **/cmake-build*/ +**/*.tar* diff --git a/snippets/CMakeLists.txt b/snippets/CMakeLists.txt index c81bfaf..a03ef56 100644 --- a/snippets/CMakeLists.txt +++ b/snippets/CMakeLists.txt @@ -39,28 +39,6 @@ endif() add_executable(compte_mots compte_mots.cpp) -add_executable(parseXML xmlParser.cpp xmlParser.h Circle.h Circle.cpp Group.cpp Group.h DrawingElement.cpp DrawingElement.h DrawingElement.cpp) -target_link_libraries(parseXML sfml-window sfml-graphics) - -find_path(PugiXML_INCLUDE_DIR pugixml.hpp) -target_link_libraries(parseXML pugixml) -target_include_directories(parseXML PRIVATE ${PugiXML_INCLUDE_DIR}) -target_link_directories(parseXML PRIVATE ${PugiXML_INCLUDE_DIR}) - - -if(GTest_FOUND) - add_executable(xmlTest gTestXMLParser.cpp Circle.h xmlParser.h xmlParser.cpp Circle.cpp Group.cpp Group.h DrawingElement.cpp DrawingElement.h DrawingElement.cpp) - - target_link_libraries(xmlTest sfml-window sfml-graphics) - - target_include_directories(xmlTest PRIVATE ${PugiXML_INCLUDE_DIR}) - target_link_directories(xmlTest PRIVATE ${PugiXML_INCLUDE_DIR}) - target_link_libraries(xmlTest pugixml) - - target_link_libraries(xmlTest ${GTEST_BOTH_LIBRARIES}) - target_link_options(xmlTest PRIVATE -pthread) -endif() - add_library(polynomial SHARED Polynomial.cpp Polynomial.tpp) #target_link_libraries(polynomial -static) diff --git a/xmlParser/CMakeLists.txt b/xmlParser/CMakeLists.txt new file mode 100644 index 0000000..e1acc4e --- /dev/null +++ b/xmlParser/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.14) +project(xmlParser) + +set(CMAKE_CXX_STANDARD 17) + +include_directories(.) + +# Detect and add SFML +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH}) +find_package(SFML COMPONENTS system window graphics network audio REQUIRED) + +if(NOT SFML_FOUND) + message(FATAL_ERROR "SFML could not be found") +endif() + +find_package(GTest REQUIRED) +if(GTest_FOUND) + enable_testing() +else() + message(FATAL_ERROR "GTest could not be found") +endif() + +find_path(PugiXML_INCLUDE_DIR pugixml.hpp) + +add_library(xmlParser SHARED + Circle.cpp + Circle.h + DrawingElement.cpp + DrawingElement.h + Group.cpp + Group.h + xmlParser.cpp + xmlParser.h) + +target_link_libraries(xmlParser + sfml-window + sfml-graphics + pugixml) + +add_executable(gTestXMLParser gTestXMLParser.cpp) +target_compile_options(gTestXMLParser PRIVATE -pthread) + +target_link_libraries(gTestXMLParser + xmlParser + gtest + sfml-graphics + sfml-window + pugixml) +target_link_options(gTestXMLParser PRIVATE -pthread) \ No newline at end of file diff --git a/snippets/Circle.cpp b/xmlParser/Circle.cpp similarity index 100% rename from snippets/Circle.cpp rename to xmlParser/Circle.cpp diff --git a/snippets/Circle.h b/xmlParser/Circle.h similarity index 100% rename from snippets/Circle.h rename to xmlParser/Circle.h diff --git a/snippets/DrawingElement.cpp b/xmlParser/DrawingElement.cpp similarity index 100% rename from snippets/DrawingElement.cpp rename to xmlParser/DrawingElement.cpp diff --git a/snippets/DrawingElement.h b/xmlParser/DrawingElement.h similarity index 100% rename from snippets/DrawingElement.h rename to xmlParser/DrawingElement.h diff --git a/snippets/Group.cpp b/xmlParser/Group.cpp similarity index 100% rename from snippets/Group.cpp rename to xmlParser/Group.cpp diff --git a/snippets/Group.h b/xmlParser/Group.h similarity index 100% rename from snippets/Group.h rename to xmlParser/Group.h diff --git a/snippets/gTestXMLParser.cpp b/xmlParser/gTestXMLParser.cpp similarity index 100% rename from snippets/gTestXMLParser.cpp rename to xmlParser/gTestXMLParser.cpp diff --git a/snippets/xmlParser.cpp b/xmlParser/xmlParser.cpp similarity index 100% rename from snippets/xmlParser.cpp rename to xmlParser/xmlParser.cpp diff --git a/snippets/xmlParser.h b/xmlParser/xmlParser.h similarity index 100% rename from snippets/xmlParser.h rename to xmlParser/xmlParser.h