Skip to content

Commit

Permalink
add some discriptions of mdflibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
Simplxss committed Nov 29, 2023
1 parent f42dcaf commit c3dd7fc
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 58 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ else()
endif()

option(MDF_BUILD_SHARED_LIB "Build shared library." ON)
option(MDF_BUILD_SHARED_LIB_NET "Build shared library with .NET." ON)
option(MDF_BUILD_SHARED_LIB_EXAMPLE "Build MdfLibrary Example." OFF)
option(MDF_BUILD_DOC "Build documentation. Requires Doxygen and Release mode." OFF)
option(MDF_BUILD_TOOL "Build tools like the MDF Viewer. Requires WxWidgets." OFF)
if(MDF_BUILD_TOOL AND VCPKG)
# Boost & wxWidgets is not available for static linking
string(REPLACE "-static" "" VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}")
# Boost & wxWidgets need /MT for static linking
string(REPLACE VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}")
list(APPEND VCPKG_MANIFEST_FEATURES "mdfviewer")
endif()
option(MDF_BUILD_TEST "Build Google unit tests. Requires Google Test." OFF)
if(MDF_BUILD_TEST AND VCPKG)
# GTest is not available for static linking
string(REPLACE "-static" "" VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}")
# GTest need /MT for static linking
string(REPLACE VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}")
list(APPEND VCPKG_MANIFEST_FEATURES "mdflibtest")
endif()

Expand All @@ -29,13 +30,13 @@ project(
VERSION 2.0
DESCRIPTION "Interface against MDF 3/4 files"
LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_DEBUG_POSTFIX d)


add_subdirectory(mdflib)

if(MDF_BUILD_SHARED_LIB)
if(NOT (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.36))
set(MDF_BUILD_SHARED_LIB_NET OFF)
endif()
add_subdirectory(mdflibrary)
endif()

Expand Down
24 changes: 2 additions & 22 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"VCPKG_TARGET_TRIPLET": "x86-windows-static",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}"
}
}
}
],
"buildPresets": [
{
Expand Down Expand Up @@ -98,26 +98,6 @@
"ALL_BUILD",
"install"
]
}
],
"testPresets": [
{
"name": "ninja-multi-vcpkg-x64",
"description": "Build ninja-multi-vcpkg-x64 GTest",
"displayName": "Build ninja-multi-vcpkg-x64 GTest",
"configurePreset": "ninja-multi-vcpkg-x64"
},
{
"name": "msvc-multi-vcpkg-x64",
"description": "Build msvc-multi-vcpkg-x64 GTest",
"displayName": "Build msvc-multi-vcpkg-x64 GTest",
"configurePreset": "msvc-multi-vcpkg-x64"
},
{
"name": "msvc-multi-vcpkg-x64_x86",
"description": "Build msvc-multi-vcpkg-x64_x86 GTest",
"displayName": "Build msvc-multi-vcpkg-x64_x86 GTest",
"configurePreset": "msvc-multi-vcpkg-x64_x86"
}
}
]
}
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,35 @@ The MDF library repository implements an interface against the ASAM Measurement
It supports reading and writing of MDF files version 3 and 4.
The release 2.0 of the project support reading and writing of MDF files up to version 4.2.

The main project is a C++ static library and its used applications.
- **MDF Viewer**. Simple GUI application that list the contents of an MDF file.
- **MDF .NET (C++/CLI) Assembly**. Basic reading of MDF files for .NET friends.
- **MDF lib** is a C++ static library.
- **MDF lib test** is a C++ unit tests application for mdflib.
- **MDF library** is a C++ shared library, and it contains .NET (C++/CLI) Assembly(need to be built with msvc>=19.36).
- **MDF library example** is a C++ application that use MDF library as dll/so.
- **MDF library test net** is a C# unit tests application that use the .NET Assembly of MDF library.
- **MDF Viewer**. Simple GUI application that list the contents of an MDF file.
- **MDF gRPC Server**. Microservice for reading and writing of MDF files. On request.
- **MDF Python Library**. Basic reading and writing for Python friends. On request or use the ASAMMDF library.

The library and its applications, compiles/runs on Windows, Linux and Mac operating system.
The .NET library only runs on Windows operating system.
The library and its applications, compiles/runs on Windows, Linux and Mac operating system.

## Installation

