Fixes for Windows CI build.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-01-01 19:59:47 +01:00
parent 7384bf6e98
commit 4d0da20e31
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 23 additions and 14 deletions

View File

@ -54,8 +54,9 @@ steps:
- update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix - update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
- update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix - update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
- update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix - update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -D CMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc -D CMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++ -DWINDOWS=ON - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -DWINDOWS=ON
- conan install . --install=folder=build-release-windows --build missing -s os_build=Linux -s arch_build=x86_64 -s os=Windows -s arch=x86_64 -s compiler=gcc -s compiler.version=7.3 -s compiler.libcxx=libstdc++11 -s build_type=Release
- cmake --build build-release-windows --target all -- -j 4 - cmake --build build-release-windows --target all -- -j 4
- cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /home/build/build-release-windows/bin/
- cp /home/build/build-release-windows/lib/libpkmnLib.so /home/build/build-release-windows/bin/
- export WINEARCH=win64 - export WINEARCH=win64
- wine build-release-windows/bin/pkmnLibTests.exe -s - wine build-release-windows/bin/pkmnLibTests.exe -s

View File

@ -9,10 +9,12 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (WINDOWS) if (WINDOWS)
SET(CMAKE_SYSTEM_NAME Windows)
ADD_DEFINITIONS(-D WINDOWS=1) ADD_DEFINITIONS(-D WINDOWS=1)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
endif(WINDOWS) endif(WINDOWS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
message(STATUS "Using: message(STATUS "Using:
\t C ${CMAKE_C_COMPILER} \t C ${CMAKE_C_COMPILER}
@ -20,7 +22,6 @@ message(STATUS "Using:
\t CXX ABI ${CMAKE_CXX_COMPILER_ABI} \t CXX ABI ${CMAKE_CXX_COMPILER_ABI}
\t C++ Version ${CMAKE_CXX_STANDARD}") \t C++ Version ${CMAKE_CXX_STANDARD}")
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.") message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}") string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}")
@ -30,32 +31,35 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
SET(VERSION ${VERSION}.${MINOR}) SET(VERSION ${VERSION}.${MINOR})
endif() endif()
if (NOT WINDOWS) if (NOT WINDOWS)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION}) execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION})
else() else()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION}) execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows)
endif() endif()
endif () endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup() conan_basic_setup()
message(STATUS "Using Conan Libs:")
foreach (_conanLib ${CONAN_LIBS})
message(STATUS "\t ${_conanLib}")
endforeach()
# Create Core library with files in src/Core # Create Core library with files in src/Core
file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp") file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(pkmnLib SHARED ${CORE_SRC_FILES}) add_library(pkmnLib SHARED ${CORE_SRC_FILES})
foreach (_variableName ${CONAN_LIBS})
message(STATUS "Lib: ${_variableName}")
endforeach()
SET(_LINKS ${CONAN_LIBS}) SET(_LINKS ${CONAN_LIBS})
SET(_TESTLINKS pkmnLib ${CONAN_LIBS}) SET(_TESTLINKS pkmnLib ${CONAN_LIBS})
if (WINDOWS) if (WINDOWS)
message(STATUS "Using Windows build.") message(STATUS "Using Windows build.")
set(CMAKE_CXX_FLAGS "-L ${CMAKE_BINARY_DIR}/bin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows. # Statically link libraries we need in Windows.
SET(_LINKS -static -static-libgcc -static-libstdc++ ${_LINKS}) SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++)
SET(_TESTLINKS -static -static-libgcc -static-libstdc++ ${_TESTLINKS}) SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++)
endif (WINDOWS) endif (WINDOWS)

View File

@ -6,13 +6,13 @@ class PkmnLibConan(ConanFile):
license = "TODO" license = "TODO"
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib" url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures." description = "The core implementation for turn based battling using creatures."
settings = "compiler" settings = "os", "compiler"
options = {"shared": [True, False]} options = {"shared": [True, False]}
default_options = {"shared": True} default_options = {"shared": True}
generators = "cmake" generators = "cmake"
exports_sources = "*" exports_sources = "*"
compiler = "clang" compiler = "clang"
requires = "CreatureLib/db2eb0c3fa5d67b14c84b118cd2f69bbd209ddb9@creaturelib/master" requires = "CreatureLib/6e498429f9afaf2184efd7441e79f76e3cdf376d@creaturelib/master"
def build(self): def build(self):
cmake = CMake(self) cmake = CMake(self)
@ -30,3 +30,7 @@ class PkmnLibConan(ConanFile):
self.copy("*.dylib*", dst="lib", keep_path=False) self.copy("*.dylib*", dst="lib", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False) self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False) self.copy("*.a", dst="lib", keep_path=False)
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", "bin", "bin")