Create bat for test exe

This commit is contained in:
John Zhao
2018-04-25 11:32:54 +08:00
parent 9cf58f6e70
commit f766f2df22
5 changed files with 82 additions and 24 deletions

View File

@@ -21,6 +21,20 @@ include(${PRO_DIR}/cmake/DetectCXX11.cmake)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
#if(OS_WIN AND NOT MINGW)
# set(CompilerFlags
# CMAKE_CXX_FLAGS
# CMAKE_CXX_FLAGS_DEBUG
# CMAKE_CXX_FLAGS_RELEASE
# CMAKE_C_FLAGS
# CMAKE_C_FLAGS_DEBUG
# CMAKE_C_FLAGS_RELEASE
# )
# foreach(CompilerFlag ${CompilerFlags})
# string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
# endforeach()
#endif()
string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
message(STATUS "C_FLAGS: ${CMAKE_C_FLAGS}")
@@ -80,6 +94,9 @@ add_executable(${PROJECT_NAME}
${TEST_PUBLIC_SRC}
)
target_link_libraries(${PROJECT_NAME} ${GTEST_LIBS} mynteye)
target_create_scripts(${PROJECT_NAME} DLL_SEARCH_PATHS
${PRO_DIR}/_install/bin
)
if(OS_WIN)
target_compile_definitions(${PROJECT_NAME}

View File

@@ -1,31 +1,10 @@
#include "gtest/gtest.h"
#include <stdio.h>
#include "glog/logging.h"
struct glog_init {
glog_init(int /*argc*/, char *argv[]) {
// FLAGS_logtostderr = true;
FLAGS_alsologtostderr = true;
FLAGS_colorlogtostderr = true;
#include "gtest/gtest.h"
FLAGS_log_dir = ".";
FLAGS_max_log_size = 1024;
FLAGS_stop_logging_if_full_disk = true;
#include "mynteye/glog_init.h"
// FLAGS_v = 2;
google::InitGoogleLogging(argv[0]);
VLOG(2) << __func__;
}
~glog_init() {
VLOG(2) << __func__;
google::ShutdownGoogleLogging();
}
};
GTEST_API_ int main(int argc, char **argv) {
int main(int argc, char **argv) {
glog_init _(argc, argv);
printf("Running main() from gtest_main.cc\n");