2019-06-20 21:18:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
|
|
|
set(libBasename JKQTCommon)
|
2019-06-22 22:39:53 +08:00
|
|
|
set(libIncludeSubdir jkqtcommon)
|
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
|
2019-06-20 21:18:58 +08:00
|
|
|
jkqtpdebuggingtools.cpp
|
|
|
|
jkqtpmathtools.cpp
|
|
|
|
jkqtpalgorithms.cpp
|
|
|
|
jkqtpstringtools.cpp
|
|
|
|
jkqtplinalgtools.cpp
|
|
|
|
jkqtpcodestructuring.cpp
|
|
|
|
jkqtpbasicimagetools.cpp
|
|
|
|
jkqtpdrawingtools.cpp
|
|
|
|
jkqtpenhancedpainter.cpp
|
|
|
|
jkqtphighrestimer.cpp
|
|
|
|
jkqtpmathparser.cpp
|
|
|
|
jkqttools.cpp
|
|
|
|
jkqtparraytools.cpp
|
|
|
|
jkqtpstatbasics.cpp
|
|
|
|
jkqtpstathistogram.cpp
|
|
|
|
jkqtpstatkde.cpp
|
|
|
|
jkqtpstatregression.cpp
|
|
|
|
jkqtpstatpoly.cpp
|
|
|
|
jkqtpstatgrouped.cpp
|
2019-05-18 19:23:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set(HEADERS
|
2019-06-22 20:21:32 +08:00
|
|
|
jkqtcommon_imexport.h
|
2019-06-20 21:18:58 +08:00
|
|
|
jkqtpdebuggingtools.h
|
|
|
|
jkqtpmathtools.h
|
|
|
|
jkqtpalgorithms.h
|
|
|
|
jkqtpstringtools.h
|
|
|
|
jkqtplinalgtools.h
|
|
|
|
jkqtpcodestructuring.h
|
|
|
|
jkqtpbasicimagetools.h
|
|
|
|
jkqtpdrawingtools.h
|
|
|
|
jkqtpenhancedpainter.h
|
|
|
|
jkqtphighrestimer.h
|
|
|
|
jkqtpmathparser.h
|
|
|
|
jkqttools.h
|
|
|
|
jkqtparraytools.h
|
|
|
|
jkqtpstatisticstools.h
|
|
|
|
jkqtpstatbasics.h
|
|
|
|
jkqtpstathistogram.h
|
|
|
|
jkqtpstatkde.h
|
|
|
|
jkqtpstatregression.h
|
|
|
|
jkqtpstatpoly.h
|
|
|
|
jkqtpstatgrouped.h
|
|
|
|
)
|
|
|
|
|
2019-06-22 22:39:53 +08:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
2019-06-20 21:18:58 +08:00
|
|
|
|
2019-11-18 22:59:06 +08:00
|
|
|
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
2019-06-21 04:24:47 +08:00
|
|
|
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS})
|
2019-11-18 22:59:06 +08:00
|
|
|
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
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}")
|
2019-11-18 22:59:06 +08:00
|
|
|
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport)
|
2019-06-22 20:21:32 +08:00
|
|
|
target_compile_definitions(${libsh_name} PUBLIC JKQTCOMMON_LIB_IN_DLL)
|
|
|
|
target_compile_definitions(${libsh_name} PRIVATE JKQTCOMMON_LIB_EXPORT_LIBRARY)
|
2019-11-18 22:59:06 +08:00
|
|
|
target_include_directories(${libsh_name} PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
|
)
|
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)
|
2019-06-21 04:24:47 +08:00
|
|
|
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS})
|
2019-11-18 22:59:06 +08:00
|
|
|
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
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}")
|
2019-11-18 22:59:06 +08:00
|
|
|
target_include_directories(${lib_name} PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
|
)
|
|
|
|
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport)
|
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)
|
2019-06-20 21:18:58 +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}
|
2019-06-22 22:39:53 +08:00
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
|
|
|
)
|
|
|
|
install(EXPORT ${libsh_name}_TARGETS
|
|
|
|
FILE ${libsh_name}Config.cmake
|
2019-11-18 22:59:06 +08:00
|
|
|
DESTINATION lib/cmake/${libsh_name}
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
2019-11-18 22:59:06 +08:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
|
|
|
DESTINATION lib/cmake/${libsh_name} )
|
|
|
|
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-20 21:18:58 +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}
|
2019-06-22 22:39:53 +08:00
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
|
|
|
)
|
|
|
|
install(EXPORT ${lib_name}_TARGETS
|
|
|
|
FILE ${lib_name}Config.cmake
|
2019-11-18 22:59:06 +08:00
|
|
|
DESTINATION lib/cmake/${lib_name}
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
2019-11-18 22:59:06 +08:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
|
|
|
DESTINATION lib/cmake/${lib_name} )
|
|
|
|
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
2019-06-20 21:18:58 +08:00
|
|
|
|
|
|
|
install(FILES ${HEADERS}
|
2019-06-22 22:39:53 +08:00
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
2019-06-20 21:18:58 +08:00
|
|
|
COMPONENT Headers)
|
|
|
|
|
2019-06-22 22:39:53 +08:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY)
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/ )
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/ RENAME "${lib_name}_LICENSE.txt" )
|
2019-11-18 22:59:06 +08:00
|
|
|
|