From 16aae06e7992a0d60b2b0005c09993d902bbc7cd Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 4 Sep 2015 02:47:06 +0200 Subject: [PATCH] Made the build system also build the dependencies --- .ci/install-dependencies.bat | 16 ++++++++++++++++ .ci/install-dependencies.sh | 21 +++++++++++++++++++-- .ci/install-dyncall.bat | 9 --------- .ci/install-dyncall.sh | 14 -------------- .ci/install-libcsptr.sh | 14 -------------- .ci/install-pip.sh | 4 ---- .gitmodules | 6 ++++++ CMakeLists.txt | 28 +++++++++++++++++----------- appveyor.yml | 6 +----- dependencies/dyncall | 1 + dependencies/libcsptr | 1 + 11 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 .ci/install-dependencies.bat delete mode 100755 .ci/install-dyncall.bat delete mode 100755 .ci/install-dyncall.sh delete mode 100755 .ci/install-libcsptr.sh delete mode 100755 .ci/install-pip.sh create mode 100644 .gitmodules create mode 160000 dependencies/dyncall create mode 160000 dependencies/libcsptr diff --git a/.ci/install-dependencies.bat b/.ci/install-dependencies.bat new file mode 100644 index 0000000..a48d4b6 --- /dev/null +++ b/.ci/install-dependencies.bat @@ -0,0 +1,16 @@ +git submodule update --init --recursive && + +cd dependencies/dyncall && +mkdir build && cd build && + +cmake -DCMAKE_INSTALL_PREFIX=%LOCAL_INSTALL% %* .. && +make && +make install && +cd ../../../ && + +cd dependencies/libcsptr/ && +mkdir build && cd build && + +cmake -DCMAKE_INSTALL_PREFIX=%LOCAL_INSTALL% %* .. && +make && +make install diff --git a/.ci/install-dependencies.sh b/.ci/install-dependencies.sh index 20d3273..9ddd12c 100755 --- a/.ci/install-dependencies.sh +++ b/.ci/install-dependencies.sh @@ -1,4 +1,21 @@ #!/bin/sh -./.ci/install-dyncall.sh -./.ci/install-libcsptr.sh +git submodule update --init --recursive && + +( + cd dependencies/dyncall && + mkdir build && + cd $_ && + cmake -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL "$@" .. && + make && + make install +) && + +( + cd dependencies/libcsptr/ && + mkdir build && + cd $_ && + cmake -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL "$@" .. && + make && + make install +) diff --git a/.ci/install-dyncall.bat b/.ci/install-dyncall.bat deleted file mode 100755 index c983288..0000000 --- a/.ci/install-dyncall.bat +++ /dev/null @@ -1,9 +0,0 @@ -set repo="https://github.com/Snaipe/dyncall.git" -set tag="master" - -mkdir dependencies -git clone --branch %tag% --depth 1 %repo% dependencies/dyncall -cd dependencies/dyncall -mkdir build && cd build -cmake -DCMAKE_INSTALL_PREFIX=%LOCAL_INSTALL% -G "NMake Makefiles" .. -nmake diff --git a/.ci/install-dyncall.sh b/.ci/install-dyncall.sh deleted file mode 100755 index b880cbd..0000000 --- a/.ci/install-dyncall.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -repo="https://github.com/Snaipe/dyncall.git" -tag="master" - -mkdir -p dependencies -git clone --branch ${tag} --depth 1 ${repo} dependencies/dyncall && -( - cd dependencies/dyncall && - mkdir build && - cd $_ && - cmake -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL "$@" .. && - make && - make install -) diff --git a/.ci/install-libcsptr.sh b/.ci/install-libcsptr.sh deleted file mode 100755 index 088f06b..0000000 --- a/.ci/install-libcsptr.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -repo="https://github.com/Snaipe/libcsptr.git" -tag="v2.0.4" - -mkdir dependencies -git clone --branch ${tag} --depth 1 ${repo} dependencies/libcsptr && -( - cd dependencies/libcsptr && - mkdir build && - cd $_ && - cmake -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL "$@" .. && - make && - make install -) diff --git a/.ci/install-pip.sh b/.ci/install-pip.sh deleted file mode 100755 index 379cfbf..0000000 --- a/.ci/install-pip.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -curl -O https://bootstrap.pypa.io/get-pip.py -python3 get-pip.py -rm -f get-pip.py diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..06e28e8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "dependencies/libcsptr"] + path = dependencies/libcsptr + url = https://github.com/Snaipe/libcsptr.git +[submodule "dependencies/dyncall"] + path = dependencies/dyncall + url = https://github.com/Snaipe/dyncall.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 49630d4..6eeca7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,15 +2,27 @@ cmake_minimum_required(VERSION 2.8) project(Criterion C) +set(LIBCSPTR_DISABLE_TESTS ON) + +add_subdirectory(dependencies/libcsptr/ EXCLUDE_FROM_ALL) +add_subdirectory(dependencies/dyncall/ EXCLUDE_FROM_ALL) + +include_directories( + dependencies/libcsptr/include/ + dependencies/dyncall/dyncall/ +) + # Project setup & environment variables set(PROJECT_VERSION "1.3.1") set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) set(GettextTranslate_ALL 1) set(GettextTranslate_GMO_BINARY 1) -set(MODULE_DIR "${CMAKE_SOURCE_DIR}/.cmake/Modules") +set(MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/Modules") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR}) +set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS ON) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu99") if (WIN32) @@ -41,8 +53,6 @@ include(CheckLibraryExists) CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) find_package(PCRE) -find_package(Libcsptr REQUIRED) -find_package(Dyncall REQUIRED) # List sources and headers @@ -99,13 +109,13 @@ set(INTERFACE_FILES # Generate the configure file configure_file( - "${CMAKE_SOURCE_DIR}/src/config.h.in" - "${CMAKE_SOURCE_DIR}/src/config.h" + "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h" ) -include_directories(include src ${CSPTR_INCLUDE_DIRS}) +include_directories(include src) add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES}) -target_link_libraries(criterion ${CSPTR_LIBRARIES}) +target_link_libraries(criterion csptr dyncall_s) if (HAVE_CLOCK_GETTIME) target_link_libraries(criterion rt) @@ -119,10 +129,6 @@ if (LIBINTL_LIB_FOUND) target_link_libraries(criterion ${LIBINTL_LIBRARIES}) endif() -if (DYNCALL_FOUND) - target_link_libraries(criterion ${DYNCALL_LIBRARIES}) -endif() - if (COVERALLS) coveralls_setup("${SOURCE_FILES}" ${COVERALLS_UPLOAD}) endif() diff --git a/appveyor.yml b/appveyor.yml index 6e43b3e..987d728 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,11 +28,7 @@ install: # Hack to make git think it is on the tip of the repo branch - 'git checkout -B %APPVEYOR_REPO_BRANCH%' # Install dependencies - - 'bash -lc "cd $APPVEYOR_BUILD_FOLDER; .ci/install-dyncall.sh -G \"MSYS Makefiles\"; true"' - - 'bash -lc "cd $APPVEYOR_BUILD_FOLDER; .ci/install-libcsptr.sh -G \"MSYS Makefiles\"; true"' - # We need to manually make since the above command somehow crashes - - 'cd dependencies/libcsptr/build && make && make install && cd ../../../' - - 'cd dependencies/dyncall/build && make && make install && cd ../../../' + - '.ci\install-dependencies.bat' # Configure project - 'mkdir build && cd build' - 'cmake -DCMAKE_INSTALL_PREFIX=criterion-%APPVEYOR_REPO_TAG_NAME% -DCMAKE_PREFIX_PATH="%LOCAL_INSTALL%" -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -G "MSYS Makefiles" ..' diff --git a/dependencies/dyncall b/dependencies/dyncall new file mode 160000 index 0000000..68c57f6 --- /dev/null +++ b/dependencies/dyncall @@ -0,0 +1 @@ +Subproject commit 68c57f664d4fabbc5b80327fbf5661a3a5a51e06 diff --git a/dependencies/libcsptr b/dependencies/libcsptr new file mode 160000 index 0000000..a0c2444 --- /dev/null +++ b/dependencies/libcsptr @@ -0,0 +1 @@ +Subproject commit a0c2444ccc3c589f34894982cd95032a817c9482