From 4ba3c617c59157cf8abe6578c0fb7530cef3bcd8 Mon Sep 17 00:00:00 2001 From: Andreas Schniertshauer Date: Mon, 11 Sep 2017 21:07:32 +0200 Subject: [PATCH 1/8] Change: CMake, allow the developer to select if Dynamic or Static libraries are built --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index be676ba..c6f6d92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,18 @@ if (NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c99 -pedantic -Wall") endif () +# https://cmake.org/Wiki/BuildingWinDLL +# Allow the developer to select if Dynamic or Static libraries are built, default is static. +OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) +# Set the LIB_TYPE variable to STATIC +SET (LIB_TYPE STATIC) +IF (BUILD_SHARED_LIBS) + # User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED' + SET (LIB_TYPE SHARED) +ENDIF (BUILD_SHARED_LIBS) + add_library (utf8proc + ${LIB_TYPE} utf8proc.c utf8proc.h ) From ffbccf4b46d57c737c8f1d7bb03395f7e10548df Mon Sep 17 00:00:00 2001 From: Andreas Schniertshauer Date: Tue, 12 Sep 2017 19:52:30 +0200 Subject: [PATCH 2/8] Revert: Change: CMake, allow the developer to select if Dynamic or Static libraries are built --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6f6d92..be676ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,18 +21,7 @@ if (NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c99 -pedantic -Wall") endif () -# https://cmake.org/Wiki/BuildingWinDLL -# Allow the developer to select if Dynamic or Static libraries are built, default is static. -OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) -# Set the LIB_TYPE variable to STATIC -SET (LIB_TYPE STATIC) -IF (BUILD_SHARED_LIBS) - # User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED' - SET (LIB_TYPE SHARED) -ENDIF (BUILD_SHARED_LIBS) - add_library (utf8proc - ${LIB_TYPE} utf8proc.c utf8proc.h ) From f6c58b9fa98d3f6d6223cb4180d315f876a591e1 Mon Sep 17 00:00:00 2001 From: Andreas Schniertshauer Date: Fri, 2 Mar 2018 00:29:30 +0100 Subject: [PATCH 3/8] This solves JuliaLang/utf8proc issue #118 "Missing VERSION_INFO when compiling as Windows DLL" using CMakeHelpsers from https://github.com/halex2005/CMakeHelpers. CMakeHelpers must be place in the same directory as / parallel to utf8proc. For English resource language you need to replace the following things in the CMakeHelpers/VersionResource.rc file: FILEFLAGSMASK 0x3fL with FILEFLAGSMASK 0x17 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT with LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT BLOCK "041904b0 with BLOCK "040704b0" VALUE "Translation", 0x419, 1200 with VALUE "Translation", 0x407, 1200 --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index be676ba..2120438 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8) include (utils.cmake) +set(HASCMAKEHELPERS EXISTS "${CMAKE_SOURCE_DIR}/../CMakeHelpers/generate_product_version.cmake") + +if(${HASCMAKEHELPERS}) + include ("${CMAKE_SOURCE_DIR}/../CMakeHelpers/generate_product_version.cmake") +endif () + disallow_intree_builds() project (utf8proc C) @@ -21,9 +27,19 @@ if (NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c99 -pedantic -Wall") endif () +if(${HASCMAKEHELPERS}) + generate_product_version(ProductVersionFiles + NAME utf8proc + VERSION_MAJOR ${SO_MAJOR} + VERSION_MINOR ${SO_MINOR} + VERSION_PATCH ${SO_PATCH} + COMPANY_NAME julialang.org) +endif () + add_library (utf8proc utf8proc.c utf8proc.h + ${ProductVersionFiles} ) set_target_properties (utf8proc PROPERTIES From 80238e4310f5ccfd968b1424554fb7ce716f20f4 Mon Sep 17 00:00:00 2001 From: lady mesh Date: Sat, 22 Sep 2018 23:39:05 +0200 Subject: [PATCH 4/8] Revert f6c58b9fa98d3f6d6223cb4180d315f876a591e1 and solve it without using CMakeHelpers, now using win32/utf8proc.rc file (subject to change) in case of BUILD_SHARED_LIBS AND MSVC. --- CMakeLists.txt | 29 ++++++++++++----------------- win32/utf8proc.rc | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 win32/utf8proc.rc diff --git a/CMakeLists.txt b/CMakeLists.txt index 2120438..cbc701c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,6 @@ cmake_minimum_required (VERSION 2.8) include (utils.cmake) -set(HASCMAKEHELPERS EXISTS "${CMAKE_SOURCE_DIR}/../CMakeHelpers/generate_product_version.cmake") - -if(${HASCMAKEHELPERS}) - include ("${CMAKE_SOURCE_DIR}/../CMakeHelpers/generate_product_version.cmake") -endif () - disallow_intree_builds() project (utf8proc C) @@ -27,21 +21,22 @@ if (NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c99 -pedantic -Wall") endif () -if(${HASCMAKEHELPERS}) - generate_product_version(ProductVersionFiles - NAME utf8proc - VERSION_MAJOR ${SO_MAJOR} - VERSION_MINOR ${SO_MINOR} - VERSION_PATCH ${SO_PATCH} - COMPANY_NAME julialang.org) -endif () - -add_library (utf8proc +set(UTF8PROC_FILES utf8proc.c utf8proc.h - ${ProductVersionFiles} ) +if (BUILD_SHARED_LIBS AND MSVC) + set(UTF8PROC_WINDLL_SRCS + win32/utf8proc.rc + ) + add_definitions( + -DUTF8PROC_VERSION="${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" + ) +endif () + +add_library (utf8proc ${UTF8PROC_FILES} ${UTF8PROC_WINDLL_SRCS}) + set_target_properties (utf8proc PROPERTIES POSITION_INDEPENDENT_CODE ON VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" diff --git a/win32/utf8proc.rc b/win32/utf8proc.rc new file mode 100644 index 0000000..7609d6b --- /dev/null +++ b/win32/utf8proc.rc @@ -0,0 +1,40 @@ +#include +#include "../utf8proc.h" + +#ifdef GCC_WINDRES +VS_VERSION_INFO VERSIONINFO +#else +VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE +#endif + FILEVERSION UTF8PROC_VERSION_MAJOR,UTF8PROC_VERSION_MINOR,UTF8PROC_VERSION_PATCH,0 + PRODUCTVERSION UTF8PROC_VERSION_MAJOR,UTF8PROC_VERSION_MINOR,UTF8PROC_VERSION_PATCH,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + BEGIN + VALUE "FileDescription", "utf8proc library\0" + VALUE "FileVersion", UTF8PROC_VERSION "\0" + VALUE "InternalName", "utf8proc.dll\0" + VALUE "LegalCopyright", "(C) Jan Behrens and the rest of the Public Software Group\0" + VALUE "OriginalFilename", "utf8proc.dll\0" + VALUE "ProductName", "utf8proc\0" + VALUE "ProductVersion", UTF8PROC_VERSION "\0" + VALUE "Comments", "For more information visit https://github.com/JuliaStrings/utf8proc/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END From bffaa51fc448fa5b42e02c09fd97dbe3ef04b6cd Mon Sep 17 00:00:00 2001 From: lady mesh Date: Sun, 23 Sep 2018 00:12:46 +0200 Subject: [PATCH 5/8] CMake Error at CMakeLists.txt:37 (target_compile_definitions): Cannot specify compile definitions for target "utf8proc" which is not built by this project. --- CMakeLists.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ada2a7..6f351c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,16 +22,19 @@ set(UTF8PROC_FILES utf8proc.h ) +if (BUILD_SHARED_LIBS AND MSVC) + set(UTF8PROC_WINDLL_SRCS + win32/utf8proc.rc + ) + add_definitions( + -DUTF8PROC_VERSION="${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" + ) +endif () + +add_library (utf8proc ${UTF8PROC_FILES} ${UTF8PROC_WINDLL_SRCS}) + if (BUILD_SHARED_LIBS) # Building shared library - if (MSVC) - set(UTF8PROC_WINDLL_SRCS - win32/utf8proc.rc - ) - add_definitions( - -DUTF8PROC_VERSION="${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" - ) - endif () else() # Building static library target_compile_definitions(utf8proc PUBLIC "UTF8PROC_STATIC") @@ -40,8 +43,6 @@ else() endif() endif() -add_library (utf8proc ${UTF8PROC_FILES} ${UTF8PROC_WINDLL_SRCS}) - target_compile_definitions(utf8proc PRIVATE "UTF8PROC_EXPORTS") set_target_properties (utf8proc PROPERTIES From a25b5ba1771b63d7eac07ded512c8e935868ea9c Mon Sep 17 00:00:00 2001 From: lady mesh Date: Sat, 18 May 2019 10:01:56 +0200 Subject: [PATCH 6/8] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ffd2eda..7396623 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ test/iterate test/case test/custom /tmp/ +/build From 8e3b625cbc45d85ff36c75cb956c61dc6b22b870 Mon Sep 17 00:00:00 2001 From: Blonder Date: Thu, 18 Jul 2019 12:30:44 +0200 Subject: [PATCH 7/8] Refactoring missing VERSION_INFO when compiling as Windows DLL --- CMakeLists.txt | 7 ++----- utf8proc.h | 1 + win32/utf8proc.rc | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65227c5..35ef639 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ project (utf8proc C) # API version number (defined in utf8proc.h). # Be sure to also update these in Makefile and MANIFEST! set(SO_MAJOR 2) -set(SO_MINOR 4) -set(SO_PATCH 0) +set(SO_MINOR 3) +set(SO_PATCH 1) option(UTF8PROC_INSTALL "Enable installation of utf8proc" On) @@ -24,9 +24,6 @@ if (BUILD_SHARED_LIBS AND MSVC) set(UTF8PROC_WINDLL_SRCS win32/utf8proc.rc ) - add_definitions( - -DUTF8PROC_VERSION="${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" - ) endif () add_library (utf8proc ${UTF8PROC_FILES} ${UTF8PROC_WINDLL_SRCS}) diff --git a/utf8proc.h b/utf8proc.h index 490200f..b6131b8 100644 --- a/utf8proc.h +++ b/utf8proc.h @@ -75,6 +75,7 @@ /** The PATCH version (increased for fixes that do not change the API). */ #define UTF8PROC_VERSION_PATCH 0 /** @} */ +#define UTF8PROC_VERSION "2.4.0\0" #include diff --git a/win32/utf8proc.rc b/win32/utf8proc.rc index 7609d6b..c190b28 100644 --- a/win32/utf8proc.rc +++ b/win32/utf8proc.rc @@ -23,13 +23,14 @@ BEGIN BLOCK "040904E4" //language ID = U.S. English, char set = Windows, Multilingual BEGIN + VALUE "CompanyName", "JuliaStrings\0" VALUE "FileDescription", "utf8proc library\0" - VALUE "FileVersion", UTF8PROC_VERSION "\0" + VALUE "FileVersion", UTF8PROC_VERSION VALUE "InternalName", "utf8proc.dll\0" VALUE "LegalCopyright", "(C) Jan Behrens and the rest of the Public Software Group\0" VALUE "OriginalFilename", "utf8proc.dll\0" VALUE "ProductName", "utf8proc\0" - VALUE "ProductVersion", UTF8PROC_VERSION "\0" + VALUE "ProductVersion", UTF8PROC_VERSION VALUE "Comments", "For more information visit https://github.com/JuliaStrings/utf8proc/\0" END END From 8f161efa799fbc0160f712cc0b532b70789e7481 Mon Sep 17 00:00:00 2001 From: Blonder Date: Thu, 18 Jul 2019 12:37:34 +0200 Subject: [PATCH 8/8] Reanme UTF8PROC_VERSION used in win32 .rc to UTF8PROC_VERSION_NUMBER. --- utf8proc.h | 2 +- win32/utf8proc.rc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utf8proc.h b/utf8proc.h index b6131b8..3affa7a 100644 --- a/utf8proc.h +++ b/utf8proc.h @@ -75,7 +75,7 @@ /** The PATCH version (increased for fixes that do not change the API). */ #define UTF8PROC_VERSION_PATCH 0 /** @} */ -#define UTF8PROC_VERSION "2.4.0\0" +#define UTF8PROC_VERSION_NUMBER "2.4.0\0" #include diff --git a/win32/utf8proc.rc b/win32/utf8proc.rc index c190b28..0b57976 100644 --- a/win32/utf8proc.rc +++ b/win32/utf8proc.rc @@ -25,12 +25,12 @@ BEGIN BEGIN VALUE "CompanyName", "JuliaStrings\0" VALUE "FileDescription", "utf8proc library\0" - VALUE "FileVersion", UTF8PROC_VERSION + VALUE "FileVersion", UTF8PROC_VERSION_NUMBER VALUE "InternalName", "utf8proc.dll\0" VALUE "LegalCopyright", "(C) Jan Behrens and the rest of the Public Software Group\0" VALUE "OriginalFilename", "utf8proc.dll\0" VALUE "ProductName", "utf8proc\0" - VALUE "ProductVersion", UTF8PROC_VERSION + VALUE "ProductVersion", UTF8PROC_VERSION_NUMBER VALUE "Comments", "For more information visit https://github.com/JuliaStrings/utf8proc/\0" END END