Skip to content

Commit

Permalink
Merge pull request #69 from xR3b0rn/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xR3b0rn authored May 29, 2021
2 parents 2de9d3b + a72223e commit c1b4fe9
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 61 deletions.
123 changes: 65 additions & 58 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@

cmake_minimum_required(VERSION 3.12)

project("libdbcppp" VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_definitions("/bigobj")
endif()

include_directories("include")
include_directories("third-party/libxml2/include")
include_directories("third-party/libxmlmm/libxmlmm")
include_directories("third-party/boost")
include_directories("third-party/cxxopts/include")

set(LIBXML2_WITH_ICONV OFF)
set(LIBXML2_WITH_LZMA OFF)
set(LIBXML2_WITH_PYTHON OFF)
set(LIBXML2_WITH_ZLIB OFF)
set(LIBXML2_WITH_TESTS OFF)

add_subdirectory(third-party/libxml2)

file(GLOB libxmlmm_header
"third-party/libxmlmm/libxmlmm/*.h"
)
file(GLOB libxmlmm_src
"third-party/libxmlmm/libxmlmm/*.cpp"
)

add_library(libxmlmm SHARED "")
target_link_libraries(libxmlmm LibXml2)

target_sources("libxmlmm"
PRIVATE ${libxmlmm_header}
PRIVATE ${libxmlmm_src}
)

install(
TARGETS "libxmlmm"
DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
DIRECTORY "libxmlmm"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxmlmm
FILES_MATCHING PATTERN "*.h")

add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(examples)

set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

cmake_minimum_required(VERSION 3.12)

project("libdbcppp" VERSION 0.1.0)

option(build_tests "Build tests" ON)
option(build_examples "Build examples" ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_definitions("/bigobj")
endif()

include_directories("include")
include_directories("third-party/libxml2/include")
include_directories("third-party/libxmlmm/libxmlmm")
include_directories("third-party/boost")
include_directories("third-party/cxxopts/include")

set(LIBXML2_WITH_ICONV OFF)
set(LIBXML2_WITH_LZMA OFF)
set(LIBXML2_WITH_PYTHON OFF)
set(LIBXML2_WITH_ZLIB OFF)
set(LIBXML2_WITH_TESTS OFF)

add_subdirectory(third-party/libxml2)

file(GLOB libxmlmm_header
"third-party/libxmlmm/libxmlmm/*.h"
)
file(GLOB libxmlmm_src
"third-party/libxmlmm/libxmlmm/*.cpp"
)

add_library(libxmlmm SHARED "")
target_link_libraries(libxmlmm LibXml2)

target_sources("libxmlmm"
PRIVATE ${libxmlmm_header}
PRIVATE ${libxmlmm_src}
)

install(
TARGETS "libxmlmm"
DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
DIRECTORY "libxmlmm"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxmlmm
FILES_MATCHING PATTERN "*.h")

add_subdirectory(src)
if (build_tests)
add_subdirectory(tests)
endif()
if (build_examples)
add_subdirectory(examples)
endif()

set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
3 changes: 1 addition & 2 deletions examples/BasicUsage/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "../../include/dbcppp/CApi.h"
#include "../../include/dbcppp/Network.h"
#include "../../tests/Config.h"

// from uapi/linux/can.h
using canid_t = uint32_t;
Expand Down Expand Up @@ -53,7 +52,7 @@ int main()
{
std::unique_ptr<dbcppp::INetwork> net;
{
std::ifstream idbc(TEST_DBC);
std::ifstream idbc("your.dbc");
net = dbcppp::INetwork::LoadDBCFromIs(idbc);
}
std::unordered_map<uint64_t, const dbcppp::IMessage*> messages;
Expand Down
2 changes: 1 addition & 1 deletion tests/DBCParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST_CASE("DBCParserTest", "[]")
{
continue;
}
std::cout << "Testing DBC grammar with file: " << dbc_file << std::endl;
std::cout << "Testing DBC grammar with file: " << dbc_file.path() << std::endl;
auto dbc_file_tmp = dbc_file.path().string() + ".tmp";
std::unique_ptr<dbcppp::INetwork> spec;
std::unique_ptr<dbcppp::INetwork> test;
Expand Down

0 comments on commit c1b4fe9

Please sign in to comment.