Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved issue #118 "Missing VERSION_INFO when compiling as Windows DLL" #120

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Revert f6c58b9 and solve it without using CMakeHelpers, now using win…
…32/utf8proc.rc file (subject to change) in case of BUILD_SHARED_LIBS AND MSVC.
  • Loading branch information
lady mesh committed Sep 22, 2018
commit 80238e4310f5ccfd968b1424554fb7ce716f20f4
29 changes: 12 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}"
40 changes: 40 additions & 0 deletions win32/utf8proc.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <winver.h>
#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