2022-04-18 20:24:39 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
|
|
|
set(libBasename JKQTMathText)
|
2019-06-22 22:39:53 +08:00
|
|
|
set(libIncludeSubdir jkqtmathtext)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
2019-06-22 20:21:32 +08:00
|
|
|
set(libsh_name ${libBasename}SharedLib)
|
2019-11-18 22:59:06 +08:00
|
|
|
set(libsh_name_decorated ${libsh_name}${JKQtPlotter_LIBNAME_ADDITION})
|
2019-06-22 20:21:32 +08:00
|
|
|
set(${libBasename}_SHARED_LIBRARY ${libsh_name_decorated} CACHE STRING "name of static library for ${libBasename}" FORCE)
|
2019-06-20 21:18:58 +08:00
|
|
|
message( STATUS "-- Building ${libsh_name}" )
|
2019-11-18 22:59:06 +08:00
|
|
|
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
2019-06-22 20:21:32 +08:00
|
|
|
set(lib_name ${libBasename}Lib)
|
2019-11-18 22:59:06 +08:00
|
|
|
set(lib_name_decorated ${lib_name}${JKQtPlotter_LIBNAME_ADDITION})
|
2019-06-22 20:21:32 +08:00
|
|
|
set(${libBasename}_STATIC_LIBRARY ${lib_name_decorated} CACHE STRING "name of static library for ${libBasename}" FORCE)
|
2019-06-20 21:18:58 +08:00
|
|
|
message( STATUS "-- Building ${lib_name}" )
|
2019-11-18 22:59:06 +08:00
|
|
|
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
|
|
|
# Set up source files
|
2019-06-21 04:24:47 +08:00
|
|
|
set(SOURCES
|
2022-04-18 20:24:39 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/jkqtmathtext.cpp
|
2022-06-08 21:38:26 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/jkqtmathtexttools.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/jkqtmathtextlabel.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtexttextnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextbracenode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextdecoratednode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextfracnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextinstructionnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextlistnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextmatrixnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsqrtnode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsubsupernode.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsymbolnode.cpp
|
2022-06-20 04:36:38 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextnodetools.cpp
|
2022-07-04 02:30:12 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextwhitespacenode.cpp
|
2019-05-18 19:23:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set(HEADERS
|
2022-04-18 20:24:39 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/jkqtmathtext.h>
|
|
|
|
$<INSTALL_INTERFACE:jkqtmathtext.h>
|
2022-06-08 21:38:26 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/jkqtmathtexttools.h>
|
|
|
|
$<INSTALL_INTERFACE:jkqtmathtexttools.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/jkqtmathtextlabel.h>
|
|
|
|
$<INSTALL_INTERFACE:jkqtmathtextlabel.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtexttextnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtexttextnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextbracenode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextbracenode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextdecoratednode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextdecoratednode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextfracnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextfracnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextinstructionnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextinstructionnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextlistnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextlistnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextmatrixnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextmatrixnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsqrtnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextsqrtnode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsubsupernode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextsubsupernode.h>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextsymbolnode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextsymbolnode.h>
|
2022-06-20 04:36:38 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextnodetools.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextnodetools.h>
|
2022-07-04 02:30:12 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/nodes/jkqtmathtextwhitespacenode.h>
|
|
|
|
$<INSTALL_INTERFACE:nodes/jkqtmathtextwhitespacenode.h>
|
2022-04-18 20:24:39 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/jkqtmathtext_imexport.h>
|
|
|
|
$<INSTALL_INTERFACE:jkqtmathtext_imexport.h>
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
2019-06-20 21:18:58 +08:00
|
|
|
set(RESOURCES
|
2022-04-18 20:24:39 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/resources/xits.qrc
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
2019-11-18 22:59:06 +08:00
|
|
|
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
|
|
|
|
2019-06-22 22:39:53 +08:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
2022-04-18 20:24:39 +08:00
|
|
|
add_library(${libsh_name} SHARED ${SOURCES} ${RESOURCES} ${HEADERS} )
|
2019-06-20 21:18:58 +08:00
|
|
|
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
2019-06-22 20:21:32 +08:00
|
|
|
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
2022-07-18 21:01:12 +08:00
|
|
|
target_link_libraries(${libsh_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets JKQTCommonSharedLib)
|
2019-06-22 20:21:32 +08:00
|
|
|
target_compile_definitions(${libsh_name} PUBLIC JKQTMATHTEXT_LIB_IN_DLL)
|
|
|
|
target_compile_definitions(${libsh_name} PRIVATE JKQTMATHTEXT_LIB_EXPORT_LIBRARY)
|
2022-04-22 19:27:31 +08:00
|
|
|
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
|
|
|
|
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
|
|
|
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
|
|
|
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
|
|
|
else()
|
|
|
|
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 17)
|
|
|
|
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
|
|
|
target_compile_features(${libsh_name} PUBLIC cxx_std_17)
|
|
|
|
endif()
|
2020-06-28 21:53:26 +08:00
|
|
|
if(MINGW)
|
|
|
|
# COMPILER-SETTINGS FOR MINGW
|
|
|
|
target_compile_options(${libsh_name} PUBLIC -fexceptions)
|
|
|
|
elseif(MSVC)
|
|
|
|
# COMPILER-SETTINGS FOR MS VISUAL C++
|
|
|
|
target_compile_options(${libsh_name} PUBLIC /EHsc)
|
2020-06-29 13:59:11 +08:00
|
|
|
target_compile_definitions(${libsh_name} PUBLIC NOMINMAX)
|
2020-06-28 21:53:26 +08:00
|
|
|
endif()
|
|
|
|
target_include_directories(${libsh_name} PUBLIC
|
2022-04-18 20:24:39 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
2019-11-18 22:59:06 +08:00
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
|
)
|
2020-06-28 15:49:20 +08:00
|
|
|
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
|
|
|
target_compile_definitions(${libsh_name} PRIVATE JKQTMATHTEXT_COMPILED_WITH_XITS)
|
|
|
|
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
2019-11-22 04:42:10 +08:00
|
|
|
set_target_properties(${libsh_name} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS "ON")
|
2019-06-22 22:39:53 +08:00
|
|
|
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion )
|
2019-06-20 21:18:58 +08:00
|
|
|
endif()
|
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
2022-04-18 20:24:39 +08:00
|
|
|
add_library(${lib_name} STATIC ${SOURCES} ${RESOURCES} ${HEADERS})
|
2019-06-20 21:18:58 +08:00
|
|
|
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
2019-06-22 20:21:32 +08:00
|
|
|
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}")
|
2022-04-22 19:27:31 +08:00
|
|
|
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
|
|
|
|
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11)
|
|
|
|
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
|
|
|
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
|
|
|
else()
|
|
|
|
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 17)
|
|
|
|
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
|
|
|
target_compile_features(${lib_name} PUBLIC cxx_std_17)
|
|
|
|
endif()
|
2020-06-28 21:53:26 +08:00
|
|
|
if(MINGW)
|
|
|
|
# COMPILER-SETTINGS FOR MINGW
|
|
|
|
target_compile_options(${lib_name} PUBLIC -fexceptions)
|
|
|
|
elseif(MSVC)
|
|
|
|
# COMPILER-SETTINGS FOR MS VISUAL C++
|
|
|
|
target_compile_options(${lib_name} PUBLIC /EHsc)
|
2020-06-29 13:59:11 +08:00
|
|
|
target_compile_definitions(${lib_name} PUBLIC NOMINMAX)
|
2020-06-28 21:53:26 +08:00
|
|
|
endif()
|
2020-06-28 15:49:20 +08:00
|
|
|
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
|
|
|
target_compile_definitions(${lib_name} PRIVATE JKQTMATHTEXT_COMPILED_WITH_XITS)
|
|
|
|
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
2022-07-18 21:01:12 +08:00
|
|
|
target_link_libraries(${lib_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets JKQTCommonLib)
|
2022-04-18 20:24:39 +08:00
|
|
|
target_include_directories(${lib_name} PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
2019-11-18 22:59:06 +08:00
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
|
)
|
2019-06-22 22:39:53 +08:00
|
|
|
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion )
|
2019-06-20 21:18:58 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Installation
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
2020-06-28 21:53:26 +08:00
|
|
|
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
|
|
|
)
|
|
|
|
set(JKQTP_CURRENT_TARGET_FILENAME "${libsh_name}Targets.cmake")
|
|
|
|
set(JKQTP_CURRENT_TARGET_SHAREDPART "Shared")
|
|
|
|
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" @ONLY)
|
|
|
|
install(EXPORT ${libsh_name}_TARGETS
|
|
|
|
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
|
|
|
DESTINATION lib/cmake
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
|
|
|
DESTINATION lib/cmake )
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake"
|
|
|
|
DESTINATION lib/cmake )
|
2019-11-18 22:59:06 +08:00
|
|
|
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
|
|
|
|
|
|
|
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
2020-06-28 21:53:26 +08:00
|
|
|
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
|
|
|
)
|
|
|
|
set(JKQTP_CURRENT_TARGET_FILENAME "${lib_name}Targets.cmake")
|
|
|
|
set(JKQTP_CURRENT_TARGET_SHAREDPART "")
|
|
|
|
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake" @ONLY)
|
|
|
|
install(EXPORT ${lib_name}_TARGETS
|
|
|
|
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
|
|
|
DESTINATION lib/cmake
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
|
|
|
DESTINATION lib/cmake )
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
|
|
|
|
DESTINATION lib/cmake )
|
2019-11-18 22:59:06 +08:00
|
|
|
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
|
|
|
|
|
|
|
install(FILES ${HEADERS}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
|
|
|
COMPONENT Headers)
|
|
|
|
|
2020-10-02 21:40:47 +08:00
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY)
|
2020-06-28 15:53:33 +08:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter )
|
2020-10-02 21:40:47 +08:00
|
|
|
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" )
|
|
|
|
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/OFL.txt" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_LICENSE.txt" )
|
|
|
|
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/README.md" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_README.md" )
|
2019-11-18 22:59:06 +08:00
|
|
|
|