michael@0: # GRAPHITE2 LICENSING michael@0: # michael@0: # Copyright 2010, SIL International michael@0: # All rights reserved. michael@0: # michael@0: # This library is free software; you can redistribute it and/or modify michael@0: # it under the terms of the GNU Lesser General Public License as published michael@0: # by the Free Software Foundation; either version 2.1 of License, or michael@0: # (at your option) any later version. michael@0: # michael@0: # This program is distributed in the hope that it will be useful, michael@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: # Lesser General Public License for more details. michael@0: # michael@0: # You should also have received a copy of the GNU Lesser General Public michael@0: # License along with this library in the file named "LICENSE". michael@0: # If not, write to the Free Software Foundation, 51 Franklin Street, michael@0: # Suite 500, Boston, MA 02110-1335, USA or visit their web page on the michael@0: # internet at http://www.fsf.org/licenses/lgpl.html. michael@0: michael@0: CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) michael@0: project(graphite2_core) michael@0: cmake_policy(SET CMP0012 NEW) michael@0: INCLUDE(CheckCXXSourceCompiles) michael@0: michael@0: set(GRAPHITE_API_CURRENT 3) michael@0: set(GRAPHITE_API_REVISION 0) michael@0: set(GRAPHITE_API_AGE 1) michael@0: set(GRAPHITE_VERSION ${GRAPHITE_API_CURRENT}.${GRAPHITE_API_REVISION}.${GRAPHITE_API_AGE}) michael@0: set(GRAPHITE_SO_VERSION ${GRAPHITE_API_CURRENT}) michael@0: michael@0: include(TestBigEndian) michael@0: michael@0: include_directories(${PROJECT_SOURCE_DIR}) michael@0: michael@0: set(SEGCACHE SegCache.cpp SegCacheEntry.cpp SegCacheStore.cpp) michael@0: if (GRAPHITE2_NSEGCACHE) michael@0: add_definitions(-DGRAPHITE2_NSEGCACHE) michael@0: set(SEGCACHE) michael@0: endif (GRAPHITE2_NSEGCACHE) michael@0: michael@0: set(FILEFACE FileFace.cpp) michael@0: if (GRAPHITE2_NFILEFACE) michael@0: add_definitions(-DGRAPHITE2_NFILEFACE) michael@0: set(FILEFACE) michael@0: endif (GRAPHITE2_NFILEFACE) michael@0: michael@0: set(TRACING json.cpp) michael@0: if (GRAPHITE2_NTRACING) michael@0: add_definitions(-DGRAPHITE2_NTRACING) michael@0: set(TRACING) michael@0: endif (GRAPHITE2_NTRACING) michael@0: michael@0: if (GRAPHITE2_TELEMETRY) michael@0: add_definitions(-DGRAPHITE2_TELEMETRY) michael@0: endif (GRAPHITE2_TELEMETRY) michael@0: michael@0: set(GRAPHITE_HEADERS michael@0: ../include/graphite2/Font.h michael@0: ../include/graphite2/Segment.h michael@0: ../include/graphite2/Types.h michael@0: ../include/graphite2/Log.h michael@0: ) michael@0: michael@0: file(GLOB PRIVATE_HEADERS inc/*.h) michael@0: michael@0: add_library(graphite2 SHARED michael@0: ${GRAPHITE2_VM_TYPE}_machine.cpp michael@0: gr_char_info.cpp michael@0: gr_features.cpp michael@0: gr_face.cpp michael@0: gr_font.cpp michael@0: gr_logging.cpp michael@0: gr_segment.cpp michael@0: gr_slot.cpp michael@0: Bidi.cpp michael@0: CachedFace.cpp michael@0: CmapCache.cpp michael@0: Code.cpp michael@0: Face.cpp michael@0: FeatureMap.cpp michael@0: Font.cpp michael@0: GlyphFace.cpp michael@0: GlyphCache.cpp michael@0: Justifier.cpp michael@0: NameTable.cpp michael@0: Pass.cpp michael@0: Rule.cpp michael@0: Segment.cpp michael@0: Silf.cpp michael@0: Slot.cpp michael@0: Sparse.cpp michael@0: TtfUtil.cpp michael@0: UtfCodec.cpp michael@0: ${FILEFACE} michael@0: ${SEGCACHE} michael@0: ${TRACING}) michael@0: michael@0: set_target_properties(graphite2 PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}" michael@0: SOVERSION ${GRAPHITE_SO_VERSION} michael@0: VERSION ${GRAPHITE_VERSION} michael@0: LT_VERSION_CURRENT ${GRAPHITE_API_CURRENT} michael@0: LT_VERSION_REVISION ${GRAPHITE_API_REVISION} michael@0: LT_VERSION_AGE ${GRAPHITE_API_AGE}) michael@0: michael@0: if (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") michael@0: set(GRAPHITE_LINK_FLAGS "-fsanitize=address") michael@0: else (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") michael@0: set(GRAPHITE_LINK_FLAGS "") michael@0: endif (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") michael@0: michael@0: if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") michael@0: set_target_properties(graphite2 PROPERTIES michael@0: 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 -fno-stack-protector" michael@0: LINK_FLAGS "-nodefaultlibs ${GRAPHITE_LINK_FLAGS}" michael@0: LINKER_LANGUAGE C) michael@0: if (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") michael@0: target_link_libraries(graphite2 kernel32 msvcr90 mingw32 gcc user32) michael@0: else (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") michael@0: if (GRAPHITE2_ASAN) michael@0: target_link_libraries(graphite2 c gcc_s) michael@0: else (GRAPHITE2_ASAN) michael@0: target_link_libraries(graphite2 c gcc) michael@0: endif (GRAPHITE2_ASAN) michael@0: include(Graphite) michael@0: nolib_test(stdc++ $) michael@0: endif (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") michael@0: set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") michael@0: CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}") michael@0: endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") michael@0: michael@0: if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") michael@0: set_target_properties(graphite2 PROPERTIES michael@0: COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector" michael@0: LINK_FLAGS "-nodefaultlibs" michael@0: LINKER_LANGUAGE C) michael@0: target_link_libraries(graphite2 c) michael@0: include(Graphite) michael@0: nolib_test(stdc++ $) michael@0: set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") michael@0: CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}") michael@0: endif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") michael@0: michael@0: if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") michael@0: set_target_properties(graphite2 PROPERTIES michael@0: COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING") michael@0: endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") michael@0: michael@0: michael@0: install(TARGETS graphite2 EXPORT graphite2 LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/graphite2 RUNTIME DESTINATION bin) michael@0: install(EXPORT graphite2 DESTINATION share/graphite2 NAMESPACE gr2_)