Skip to content

Commit d548e0f

Browse files
committed
Fixed Tests, added steps to build the executable
1 parent 74fbc2a commit d548e0f

File tree

6 files changed

+35
-18
lines changed

6 files changed

+35
-18
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
vagrant/packages/*.zip
2-
vagrant/.vagrant
2+
vagrant/.vagrant
3+
test/build
4+
test/*.json

test/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)
22

33
project(winetest CXX)
44
set(PROJECT_VERSION 1.0.0)
55

66
add_executable(${PROJECT_NAME} test.cpp)
77

8-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
9-
conan_basic_setup(TARGETS)
10-
118
set_target_properties(${MODULE_NAME_TEST} PROPERTIES CXX_STANDARD 17)
129
set_target_properties(${MODULE_NAME_TEST} PROPERTIES CXX_STANDARD_REQUIRED ON)
1310
set_target_properties(${MODULE_NAME_TEST} PROPERTIES CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /GL /Yu")

test/build.bat

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,16 @@
22

33
setlocal
44
cd /d %~dp0
5-
conan export . test/wine
6-
conan install winetest/1.0.0@test/wine --build
5+
md build
6+
cd build
7+
8+
REM Perform Conan Setup
9+
conan export --name winetest ..
10+
conan install --name winetest --no-remote --output-folder . --build=missing ..
11+
12+
REM Build with CMake
13+
cmake --preset conan-release ..
14+
cmake --build --preset conan-release
15+
16+
REM Run the Application
17+
winetest.exe

test/conanfile.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from conans import ConanFile, tools, CMake
1+
from conan import ConanFile
2+
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
3+
from conan.tools.files import copy
24
from conans.errors import NotFoundException
35
import os
46

@@ -8,23 +10,28 @@ class WineTestConan(ConanFile):
810
description = "Test for Wine"
911
# topics can get used for searches, GitHub topics, Bintray tags etc. Add here keywords about the library
1012
topics = ("wine", "test", "msvc")
11-
url = ""
12-
homepage = ""
13+
url = "https://github.com/madduci/docker-msvc-cpp"
14+
homepage = "https://github.com/madduci/docker-msvc-cpp"
1315
author = "Michele Adduci <adduci@tutanota.com>"
14-
license = "" # Indicates license type of the packaged library; please use SPDX Identifiers https://spdx.org/licenses/
16+
license = "MIT"
1517
exports_sources = ["CMakeLists.txt", "test.cpp"]
16-
generators = "cmake"
1718
short_paths = True
1819
settings = "os", "arch", "compiler", "build_type"
1920
# Custom attributes for Bincrafters recipe conventions
2021
_source_subfolder = "source_subfolder"
2122
_build_subfolder = "build_subfolder"
2223

24+
def generate(self):
25+
tc = CMakeToolchain(self)
26+
tc.variables["PROJECT_VERSION"] = self.version
27+
tc.generate()
28+
deps = CMakeDeps(self)
29+
deps.generate()
30+
2331
def build(self):
2432
cmake = CMake(self)
2533
cmake.configure()
2634
cmake.build()
27-
self.run('cmake --build . --target package')
2835

2936
def package(self):
3037
# If the CMakeLists.txt has a proper install method, the steps below may be redundant

test/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
docker run --rm -it -v $(pwd):/home/wine/.wine/drive_c/project docker-wine-msvc:16.9-2019 ""C:/project/build.bat""
3+
docker run --rm -it -v $(pwd):/home/wine/.wine/drive_c/project madduci/docker-wine-msvc:17.8-2022 ""C:/project/build.bat""

test/test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
int main()
44
{
5-
#ifdef _WIN64
6-
std::cout << "Hello from MSVC Wine 64!\n";
7-
#else
5+
#ifdef _WIN64
6+
std::cout << "Hello from MSVC Wine 64!\n";
7+
#else
88
std::cout << "Hello from MSVC Wine 32!\n";
99
#endif
10-
return 0;
10+
return 0;
1111
}

0 commit comments

Comments
 (0)