Skip to content

Commit 81d6e66

Browse files
committed
Added script for build on windows (main). free library by wsjcpp_core
1 parent d562a0f commit 81d6e66

File tree

8 files changed

+230
-77
lines changed

8 files changed

+230
-77
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ cmake_minimum_required(VERSION 3.0)
22

33
project(wsjcpp-yaml)
44

5-
include(${CMAKE_CURRENT_SOURCE_DIR}/src.wsjcpp/CMakeLists.txt)
5+
# include(${CMAKE_CURRENT_SOURCE_DIR}/src.wsjcpp/CMakeLists.txt)
66

77
set(CMAKE_CXX_STANDARD 17)
88
set(EXECUTABLE_OUTPUT_PATH ${wsjcpp-yaml_SOURCE_DIR})
99

1010
# Sources
1111

12+
set (WSJCPP_LIBRARIES "")
13+
set (WSJCPP_INCLUDE_DIRS "")
14+
set (WSJCPP_SOURCES "")
15+
1216
# include header dirs
1317
list (APPEND WSJCPP_INCLUDE_DIRS "src")
1418

msvc2015x86_build_simple.bat

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@echo off
2+
3+
endlocal
4+
setlocal enabledelayedexpansion
5+
6+
pushd %~dp0
7+
set SCRIPT_DIR=%CD%
8+
popd
9+
10+
call "%VS140COMNTOOLS%..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
11+
12+
echo ====== msbuild version ======
13+
msbuild -version
14+
echo =============================
15+
16+
echo CMake configuring...
17+
cmake -H. -Btmp\windows -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release > win-build.log 2>&1
18+
if %ERRORLEVEL% GEQ 1 (
19+
echo Failed cmake prepare configuration. Log of build look in file win-build.log
20+
EXIT /B 1
21+
)
22+
echo Done.
23+
24+
echo Building...
25+
cmake --build tmp\windows --config Release >> win-build.log 2>&1
26+
if %ERRORLEVEL% GEQ 1 (
27+
echo Failed cmake build. Log of build look in file win-build.log
28+
EXIT /B 1
29+
)
30+
echo Done.
31+
32+
endlocal

src/main.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,37 @@
22
#include <iostream>
33
#include <algorithm>
44
#include "wsjcpp_yaml.h"
5-
#include "wsjcpp_core.h"
5+
// #include "wsjcpp_core.h"
66

77
int main(int argc, char* argv[]) {
88
std::string TAG = "MAIN";
9-
WsjcppCore::initRandom();
10-
std::string appName = std::string(WSJCPP_APP_NAME);
11-
std::string appVersion = std::string(WSJCPP_APP_VERSION);
12-
std::string appLogPath = ".wsjcpp-yaml-logs";
13-
WsjcppLog::setLogDirectory(appLogPath);
14-
if (!WsjcppCore::dirExists(appLogPath)) {
15-
WsjcppCore::makeDir(appLogPath);
16-
}
9+
// WsjcppCore::initRandom();
10+
// std::string appName = std::string(WSJCPP_APP_NAME);
11+
// std::string appVersion = std::string(WSJCPP_APP_VERSION);
12+
// std::string appLogPath = ".wsjcpp-yaml-logs";
13+
// WsjcppLog::setLogDirectory(appLogPath);
14+
// if (!WsjcppCore::dirExists(appLogPath)) {
15+
// WsjcppCore::makeDir(appLogPath);
16+
// }
1717
WsjcppYaml yaml;
1818
std::string sError;
1919
std::string sFilePath = "./unit-tests.wsjcpp/data-tests/read-file/example-voiting-app/docker-compose.yml";
20+
std::cout << "Reading file " << sFilePath << "..." << std::endl;
2021
if (!yaml.loadFromFile(sFilePath, sError)) {
21-
WsjcppLog::err(TAG, "Could not read data from file: " + sError);
22+
std::cerr << "Error: " << sError.c_str() << std::endl;
23+
// WsjcppLog::err(TAG, sError);
2224
return -1;
2325
}
26+
std::cout << "Done." << std::endl;
2427

28+
std::cout << "Saving to file " << sFilePath << "..." << std::endl;
2529
if (!yaml.saveToFile(sFilePath, sError)) {
26-
WsjcppLog::err(TAG, "Could not save data to file: " + sError);
30+
std::cerr << "Could not save data to file: " << sFilePath.c_str() << std::endl << "Error: " << sError.c_str() << std::endl;
31+
// WsjcppLog::err(TAG, );
2732
return -1;
2833
}
34+
std::cout << "Done." << std::endl;
35+
2936

3037
return 0;
3138
}

0 commit comments

Comments
 (0)