[Windows Install (exe)](https://github.com/ihedvall/mdflib/releases/download/v2.0.%2C0/mdflib.exe)

## Building

Most project uses CMAKE for building. But mdflibrary_test_net need to build with Visual Studio.
The project uses CMAKE for building. But mdflibrary_test_net is a Visual Studio build.

The following third-party libraries are improted by [vcpkg](https://github.com/microsoft/vcpkg).
- ZLIB Library.
- EXPAT Library.
- Boost Library. Required if the GUI applications should be built.
- WxWidgets Library. Required if the GUI applications should be built.
- Google Test Library. Is required for running and build the unit tests.
The following third-party libraries are used and needs to be downloaded and pre-built.

The following third-party application need to be downloaded by yourself.
- ZLIB Library. Set the 'ZLIB_ROOT' variable to the ZLIB root path.
- EXPAT Library. Set the 'EXPAT_ROOT' variable to the ZLIB root path.
- Boost Library. Required if the GUI applications should be built.
- WxWidgets Library. Required if the GUI applications should be built.
- Google Test Library. Is required for running and build the unit tests.
- Doxygen's application. Is required if the documentation should be built.


Also, you can use [vcpkg](https://github.com/microsoft/vcpkg) to import the dependencies.

## License

Expand Down
6 changes: 3 additions & 3 deletions mdflib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright 2023 Simplxs
# SPDX-License-Identifier: MIT

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_DEBUG_POSTFIX d)

add_library(mdf STATIC
src/mdfblock.cpp src/mdfblock.h
src/mdffile.cpp ../include/mdf/mdffile.h
Expand Down Expand Up @@ -107,9 +110,6 @@ endif()
target_include_directories(
mdf PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)

# set_target_properties(mdflib PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS
# "-m32")

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_target_properties(mdf PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
Expand Down
16 changes: 13 additions & 3 deletions mdflibrary/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Copyright 2023 Simplxs
# SPDX-License-Identifier: MIT
project(
mdflibrary
VERSION 2.0
DESCRIPTION "Interface against MDF 3/4 files"
LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_DEBUG_POSTFIX d)

message(STATUS "Compiler Version " ${CMAKE_CXX_COMPILER_VERSION})
message(STATUS "MSVC " ${MSVC})
if (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.36)
if (MDF_BUILD_SHARED_LIB_NET)
message(STATUS "CLR compile")
# Hander files for building c# clr
add_library(mdflibrary SHARED
# C++ files
src/MdfExport.cpp

# Following files are needed for clr
src/AssemblyInfo.cpp
src/MdfAttachment.cpp src/MdfAttachment.h
src/MdfChannel.cpp src/MdfChannel.h
Expand All @@ -27,7 +38,6 @@ if (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.36)
src/Mdfwriter.cpp src/Mdfwriter.h
src/CanMessage.cpp src/CanMessage.h
)

set_target_properties(mdflibrary PROPERTIES COMMON_LANGUAGE_RUNTIME "")
else()
add_library(mdflibrary SHARED src/MdfExport.cpp)
Expand Down
4 changes: 3 additions & 1 deletion mdflibrary_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2023 Simplxs
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.20)
project(
mdflibraryexample
VERSION 1.0
Expand All @@ -16,3 +15,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()

target_link_libraries(mdflibraryexample PRIVATE mdflibrary)

target_include_directories(
mdflibrary PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
11 changes: 4 additions & 7 deletions mdfviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2021 Ingemar Hedvall
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.20)
project(
MdfViewer
VERSION 1.0
Expand All @@ -9,7 +8,7 @@ project(

set(CMAKE_CXX_STANDARD 20)

add_executable(mdfview
add_executable(mdfview
src/mdfviewer.cpp src/mdfviewer.h
src/mainframe.cpp src/mainframe.h
src/mdfdocument.cpp src/mdfdocument.h
Expand All @@ -36,16 +35,14 @@ target_include_directories(mdfview PRIVATE mdf
if(MSVC)
target_link_options(mdfview PRIVATE /SUBSYSTEM:WINDOWS)
target_compile_definitions(mdfview PRIVATE _WIN32_WINNT=0x0A00)
endif()

if(MINGW)
elseif(MINGW)
target_link_options(mdfview PRIVATE -mwindows -static -fstack-protector)
endif()

target_link_libraries(mdfview PRIVATE mdf)

if(VCPKG)
find_package(expat CONFIG REQUIRED)
find_package(expat CONFIG REQUIRED)
target_link_libraries(mdfview PRIVATE expat::expat)

find_package(ZLIB REQUIRED)
Expand All @@ -57,7 +54,7 @@ if(VCPKG)
find_package(wxWidgets CONFIG REQUIRED)
target_link_libraries(mdfview PRIVATE wx::core wx::base)
else()
include("../script/zlib.cmake")
include("../script/zlib.cmake")
include("../script/expat.cmake")
include("../script/wxwidgets.cmake")
include("../script/boost.cmake")
Expand Down

0 comments on commit c3dd7fc

Please sign in to comment.