From 3f2fff52e3c355d1ccba7316a7d96b8abfcc1052 Mon Sep 17 00:00:00 2001 From: mayong Date: Sat, 19 Jun 2021 16:42:19 +0800 Subject: [PATCH 1/7] Being compatible with vs 2019. --- src/drw_base.h | 2 +- src/intern/drw_textcodec.cpp | 2 +- vs2013/libdxfrw.vcxproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drw_base.h b/src/drw_base.h index 094af43..9e21518 100644 --- a/src/drw_base.h +++ b/src/drw_base.h @@ -10,7 +10,7 @@ ** along with this program. If not, see . ** ******************************************************************************/ -#pragma warning(disable:4996); //Ignore C4996, unsafe strncpy. TODO use safe alternative +#pragma warning(disable:4996) //Ignore C4996, unsafe strncpy. TODO use safe alternative #ifndef DRW_BASE_H #define DRW_BASE_H diff --git a/src/intern/drw_textcodec.cpp b/src/intern/drw_textcodec.cpp index bf5e034..29ca436 100644 --- a/src/intern/drw_textcodec.cpp +++ b/src/intern/drw_textcodec.cpp @@ -483,7 +483,7 @@ std::string DRW_ExtConverter::convertByiconv(const char *in_encode, iconv_t ic; ic = iconv_open(out_encode, in_encode); size_t il = BUF_SIZE-1, ol = BUF_SIZE-1; - iconv(ic , &in_ptr, &il, &out_ptr, &ol); + iconv(ic , (const char**)&in_ptr, &il, &out_ptr, &ol); iconv_close(ic); return std::string(out_buf); diff --git a/vs2013/libdxfrw.vcxproj b/vs2013/libdxfrw.vcxproj index a3f84ac..b4b41cb 100644 --- a/vs2013/libdxfrw.vcxproj +++ b/vs2013/libdxfrw.vcxproj @@ -18,13 +18,13 @@ StaticLibrary true - v141 + v142 MultiByte StaticLibrary false - v141 + v142 true MultiByte From d671092bbdc5dbc94545c8aae7c7e795b0d928c8 Mon Sep 17 00:00:00 2001 From: mayong Date: Sat, 19 Jun 2021 16:55:28 +0800 Subject: [PATCH 2/7] add CMakeLists.txt supporting both win32&linux --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4891825 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) +project(libdxfrw) + +file(GLOB libdxfrw_sources src/*.cpp) +file(GLOB libdxfrw_headers include/*.h) +file(GLOB libdxfrw_intern_sources src/intern/*.cpp) + +if(WIN32) + +include_directories(vs2013/packages/libiconv.1.14.0.11/build/native/include) +link_directories(vs2013/packages/libiconv.1.14.0.11/build/native/lib) +endif() +include_directories(include) + +add_library(dxfrw STATIC ${libdxfrw_sources} ${libdxfrw_intern_sources}) + +install(FILES ${libdxfrw_headers} DESTINATION include) + +if(WIN32) + install(TARGETS dxfrw + CONFIGURATIONS Debug + LIBRARY DESTINATION Debug/lib + ARCHIVE DESTINATION Debug/lib) + install(TARGETS dxfrw + CONFIGURATIONS Release + LIBRARY DESTINATION Release/lib + ARCHIVE DESTINATION Release/lib) +else() + install(TARGETS dxfrw + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +endif() \ No newline at end of file From 93630da1588a90ac33866de1131ca0bc4a1b1ea7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 19 Jun 2021 17:00:32 +0800 Subject: [PATCH 3/7] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index ef0997d..e79fc3b 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ make make install (as root) ``` +Use CMake + + +``` +mkdir build +cd build +build .. -DCMAKE_BUILD_TYPE=Release +build --build . --config Release --target install +``` + [VC++] - Open vs2013\libdxfrw.sln with VS2013 - Build Solution From c2950884004fbffbb1856d954fbcd9139e8e4800 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 19 Jun 2021 17:01:44 +0800 Subject: [PATCH 4/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e79fc3b..df3c44d 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ There is also a dwg to dxf converter that depends on libdxfrw that can be built - Open dwg2dxf\vs2013\dwg2dxf.sln with VS2013 - Build Solution +- Open the CMakeLists.txt from vs 2019 driectly +- build + Example usage of the library ========== From faa6a5c02e8e8a6a3934441ed5011f6a11e5aecd Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 19 Jun 2021 17:02:03 +0800 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df3c44d..15767d6 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ build --build . --config Release --target install There is also a dwg to dxf converter that depends on libdxfrw that can be built the same way. - Open dwg2dxf\vs2013\dwg2dxf.sln with VS2013 - Build Solution - +[VC++ with CMakeLists.txt] - Open the CMakeLists.txt from vs 2019 driectly - build From b5fc0c76abe6acef4e6c443a0c3f3e9e4dee233c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 19 Jun 2021 17:02:20 +0800 Subject: [PATCH 6/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 15767d6..657a8eb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ build --build . --config Release --target install There is also a dwg to dxf converter that depends on libdxfrw that can be built the same way. - Open dwg2dxf\vs2013\dwg2dxf.sln with VS2013 - Build Solution +- [VC++ with CMakeLists.txt] + - Open the CMakeLists.txt from vs 2019 driectly - build From 9dd872fe3d545c666e078615171521877a7a0cd4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 20 Jun 2021 18:55:37 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 657a8eb..3f79ee8 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ There is also a dwg to dxf converter that depends on libdxfrw that can be built - [VC++ with CMakeLists.txt] -- Open the CMakeLists.txt from vs 2019 driectly +- Open the CMakeLists.txt from vs 2019 directly - build Example usage of the library