Merge pull request #18 from RWTH-ACS/cmake-package

Change CMake to build Arabica as a shared library, install and package the libary
This commit is contained in:
Jez Higgins 2017-11-28 10:29:49 +00:00 committed by GitHub
commit ac45b99720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 216 additions and 103 deletions

View file

@ -1,42 +1,51 @@
libtool
config.log
config.status
configure
autom4te.cache
Makefile
Makefile.in
.deps
aclocal.m4
arabica.pc
include/SAX/ArabicaConfig.hpp
include/SAX/ArabicaConfig.hpp.in
include/SAX/stamp-h1
tests/XSLT/test_path.hpp
*.exe
*.lo
*.la
.libs
config.cache
vs9\*.user
*.ncb
*.suo
*/Debug*
*/Release*
*.o
*~
*.tar.gz
*.tar.bz2
*.zip
*.ilk
*.pdb
*.exp
*.lib
*.bsc
lib
*.tar.gz
*.tar.bz2
*.zip
vs9/mangle.sln
vs10/mangle.sln
*.stackdump
*.exe
*.lo
*.la
*.ncb
*.suo
*.lnk
spec
gmon.out
*.dll
*.log
*.trs
*.sdf
*.opensdf
*.DS_Store*
lib
doc/html
.libs
.deps
.dirstamp
arabica.pc
include/SAX/ArabicaConfig.hpp
include/SAX/stamp-h1
tests/XSLT/test_path.hpp
*/Debug*
*/Release*
# IDE files
vs9/mangle.sln
vs9/*.user
vs10/mangle.sln
*.vcxproj.filters
*.vcxproj.user
.idea
# Examples
examples/DOM/dom2pyx
examples/DOM/domwriter
examples/SAX/pyx
@ -53,12 +62,42 @@ tests/DOM/dom_test*
tests/XPath/xpath_test*
tests/Taggle/taggle_test
tests/Utils/utils_test*
tests/XSLT/xslt_test
tests/XSLT/xslt_test*
bin/mandelbrot-*.html
doc/html
# Autoconf
m4/lt~obsolete.m4
*.vcxproj.filters
*.vcxproj.user
*.sdf
m4/ltversion.m4
m4/ltsugar.m4
m4/ltoptions.m4
m4/libtool.m4
test-driver
libtool
ltmain.sh
config.log
config.status
config.cache
configure
compile
autom4te.cache
missing
Makefile
Makefile.in
aclocal.m4
# CMake
CMakeCache.txt
CMakeFiles
CMakeFiles/*
cmake_install.cmake
build/*
cmake-build-debug/
# Misc
*.stackdump
spec
gmon.out
ipch
test_path.hpp

110
.gitignore vendored
View file

@ -1,51 +1,51 @@
*.o
*~
libtool
ltmain.sh
config.log
config.status
configure
compile
autom4te.cache
missing
test-driver
Makefile
Makefile.in
.deps
.dirstamp
aclocal.m4
arabica.pc
include/SAX/ArabicaConfig.hpp
include/SAX/stamp-h1
tests/XSLT/test_path.hpp
*.exe
*.lo
*.la
.libs
config.cache
vs9\*.user
*.ncb
*.suo
*/Debug*
*/Release*
*.tar.gz
*.tar.bz2
*.zip
*.ilk
*.pdb
*.exp
*.lib
*.bsc
lib
*.tar.gz
*.tar.bz2
*.zip
vs9/mangle.sln
vs10/mangle.sln
*.stackdump
*.exe
*.lo
*.la
*.ncb
*.suo
*.lnk
*.dll
spec
gmon.out
*.log
*.trs
*.sdf
*.opensdf
*.DS_Store*
lib
doc/html
.libs
.deps
.dirstamp
arabica.pc
include/SAX/ArabicaConfig.hpp
include/SAX/stamp-h1
tests/XSLT/test_path.hpp
*/Debug*
*/Release*
# IDE files
vs9/mangle.sln
vs9/*.user
vs10/mangle.sln
*.vcxproj.filters
*.vcxproj.user
.idea
# Examples
examples/DOM/dom2pyx
examples/DOM/domwriter
examples/SAX/pyx
@ -64,24 +64,40 @@ tests/Taggle/taggle_test
tests/Utils/utils_test*
tests/XSLT/xslt_test*
bin/mandelbrot-*.html
doc/html
# Autoconf
m4/lt~obsolete.m4
m4/ltversion.m4
m4/ltsugar.m4
m4/ltoptions.m4
m4/libtool.m4
*.vcxproj.filters
*.vcxproj.user
*.sdf
ipch
test_path.hpp
*.opensdf
test-driver
libtool
ltmain.sh
config.log
config.status
config.cache
configure
compile
autom4te.cache
missing
Makefile
Makefile.in
aclocal.m4
# CMake
CMakeCache.txt
CMakeFiles
CMakeFiles/*
cmake_install.cmake
build/*
*.DS_Store*
compile
test-driver
cmake-build-debug/
# Misc
*.stackdump
spec
gmon.out
ipch
test_path.hpp

View file

@ -3,11 +3,46 @@
# author: Gunther Laure
#
cmake_minimum_required (VERSION 3.6)
cmake_minimum_required(VERSION 3.5)
project(arabica)
set(LIBNAME arabica)
# Enable C++11 support
set(CMAKE_CXX_STANDARD 11)
set(LIB_NAME arabica)
set(ARABICA_MAJOR_VERSION 2016)
set(ARABICA_MINOR_VERSION January)
#
# Packaging details
#
set(CPACK_PACKAGE_NAME "libarabica")
set(CPACK_PACKAGE_VENDOR "Jez Higgins <jez@jezuk.co.uk>")
set(CPACK_PACKAGE_CONTACT "Steffen Vogel <post@steffenvogel.de>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Arabica is an XML and HTML processing toolkit, providing SAX2, DOM, XPath, and XSLT implementations, written in Standard C++")
set(CPACK_PACKAGE_VERSION_MAJOR ${ARABICA_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${ARABICA_MINOR_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libexpat1")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/jezhiggins/arabica")
set(CPACK_RPM_PACKAGE_LICENSE "BSD 3-clause")
set(CPACK_RPM_PACKAGE_URL "https://github.com/jezhiggins/arabica")
set(CPACK_RPM_PACKAGE_REQUIRES "expat")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set(CPACK_GENERATOR "TGZ;DEB;RPM")
#
# Build as shared library
#
option(BUILD_SHARED_LIBS "Build as shared libaries" OFF)
#
# Enable/Disable example build
@ -30,6 +65,8 @@ if(WIN32)
if(MSVC_VERSION LESS 1300)
set(ARABICA_VS6_WORKAROUND TRUE)
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
if(BUILD_WITH_BOOST)
@ -38,8 +75,7 @@ endif()
#
# Enable target folders in Visual Studio and other IDEs
set_property(GLOBAL
PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#
# Set the used xml backend
@ -107,9 +143,9 @@ endif()
if(BUILD_ARABICA_EXAMPLES)
message(STATUS "Building ${LIBNAME} with ${ARABICA_XML_BACKEND} compile flag with examples")
message(STATUS "Building ${LIB_NAME} with ${ARABICA_XML_BACKEND} compile flag with examples")
else()
message(STATUS "Building ${LIBNAME} with ${ARABICA_XML_BACKEND} compile flag library only")
message(STATUS "Building ${LIB_NAME} with ${ARABICA_XML_BACKEND} compile flag library only")
endif()
@ -383,23 +419,23 @@ set(SOURCE_FILES
source_group("Source Files" FILES ${SOURCE_FILES})
add_library (${LIBNAME} STATIC
add_library (${LIB_NAME}
${GENERATED_HEADER_FILES}
${PUBLIC_HEADER_FILES}
${SOURCE_FILES}
)
target_compile_definitions(${LIBNAME} PUBLIC "$<$<CONFIG:Debug>:ARABICA_DEBUG>")
target_compile_definitions(${LIBNAME} PUBLIC ARABICA_NOT_USE_PRAGMA_LINKER_OPTIONS)
target_include_directories(${LIBNAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
target_include_directories(${LIBNAME} PUBLIC ${ADDITIONAL_INC} ${Boost_INCLUDE_DIRS})
target_include_directories(${LIBNAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
target_compile_definitions(${LIB_NAME} PUBLIC "$<$<CONFIG:Debug>:ARABICA_DEBUG>")
target_compile_definitions(${LIB_NAME} PUBLIC ARABICA_NOT_USE_PRAGMA_LINKER_OPTIONS)
target_include_directories(${LIB_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
target_include_directories(${LIB_NAME} PUBLIC ${ADDITIONAL_INC} ${Boost_INCLUDE_DIRS})
target_include_directories(${LIB_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
# link backend
target_link_libraries(${LIBNAME} ${ADDITIONAL_LIB})
target_link_libraries(${LIB_NAME} ${ADDITIONAL_LIB})
# VS2010 bug for 64bit builds
if(MSVC)
if(BUILD_X64)
set_property(TARGET ${LIBNAME}
set_property(TARGET ${LIB_NAME}
APPEND
PROPERTY STATIC_LIBRARY_FLAGS
/MACHINE:X64
@ -410,7 +446,7 @@ endif()
if(MSVC)
# link socket library in windows
target_link_libraries(${LIBNAME}
target_link_libraries(${LIB_NAME}
ws2_32.lib
)
endif()
@ -419,11 +455,30 @@ endif()
#
# Add build dependency to boost if boost is part of the same project
if(TARGET boost)
add_dependencies(${LIBNAME} boost)
add_dependencies(${LIB_NAME} boost)
endif()
set_target_properties(${LIBNAME} PROPERTIES FOLDER "3rdparty/arabica")
set_target_properties(${LIB_NAME} PROPERTIES FOLDER "3rdparty/arabica")
#
# Install library
#
install(TARGETS ${LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)
install(DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING
PATTERN *.hpp
PATTERN *.h
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/SAX/ArabicaConfig.hpp
DESTINATION include/${PROJECT_NAME}/SAX
)
if(BUILD_ARABICA_EXAMPLES)
@ -525,3 +580,6 @@ if(BUILD_ARABICA_EXAMPLES)
set_target_properties(${EXAMPLE_NAME} PROPERTIES FOLDER "3rdparty/arabica_examples")
endif()
include(CPack)