mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-14 16:47:25 +00:00
more CMake options
- generic .gitignore entries for CMake projects - generate a pkg-config file
This commit is contained in:
parent
18c55c5dcf
commit
202f5cb7d6
26
vendor/DOtherSide/.gitignore
vendored
26
vendor/DOtherSide/.gitignore
vendored
@ -10,3 +10,29 @@ nimcache
|
||||
.idea
|
||||
*.orig
|
||||
doc
|
||||
|
||||
# libraries
|
||||
*.a
|
||||
*.so
|
||||
*.so.*
|
||||
|
||||
# CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
*_autogen
|
||||
CMakeDoxyfile.in
|
||||
CMakeDoxygenDefaults.cmake
|
||||
DOtherSide.pc
|
||||
|
||||
# binaries
|
||||
test/TestDynamicQObject
|
||||
|
||||
|
18
vendor/DOtherSide/CMakeLists.txt
vendored
18
vendor/DOtherSide/CMakeLists.txt
vendored
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(DOtherSide)
|
||||
|
||||
option(ENABLE_DOCS "Enable docs" ON)
|
||||
option(ENABLE_TESTS "Enable tests" ON)
|
||||
option(ENABLE_DYNAMIC_LIBS "Enable dynamic libraries" ON)
|
||||
option(ENABLE_STATIC_LIBS "Enable static libraries" ON)
|
||||
|
||||
# Add additional source path for cmake
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
|
||||
|
||||
@ -16,10 +21,17 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
message(STATUS "Enabling coverage")
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
add_compile_options(-g -O0 --coverage)
|
||||
add_link_options(--coverage)
|
||||
add_link_options(--coverage)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(test)
|
||||
|
||||
if(ENABLE_DOCS)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
|
14
vendor/DOtherSide/DOtherSide.pc.cmake
vendored
Normal file
14
vendor/DOtherSide/DOtherSide.pc.cmake
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
sharedlibdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: C language library for creating bindings for the Qt QML language
|
||||
Version: @DOTHERSIDE_VERSION@
|
||||
|
||||
Requires: @PC_REQUIRES@
|
||||
Libs: -L${libdir} -lDOtherSide
|
||||
Cflags: -I${includedir}
|
||||
|
48
vendor/DOtherSide/lib/CMakeLists.txt
vendored
48
vendor/DOtherSide/lib/CMakeLists.txt
vendored
@ -1,5 +1,7 @@
|
||||
project(DOtherSide)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Macro for merging common code between static and shared
|
||||
macro(add_target name type)
|
||||
find_package(Qt5 COMPONENTS Core Qml Gui Quick QuickControls2 Widgets)
|
||||
@ -38,34 +40,48 @@ macro(add_target name type)
|
||||
|
||||
target_link_libraries(${name} PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Qml Qt5::Quick)
|
||||
|
||||
# for DOtherSide.pc
|
||||
set(PC_REQUIRES "Qt5Core, Qt5Gui, Qt5Widgets, Qt5Qml, Qt5Quick")
|
||||
if (${Qt5QuickControls2_FOUND})
|
||||
target_link_libraries(${name} PRIVATE Qt5::QuickControls2)
|
||||
set(PC_REQUIRES "${PC_REQUIRES}, Qt5QuickControls2")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add shared version
|
||||
add_target(${PROJECT_NAME} SHARED)
|
||||
set(major 0)
|
||||
set(minor 6)
|
||||
set(patch 4)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
SOVERSION "${major}.${minor}"
|
||||
VERSION "${major}.${minor}.${patch}"
|
||||
)
|
||||
set(DOTHERSIDE_VERSION "${major}.${minor}.${patch}")
|
||||
|
||||
# Add shared version
|
||||
if(ENABLE_DYNAMIC_LIBS)
|
||||
add_target(${PROJECT_NAME} SHARED)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
SOVERSION "${major}.${minor}"
|
||||
VERSION "${major}.${minor}.${patch}"
|
||||
)
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif(ENABLE_DYNAMIC_LIBS)
|
||||
|
||||
# Add static version
|
||||
add_target(${PROJECT_NAME}Static STATIC)
|
||||
if(ENABLE_STATIC_LIBS)
|
||||
add_target(${PROJECT_NAME}Static STATIC)
|
||||
install(TARGETS ${PROJECT_NAME}Static
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif(ENABLE_STATIC_LIBS)
|
||||
|
||||
# Install directive for header files
|
||||
install(FILES
|
||||
include/DOtherSide/DOtherSide.h
|
||||
include/DOtherSide/DOtherSideTypes.h
|
||||
DESTINATION include/DOtherSide
|
||||
include/DOtherSide/DOtherSide.h
|
||||
include/DOtherSide/DOtherSideTypes.h
|
||||
DESTINATION include/DOtherSide
|
||||
)
|
||||
|
||||
# Install directive for binaries
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
# pkg-config file
|
||||
configure_file(${CMAKE_SOURCE_DIR}/DOtherSide.pc.cmake ${CMAKE_BINARY_DIR}/DOtherSide.pc @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/DOtherSide.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user