From 49da57393a5c5ddff1a7f60620c38858643b1220 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 18 Jan 2017 15:17:07 +0100 Subject: [core] Remove platform-specific main.cpp from MBGL_TEST_FILES --- cmake/test-files.cmake | 3 --- platform/default/mbgl/test/main.cpp | 20 ++++++++++++++++++++ platform/linux/config.cmake | 4 ++-- platform/macos/config.cmake | 4 ++-- test/src/main.cpp | 20 -------------------- 5 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 platform/default/mbgl/test/main.cpp delete mode 100644 test/src/main.cpp diff --git a/cmake/test-files.cmake b/cmake/test-files.cmake index bf908e758c..5d2b63d13f 100644 --- a/cmake/test-files.cmake +++ b/cmake/test-files.cmake @@ -43,9 +43,6 @@ set(MBGL_TEST_FILES test/sprite/sprite_image.test.cpp test/sprite/sprite_parser.test.cpp - # src - test/src/main.cpp - # src/mbgl/test test/src/mbgl/test/conversion_stubs.hpp test/src/mbgl/test/fake_file_source.hpp diff --git a/platform/default/mbgl/test/main.cpp b/platform/default/mbgl/test/main.cpp new file mode 100644 index 0000000000..d01cf75ffc --- /dev/null +++ b/platform/default/mbgl/test/main.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include + +#define xstr(s) str(s) +#define str(s) #s + +int main(int argc, char *argv[]) { +#ifdef WORK_DIRECTORY + const int result = chdir(xstr(WORK_DIRECTORY)); + if (result != 0) { + fprintf(stderr, "failed to change directory: %s\n", strerror(errno)); + return errno; + } +#endif + + return mbgl::runTests(argc, argv); +} diff --git a/platform/linux/config.cmake b/platform/linux/config.cmake index bad3751b06..5e0f07073c 100644 --- a/platform/linux/config.cmake +++ b/platform/linux/config.cmake @@ -132,11 +132,11 @@ endmacro() macro(mbgl_platform_test) target_sources(mbgl-test - PRIVATE test/src/main.cpp + PRIVATE platform/default/mbgl/test/main.cpp ) set_source_files_properties( - test/src/main.cpp + platform/default/mbgl/test/main.cpp PROPERTIES COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}" ) diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake index 2e4b7a01b2..ced1121cca 100644 --- a/platform/macos/config.cmake +++ b/platform/macos/config.cmake @@ -111,11 +111,11 @@ endmacro() macro(mbgl_platform_test) target_sources(mbgl-test - PRIVATE test/src/main.cpp + PRIVATE platform/default/mbgl/test/main.cpp ) set_source_files_properties( - test/src/main.cpp + platform/default/mbgl/test/main.cpp PROPERTIES COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}" ) diff --git a/test/src/main.cpp b/test/src/main.cpp deleted file mode 100644 index d01cf75ffc..0000000000 --- a/test/src/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#include - -#define xstr(s) str(s) -#define str(s) #s - -int main(int argc, char *argv[]) { -#ifdef WORK_DIRECTORY - const int result = chdir(xstr(WORK_DIRECTORY)); - if (result != 0) { - fprintf(stderr, "failed to change directory: %s\n", strerror(errno)); - return errno; - } -#endif - - return mbgl::runTests(argc, argv); -} -- cgit v1.2.1