Fixed build of samples (now use CMake).
This commit is contained in:
parent
29954e5e50
commit
4569075951
9
.gitignore
vendored
9
.gitignore
vendored
@ -13,10 +13,10 @@ doc/html/*
|
||||
/run-tests
|
||||
|
||||
# CMake-generated / Build files
|
||||
/CMakeFiles/
|
||||
/CMakeCache.txt
|
||||
CMakeFiles/
|
||||
CMakeCache.txt
|
||||
/_CPack_Packages/
|
||||
/cmake_install.cmake
|
||||
cmake_install.cmake
|
||||
/CPackConfig.cmake
|
||||
/CPackSourceConfig.cmake
|
||||
/Doxyfile
|
||||
@ -28,7 +28,8 @@ doc/html/*
|
||||
/vmime/export-static.hpp
|
||||
/vmime/export-shared.hpp
|
||||
/COPYING.txt
|
||||
/build/
|
||||
build/
|
||||
Makefile
|
||||
|
||||
# Outsourced build test
|
||||
/_build/
|
||||
|
11
.travis.yml
11
.travis.yml
@ -9,15 +9,20 @@ compiler:
|
||||
|
||||
# Settings
|
||||
env:
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON"
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON -DVMIME_CHARSETCONV_LIB_IS_ICONV=OFF -DVMIME_CHARSETCONV_LIB_IS_ICU=ON"
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON -DVMIME_TLS_SUPPORT_LIB_IS_GNUTLS=OFF -DVMIME_TLS_SUPPORT_LIB_IS_OPENSSL=ON"
|
||||
# -- default configuration (iconv + GnuTLS)
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON -DVMIME_BUILD_SAMPLES=ON"
|
||||
# -- ICU
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON -DVMIME_BUILD_SAMPLES=ON -DVMIME_CHARSETCONV_LIB_IS_ICONV=OFF -DVMIME_CHARSETCONV_LIB_IS_ICU=ON"
|
||||
# -- OpenSSL
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 OPTIONS="-DVMIME_SENDMAIL_PATH=/path/to/sendmail -DCMAKE_BUILD_TYPE=Debug -DVMIME_BUILD_TESTS=ON -DVMIME_BUILD_SAMPLES=ON -DVMIME_TLS_SUPPORT_LIB_IS_GNUTLS=OFF -DVMIME_TLS_SUPPORT_LIB_IS_OPENSSL=ON"
|
||||
|
||||
# Make sure some required tools/libraries are installed
|
||||
install:
|
||||
- sudo apt-get update >/dev/null
|
||||
- sudo apt-get -q install cmake libcppunit-dev valgrind
|
||||
- sudo apt-get -q install libgsasl7-dev libgnutls-dev libssl-dev libicu-dev
|
||||
# -- for the samples
|
||||
- sudo apt-get -q install libgtk-3-dev
|
||||
|
||||
# Run the build script
|
||||
script:
|
||||
|
@ -329,6 +329,20 @@ IF(VMIME_BUILD_TESTS)
|
||||
ENDIF()
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Examples
|
||||
|
||||
OPTION(
|
||||
VMIME_BUILD_SAMPLES
|
||||
"Build samples (in 'examples' directory)"
|
||||
ON
|
||||
)
|
||||
|
||||
IF(VMIME_BUILD_SAMPLES)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ENDIF()
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Packaging / Distribution
|
||||
|
||||
|
1
examples/.gitignore
vendored
1
examples/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/example[0-9]
|
38
examples/CMakeLists.txt
Normal file
38
examples/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
IF(VMIME_BUILD_SAMPLES)
|
||||
|
||||
ADD_SUBDIRECTORY(viewer)
|
||||
|
||||
FILE(
|
||||
GLOB
|
||||
VMIME_SAMPLES_SRC_FILES
|
||||
${CMAKE_SOURCE_DIR}/examples/*.cpp
|
||||
)
|
||||
|
||||
# Build one file for each sample
|
||||
FOREACH(VMIME_SAMPLE_SRC_FILE ${VMIME_SAMPLES_SRC_FILES})
|
||||
|
||||
GET_FILENAME_COMPONENT(VMIME_SAMPLE_NAME "${VMIME_SAMPLE_SRC_FILE}" NAME_WE)
|
||||
|
||||
ADD_EXECUTABLE(
|
||||
${VMIME_SAMPLE_NAME}
|
||||
${VMIME_SAMPLE_SRC_FILE}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
${VMIME_SAMPLE_NAME}
|
||||
${VMIME_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
ADD_DEPENDENCIES(
|
||||
${VMIME_SAMPLE_NAME}
|
||||
${VMIME_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
ENDFOREACH()
|
||||
|
||||
ELSE()
|
||||
|
||||
MESSAGE(FATAL_ERROR "Examples are not to be built (set VMIME_BUILD_SAMPLES to YES.")
|
||||
|
||||
ENDIF()
|
@ -1,8 +0,0 @@
|
||||
all: example1 example6
|
||||
|
||||
example1: example1.cpp ../libvmime-debug.a
|
||||
g++-mp-4.8 -o example1 example1.cpp -I.. ../libvmime-debug.a -L /opt/local/lib -lgnutls -lgsasl -liconv
|
||||
|
||||
example6: example6.cpp ../libvmime-debug.a
|
||||
g++-mp-4.8 -o example6 example6.cpp -I.. ../libvmime-debug.a -L /opt/local/lib -lgnutls -lgsasl -liconv
|
||||
|
31
examples/viewer/CMakeLists.txt
Normal file
31
examples/viewer/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
IF(VMIME_BUILD_SAMPLES)
|
||||
|
||||
FIND_PACKAGE(PkgConfig REQUIRED)
|
||||
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
|
||||
|
||||
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
|
||||
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
|
||||
|
||||
ADD_EXECUTABLE(
|
||||
viewer
|
||||
viewer.cpp
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
viewer
|
||||
${VMIME_LIBRARY_NAME}
|
||||
${GTK3_LIBRARIES}
|
||||
)
|
||||
|
||||
ADD_DEPENDENCIES(
|
||||
viewer
|
||||
${VMIME_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
ELSE()
|
||||
|
||||
MESSAGE(FATAL_ERROR "Examples are not to be built (set VMIME_BUILD_SAMPLES to YES.")
|
||||
|
||||
ENDIF()
|
@ -1,18 +0,0 @@
|
||||
|
||||
COMPILER=g++
|
||||
CFLAGS=-g -I ../.. `pkg-config --cflags gtk+-2.0`
|
||||
LDFLAGS=-I ../.. `pkg-config --libs gtk+-2.0` -lgnutls -lgsasl
|
||||
|
||||
|
||||
viewer: viewer.o ../../libvmime-debug.a
|
||||
$(COMPILER) $(LDFLAGS) -o viewer viewer.o ../../libvmime-debug.a
|
||||
|
||||
viewer.o: viewer.cpp
|
||||
$(COMPILER) $(CFLAGS) -c -o viewer.o viewer.cpp
|
||||
|
||||
../../libvmime-debug.a:
|
||||
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo "! You must build VMime library before compiling the example !"
|
||||
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@false
|
||||
|
@ -52,14 +52,14 @@ vmime::ref <vmime::message> currentMessage = NULL;
|
||||
|
||||
|
||||
|
||||
void insertRowInModel(GtkTreeStore* model, vmime::ref <const vmime::component> comp, GtkTreeIter* parent = NULL)
|
||||
void insertRowInModel(GtkTreeStore* model, vmime::ref <vmime::component> comp, GtkTreeIter* parent = NULL)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_tree_store_append(model, &iter, parent);
|
||||
gtk_tree_store_set(model, &iter, 0, typeid(*comp).name(), 1, comp.get(), -1);
|
||||
|
||||
const std::vector <vmime::ref <const vmime::component> > children = comp->getChildComponents();
|
||||
const std::vector <vmime::ref <vmime::component> > children = comp->getChildComponents();
|
||||
|
||||
for (int i = 0 ; i < children.size() ; ++i)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ cd _build
|
||||
rm -f ../CMakeCache.txt ../vmime/config.hpp ../vmime/export-static.hpp ../vmime/export-shared.hpp
|
||||
#cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_SHARED_LIBRARY=NO
|
||||
#cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES -DVMIME_TLS_SUPPORT_LIB_IS_OPENSSL=ON -DVMIME_TLS_SUPPORT_LIB_IS_GNUTLS=OFF -DCMAKE_BUILD_TYPE=Release
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES -DVMIME_BUILD_SAMPLES=YES -DVMIME_TLS_SUPPORT_LIB_IS_OPENSSL=ON -DVMIME_TLS_SUPPORT_LIB_IS_GNUTLS=OFF -DCMAKE_BUILD_TYPE=Release
|
||||
cmake .. -L
|
||||
make
|
||||
make install
|
||||
|
Loading…
Reference in New Issue
Block a user