Static library support improvements (#123)
* `#define UTF8PROC_STATIC` to disable DLLEXPORT `#define UTF8PROC_STATIC` to disable DLLEXPORT * [CMake] Automatically define UTF8PROC_STATIC if BUILD_SHARED_LIBS is off * [Makefile] Support additional UTF8PROC_DEFINES, which can be used to specify flags like `-DUTF8PROC_STATIC`
This commit is contained in:
parent
fe3f6bda11
commit
48949bd3eb
@ -22,6 +22,13 @@ add_library (utf8proc
|
|||||||
utf8proc.h
|
utf8proc.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
# Building shared library
|
||||||
|
else()
|
||||||
|
# Building static library
|
||||||
|
target_compile_definitions(utf8proc PUBLIC "UTF8PROC_STATIC")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(utf8proc PRIVATE "UTF8PROC_EXPORTS")
|
target_compile_definitions(utf8proc PRIVATE "UTF8PROC_EXPORTS")
|
||||||
|
|
||||||
set_target_properties (utf8proc PROPERTIES
|
set_target_properties (utf8proc PROPERTIES
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -11,7 +11,7 @@ CFLAGS ?= -O2
|
|||||||
PICFLAG = -fPIC
|
PICFLAG = -fPIC
|
||||||
C99FLAG = -std=c99
|
C99FLAG = -std=c99
|
||||||
WCFLAGS = -Wall -pedantic
|
WCFLAGS = -Wall -pedantic
|
||||||
UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS
|
UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS $(UTF8PROC_DEFINES)
|
||||||
|
|
||||||
# shared-library version MAJOR.MINOR.PATCH ... this may be *different*
|
# shared-library version MAJOR.MINOR.PATCH ... this may be *different*
|
||||||
# from the utf8proc version number because it indicates ABI compatibility,
|
# from the utf8proc version number because it indicates ABI compatibility,
|
||||||
|
|||||||
@ -120,6 +120,9 @@ typedef bool utf8proc_bool;
|
|||||||
#endif
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifdef UTF8PROC_STATIC
|
||||||
|
# define UTF8PROC_DLLEXPORT
|
||||||
|
#else
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
# ifdef UTF8PROC_EXPORTS
|
# ifdef UTF8PROC_EXPORTS
|
||||||
# define UTF8PROC_DLLEXPORT __declspec(dllexport)
|
# define UTF8PROC_DLLEXPORT __declspec(dllexport)
|
||||||
@ -131,6 +134,7 @@ typedef bool utf8proc_bool;
|
|||||||
# else
|
# else
|
||||||
# define UTF8PROC_DLLEXPORT
|
# define UTF8PROC_DLLEXPORT
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user