File tree Expand file tree Collapse file tree 4 files changed +119
-8
lines changed
Expand file tree Collapse file tree 4 files changed +119
-8
lines changed Original file line number Diff line number Diff line change 1+ . *
2+ * ~
3+ ! /.gitignore
4+ ! /.travis.yml
5+ * .exe
6+ * .tar.gz
7+ * .zip
8+ * .obj
9+ * .lib
10+ * .o
11+ * .pc
12+ * .dSYM
13+ CMakeCache.txt
14+ CMakeFiles
15+ CMakeScripts
16+ Makefile
17+ cmake_install.cmake
18+ install_manifest.txt
19+ CTestTestfile.cmake
20+ /primesieve *
21+ /libprimesieve *
22+ doc /Doxyfile
23+ doc /html
24+ doc /latex
25+ build
Original file line number Diff line number Diff line change 1+ # Test configuration for Travis CI. See <https://travis-ci.org/>.
2+ language : cpp
3+
4+ branches :
5+ except :
6+ - gh-pages
7+
8+ compiler :
9+ - gcc
10+ - clang
11+
12+ os :
13+ - linux
14+
15+ addons :
16+ apt :
17+ sources :
18+ - ubuntu-toolchain-r-test
19+ packages :
20+ - gcc-4.9
21+ - g++-4.9
22+
23+ install :
24+ - sudo apt-get install -y ninja-build cppcheck doxygen help2man texlive texlive-latex-extra graphviz libqt4-dev qt4-qmake valgrind
25+ - wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz
26+ - tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz
27+ - export CXXFLAGS="-Wall -Wextra -Werror -Wno-long-long -pedantic -O2"
28+ - export PATH=$PWD/cmake-3.1.3-Linux-x86_64/bin:$PATH
29+ - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9"; fi
30+ - if [ "$CC" = "gcc" ]; then export CC="gcc-4.9"; fi
31+
32+ script :
33+ # 1) Build using GNU make
34+ - mkdir build
35+ - cd build
36+ - cmake -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DBUILD_DOC=ON -DCMAKE_INSTALL_PREFIX=$(pwd) ..
37+ - make -j4
38+ - make doc >/dev/null
39+ - make install
40+ - cd ..
41+ - rm -rf build
42+ # 2) Build primesieve GUI app
43+ - cd src/gui
44+ - qmake QMAKE_CXX=$CXX QMAKE_CC=$CC
45+ - make -j4
46+ - cd ../..
47+ # 3) Build using ninja
48+ - mkdir build
49+ - cd build
50+ - cmake -GNinja -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DBUILD_DOC=ON ..
51+ - ninja
52+ - ninja doc >/dev/null
53+ # 4) Run integration tests
54+ - ninja test
55+ - test/cpu_info
56+ - test/atomic
57+ - cd ..
58+ # 5) Test using valgrind
59+ - $CXX -Iinclude -O2 -std=c++11 -g examples/cpp/nth_prime.cpp -o nth_prime build/libprimesieve.a -lpthread
60+ - valgrind --error-exitcode=1 ./nth_prime 500000000
61+ # 6) Test using cppcheck
62+ - rm -rf build
63+ - cppcheck . -q --error-exitcode=1 -icmake-3.1.3-Linux-x86_64 -iexamples/cpp/prev_prime.cpp -iexamples/cpp/primesieve_iterator.cpp -itest/next_prime1.cpp -itest/prev_prime1.cpp
Original file line number Diff line number Diff line change @@ -59,31 +59,49 @@ endif()
5959
6060# Check if libatomic is needed #######################################
6161
62+ include (CMakePushCheckState)
6263include (CheckCXXSourceCompiles)
6364
64- set (CMAKE_OLD_FLAGS ${CMAKE_REQUIRED_FLAGS} )
65+ cmake_push_check_state( )
6566set (CMAKE_REQUIRED_FLAGS ${CMAKE_CXX11_STANDARD_COMPILE_OPTION} )
6667
6768check_cxx_source_compiles("
6869 #include <atomic>
70+ #include <stdint.h>
6971 int main() {
70- std::atomic<int > x;
72+ std::atomic<int64_t > x;
7173 x = 1;
7274 x--;
73- return x;
75+ return (int) x;
7476 }"
75- have_atomic )
77+ atomic64 )
7678
77- set (CMAKE_REQUIRED_FLAGS ${CMAKE_OLD_FLAGS} )
79+ if (NOT atomic64)
80+ find_library (ATOMIC NAMES atomic libatomic.so.1)
7881
79- if (NOT have_atomic)
80- find_library (ATOMIC NAMES atomic libatomic.so libatomic.so.1)
8182 if (ATOMIC)
8283 set (LIBATOMIC ${ATOMIC} )
83- message (STATUS "Found libatomic: TRUE" )
84+ message (STATUS "Found libatomic: ${LIBATOMIC} " )
85+ else ()
86+ check_cxx_source_compiles("
87+ #include <atomic>
88+ #include <stdint.h>
89+ int main() {
90+ std::atomic<int32_t> x;
91+ x = 1;
92+ x--;
93+ return (int) x;
94+ }"
95+ atomic32)
96+
97+ if (atomic32)
98+ message (FATAL_ERROR "Failed to find libatomic!" )
99+ endif ()
84100 endif ()
85101endif ()
86102
103+ cmake_pop_check_state()
104+
87105# libprimesieve ######################################################
88106
89107add_library (libprimesieve ${LIB_SRC} )
Original file line number Diff line number Diff line change 1+ Changes in version 6.4, 25/11/2017
2+ ==================================
3+
4+ * CMakeLists.txt: Fix libatomic detection.
5+
16Changes in version 6.3, 12/11/2017
27==================================
38
You can’t perform that action at this time.
0 commit comments