Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ include(TestBigEndian)
find_package(PythonInterp 3.6)
project(graphite2)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
if (NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE Release)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
message(STATUS "CMAKE_BUILD_TYPE is not specified, default to Release. Note that this is only relevant for single-configuration generators (such as Makefile Generators and Ninja).")
endif()

option(BUILD_SHARED_LIBS "Make library a shared library instead of static" ON)
Expand Down Expand Up @@ -82,16 +83,20 @@ if (BUILD_SHARED_LIBS)
endif()

add_subdirectory(src)
add_subdirectory(tests)
if (NOT GRAPHITE2_NFILEFACE)
# tests cannot be built with GRAPHITE2_NFILEFACE
add_subdirectory(tests)
endif()
add_subdirectory(doc)
if (NOT GRAPHITE2_NFILEFACE)
add_subdirectory(gr2fonttest)
endif()

set(version 3.0.1)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)

configure_file(graphite2.pc.in graphite2.pc)
configure_file(graphite2.pc.in graphite2.pc @ONLY)

install(FILES ${PROJECT_BINARY_DIR}/graphite2.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
6 changes: 5 additions & 1 deletion graphite2.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: Graphite2
Description: Font rendering engine for Complex Scripts
Version: ${version}
Version: @version@
Libs: -L${libdir} -lgraphite2
Cflags: -I${includedir}

4 changes: 2 additions & 2 deletions python/graphite2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
# find wheel's library
wheel = os.path.dirname(__file__)
if os.name == 'nt':
libpath = os.path.join(wheel, 'bin', 'graphite2.dll')
libpath = os.path.join(wheel, '..', 'bin', 'graphite2.dll')
else:
libpath = os.path.join(wheel, 'lib', 'libgraphite2.so')
libpath = os.path.join(wheel, '..', 'lib', 'libgraphite2.so')
gr2 = ctypes.cdll.LoadLibrary(libpath)


Expand Down
29 changes: 20 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ set_target_properties(graphite2 PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}"
LT_VERSION_REVISION ${GRAPHITE_API_REVISION}
LT_VERSION_AGE ${GRAPHITE_API_AGE})

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL ".*Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL ".*GNU")
set_target_properties(graphite2 PROPERTIES
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden"
LINK_FLAGS "-nodefaultlibs ${GRAPHITE_LINK_FLAGS}"
LINKER_LANGUAGE C)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86|amd64")
add_definitions(-mfpmath=sse -msse2)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
Expand All @@ -131,29 +131,40 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
endif ()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
if (BUILD_SHARED_LIBS)
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
endif()
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set_target_properties(graphite2 PROPERTIES
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden"
LINK_FLAGS "-nodefaultlibs"
LINKER_LANGUAGE C)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86|amd64")
add_definitions(-mfpmath=sse -msse2)
endif()
target_link_libraries(graphite2 c)
include(Graphite)
nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
if (BUILD_SHARED_LIBS)
nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
endif()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
if (BUILD_SHARED_LIBS)
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
endif()
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(graphite2 PROPERTIES
COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING")
if (BUILD_SHARED_LIBS)
set_target_properties(graphite2 PROPERTIES
COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING")
else()
set_target_properties(graphite2 PROPERTIES
COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_STATIC")
endif()
endif()


install(TARGETS graphite2 EXPORT graphite2 LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/graphite2 RUNTIME DESTINATION bin)
install(EXPORT graphite2 DESTINATION share/graphite2 NAMESPACE gr2_)
install(EXPORT graphite2 DESTINATION lib${LIB_SUFFIX}/graphite2 NAMESPACE gr2_)
2 changes: 1 addition & 1 deletion src/inc/Machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ of the License or (at your option) any later version.
#endif
#else
#define HOT __attribute__((hot))
#if defined(__x86_64)
#if defined(__x86_64) && !defined(__INTEL_COMPILER)
#define REGPARM(n) __attribute__((hot, regparm(n)))
#else
#define REGPARM(n)
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro(test_example TESTNAME SRCFILE)
set_tests_properties(${TESTNAME} PROPERTIES TIMEOUT 3)
endmacro()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL ".*Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL ".*GNU")
find_package(Freetype)
if (${FREETYPE_FOUND})
include_directories(${FREETYPE_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion tests/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(vm-test-direct vm-test-common)
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL ".*Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL ".*GNU")
add_definitions(-fno-rtti -fno-exceptions)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
add_definitions(-DNDEBUG -fomit-frame-pointer)
Expand Down