Fix MSVC support
This commit is contained in:
parent
098345409f
commit
f1a1c2199f
@ -44,6 +44,7 @@ include(CheckCSourceCompiles)
|
|||||||
find_package(SFML REQUIRED)
|
find_package(SFML REQUIRED)
|
||||||
include_directories(sfml::sfml)
|
include_directories(sfml::sfml)
|
||||||
include_directories("3rdParty")
|
include_directories("3rdParty")
|
||||||
|
list(APPEND EXTLIBS "sfml::sfml")
|
||||||
|
|
||||||
# define src/headers files groups
|
# define src/headers files groups
|
||||||
include(srcs.list)
|
include(srcs.list)
|
||||||
@ -55,6 +56,11 @@ endif()
|
|||||||
|
|
||||||
# targets declarations
|
# targets declarations
|
||||||
add_executable(${PROJECT_NAME})
|
add_executable(${PROJECT_NAME})
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
OUTPUT_NAME ${PROJECT_NAME}${BUILDNAME_SUFFIX}
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
)
|
||||||
target_precompile_headers(${PROJECT_NAME} PRIVATE
|
target_precompile_headers(${PROJECT_NAME} PRIVATE
|
||||||
"$<$<COMPILE_LANGUAGE:CXX>:<string$<ANGLE-R>>"
|
"$<$<COMPILE_LANGUAGE:CXX>:<string$<ANGLE-R>>"
|
||||||
"$<$<COMPILE_LANGUAGE:CXX>:<stdexcept$<ANGLE-R>>"
|
"$<$<COMPILE_LANGUAGE:CXX>:<stdexcept$<ANGLE-R>>"
|
||||||
@ -70,22 +76,8 @@ target_sources(${PROJECT_NAME} PRIVATE
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Engine/Utils/3DMaths_mat.inl"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Engine/Utils/3DMaths_mat.inl"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Engine/Utils/3DMaths_bs.inl"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Engine/Utils/3DMaths_bs.inl"
|
||||||
)
|
)
|
||||||
if(NOT MSVC)
|
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -pg -ggdb3 -no-pie)
|
|
||||||
target_link_options(${PROJECT_NAME} PRIVATE -pg -ggdb3 -no-pie)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(${PROJECT_NAME} -static gcc stdc++ pthread -dynamic sfml::sfml)
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
||||||
OUTPUT_NAME ${PROJECT_NAME}${BUILDNAME_SUFFIX}
|
|
||||||
CXX_STANDARD 17
|
|
||||||
CXX_STANDARD_REQUIRED ON
|
|
||||||
)
|
|
||||||
|
|
||||||
# targets build options
|
# targets build options
|
||||||
if(MSVC)
|
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
|
||||||
endif()
|
|
||||||
if(DISABLE_CPU_OPTI)
|
if(DISABLE_CPU_OPTI)
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC DISABLE_INTRINSICS)
|
target_compile_definitions(${PROJECT_NAME} PUBLIC DISABLE_INTRINSICS)
|
||||||
else()
|
else()
|
||||||
@ -94,6 +86,34 @@ else()
|
|||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC AVX2_INTRINSICS)
|
target_compile_definitions(${PROJECT_NAME} PUBLIC AVX2_INTRINSICS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
if(NOT DISABLE_CPU_OPTI)
|
||||||
|
list(APPEND LINKLIBS -LTCG -FORCE:MULTIPLE)
|
||||||
|
endif()
|
||||||
|
list(APPEND LINKLIBS -FORCE:MULTIPLE)
|
||||||
|
|
||||||
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
||||||
|
else()
|
||||||
|
# GCC profiler options
|
||||||
|
list(APPEND COMPOPTS -pg -ggdb3 -no-pie)
|
||||||
|
list(APPEND LINKOPTS -pg -ggdb3 -no-pie)
|
||||||
|
|
||||||
|
# static linking of stdlib
|
||||||
|
if(MINGW)
|
||||||
|
list(APPEND LINKLIBS -static gcc stdc++ pthread -dynamic)
|
||||||
|
else()
|
||||||
|
list(APPEND LINKLIBS -Wl,-Bstatic -lgcc -lstdc++ -lpthread -Wl,-Bdynamic)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
list(APPEND LINKLIBS ${EXTLIBS})
|
||||||
|
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPOPTS})
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE ${LINKOPTS})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${LINKLIBS})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# GPG signature custom command
|
# GPG signature custom command
|
||||||
#add_custom_command(
|
#add_custom_command(
|
||||||
# OUTPUT ""
|
# OUTPUT ""
|
||||||
|
@ -119,7 +119,7 @@ void Graphic3DRenderer::Draw(sf::RenderTexture& context) {
|
|||||||
{
|
{
|
||||||
size_t vCount = obj->GetObjectVerticesCount();
|
size_t vCount = obj->GetObjectVerticesCount();
|
||||||
auto& oMesh = obj->GetObjectMesh();
|
auto& oMesh = obj->GetObjectMesh();
|
||||||
M3D_F4 projVertices[vCount];
|
M3D_F4* projVertices = new M3D_F4[vCount];
|
||||||
|
|
||||||
// Vertices homogeneous clip space transformation
|
// Vertices homogeneous clip space transformation
|
||||||
M3D_V3Transform(
|
M3D_V3Transform(
|
||||||
@ -186,6 +186,8 @@ void Graphic3DRenderer::Draw(sf::RenderTexture& context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::destroy_at(projVertices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cmath>
|
|
||||||
#include <cfloat>
|
|
||||||
#ifndef DISABLE_INTRINSICS
|
#ifndef DISABLE_INTRINSICS
|
||||||
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#
|
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#
|
||||||
// https://stackoverflow.com/tags/sse/info
|
// https://stackoverflow.com/tags/sse/info
|
||||||
@ -15,6 +13,21 @@
|
|||||||
#error This header requires C++
|
#error This header requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER < 1910)
|
||||||
|
#error M3D requires Visual C++ 2017 or later.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4987)
|
||||||
|
// C4987: Off by default noise
|
||||||
|
#endif
|
||||||
|
#include <cmath>
|
||||||
|
#include <cfloat>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define INLINE_AVX_FIX
|
#define INLINE_AVX_FIX
|
||||||
#else
|
#else
|
||||||
@ -62,14 +75,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
#if __cplusplus >= 201703L
|
||||||
#define M3D_ALIGNED_DATA(x) alignas(x)
|
#define M3D_ALIGNED_DATA(x) alignas(x)
|
||||||
#define M3D_ALIGNED_STRUCT(x) struct alignas(x)
|
#define M3D_ALIGNED_STRUCT(x) struct alignas(x)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define M3D_ALIGNED_DATA(x) __attribute__ ((aligned(x)))
|
#define M3D_ALIGNED_DATA(x) __attribute__ ((aligned(x)))
|
||||||
#define M3D_ALIGNED_STRUCT(x) struct __attribute__ ((aligned(x)))
|
#define M3D_ALIGNED_STRUCT(x) struct __attribute__ ((aligned(x)))
|
||||||
#else
|
#else
|
||||||
#define M3D_ALIGNED_DATA(x) __declspec(align(x))
|
#define M3D_ALIGNED_DATA(x) __declspec(align(x))
|
||||||
#define M3D_ALIGNED_STRUCT(x) __declspec(align(x)) struct
|
#define M3D_ALIGNED_STRUCT(x) __declspec(align(x)) struct
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -119,7 +132,7 @@ using M3D_VECTOR = sM3DV4;
|
|||||||
using M3D_VECTOR = __m128;
|
using M3D_VECTOR = __m128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct __attribute__((aligned(16))) M3D_V4F32 {
|
M3D_ALIGNED_STRUCT(16) M3D_V4F32 {
|
||||||
union {
|
union {
|
||||||
float f[4];
|
float f[4];
|
||||||
M3D_VECTOR v;
|
M3D_VECTOR v;
|
||||||
@ -133,7 +146,7 @@ struct __attribute__((aligned(16))) M3D_V4F32 {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((aligned(16))) M3D_V4U8 {
|
M3D_ALIGNED_STRUCT(16) M3D_V4U8 {
|
||||||
union {
|
union {
|
||||||
uint8_t u[16];
|
uint8_t u[16];
|
||||||
M3D_VECTOR v;
|
M3D_VECTOR v;
|
||||||
@ -147,7 +160,7 @@ struct __attribute__((aligned(16))) M3D_V4U8 {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((aligned(16))) M3D_V4U32 {
|
M3D_ALIGNED_STRUCT(16) M3D_V4U32 {
|
||||||
union {
|
union {
|
||||||
uint32_t u[4];
|
uint32_t u[4];
|
||||||
M3D_VECTOR v;
|
M3D_VECTOR v;
|
||||||
@ -161,7 +174,7 @@ struct __attribute__((aligned(16))) M3D_V4U32 {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((aligned(16))) M3D_V4I32 {
|
M3D_ALIGNED_STRUCT(16) M3D_V4I32 {
|
||||||
union {
|
union {
|
||||||
int32_t i[4];
|
int32_t i[4];
|
||||||
M3D_VECTOR v;
|
M3D_VECTOR v;
|
||||||
@ -188,7 +201,7 @@ struct M3D_F2 {
|
|||||||
|
|
||||||
constexpr M3D_F2(float _x, float _y) noexcept : x(_x), y(_y) {}
|
constexpr M3D_F2(float _x, float _y) noexcept : x(_x), y(_y) {}
|
||||||
};
|
};
|
||||||
struct __attribute__((aligned(16))) M3D_F2A : public M3D_F2 {
|
M3D_ALIGNED_STRUCT(16) M3D_F2A : public M3D_F2 {
|
||||||
using M3D_F2::M3D_F2;
|
using M3D_F2::M3D_F2;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,7 +219,7 @@ struct M3D_F3 {
|
|||||||
|
|
||||||
constexpr M3D_F3(float _x, float _y, float _z) noexcept : x(_x), y(_y), z(_z) {}
|
constexpr M3D_F3(float _x, float _y, float _z) noexcept : x(_x), y(_y), z(_z) {}
|
||||||
};
|
};
|
||||||
struct __attribute__((aligned(16))) M3D_F3A : public M3D_F3 {
|
M3D_ALIGNED_STRUCT(16) M3D_F3A : public M3D_F3 {
|
||||||
using M3D_F3::M3D_F3;
|
using M3D_F3::M3D_F3;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -230,7 +243,7 @@ struct M3D_F4 {
|
|||||||
auto operator <=> (const M3D_F4&) const = default;
|
auto operator <=> (const M3D_F4&) const = default;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct __attribute__((aligned(16))) M3D_F4A : public M3D_F4 {
|
M3D_ALIGNED_STRUCT(16) M3D_F4A : public M3D_F4 {
|
||||||
using M3D_F4::M3D_F4;
|
using M3D_F4::M3D_F4;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -269,8 +282,7 @@ struct M3D_F4X4 {
|
|||||||
auto operator <=> (const M3D_F4X4&) const = default;
|
auto operator <=> (const M3D_F4X4&) const = default;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct __attribute__((aligned(16))) M3D_F4X4A : public M3D_F4X4
|
M3D_ALIGNED_STRUCT(16) M3D_F4X4A : public M3D_F4X4 {
|
||||||
{
|
|
||||||
using M3D_F4X4::M3D_F4X4;
|
using M3D_F4X4::M3D_F4X4;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -295,7 +307,7 @@ struct M3D_MATRIX {
|
|||||||
float mat[4][4];
|
float mat[4][4];
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
struct __attribute__((aligned(16))) M3D_MATRIX {
|
M3D_ALIGNED_STRUCT(16) M3D_MATRIX {
|
||||||
M3D_VECTOR rows[4];
|
M3D_VECTOR rows[4];
|
||||||
#endif
|
#endif
|
||||||
M3D_MATRIX() = default;
|
M3D_MATRIX() = default;
|
||||||
@ -866,8 +878,8 @@ namespace M3D_TriangleTests {
|
|||||||
|
|
||||||
M3D_GCONST M3D_V4F32 M3D_BRayEpsilon = {{{1e-20f, 1e-20f, 1e-20f, 1e-20f}}};
|
M3D_GCONST M3D_V4F32 M3D_BRayEpsilon = {{{1e-20f, 1e-20f, 1e-20f, 1e-20f}}};
|
||||||
M3D_GCONST M3D_V4F32 M3D_BRayNegEpsilon = {{{-1e-20f, -1e-20f, -1e-20f, -1e-20f}}};
|
M3D_GCONST M3D_V4F32 M3D_BRayNegEpsilon = {{{-1e-20f, -1e-20f, -1e-20f, -1e-20f}}};
|
||||||
M3D_GCONST M3D_V4F32 M3D_BFltMin = {{{-__FLT_MAX__, -__FLT_MAX__, -__FLT_MAX__, -__FLT_MAX__}}};
|
M3D_GCONST M3D_V4F32 M3D_BFltMin = {{{-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX}}};
|
||||||
M3D_GCONST M3D_V4F32 M3D_BFltMax = {{{__FLT_MAX__, __FLT_MAX__, __FLT_MAX__, __FLT_MAX__}}};
|
M3D_GCONST M3D_V4F32 M3D_BFltMax = {{{FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX}}};
|
||||||
M3D_GCONST M3D_V4F32 M3D_BBoxOffset[8] = {
|
M3D_GCONST M3D_V4F32 M3D_BBoxOffset[8] = {
|
||||||
{{{-1.0f, -1.0f, 1.0f, 0.0f}}},
|
{{{-1.0f, -1.0f, 1.0f, 0.0f}}},
|
||||||
{{{ 1.0f, -1.0f, 1.0f, 0.0f}}},
|
{{{ 1.0f, -1.0f, 1.0f, 0.0f}}},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Perfs.hpp"
|
#include "Perfs.hpp"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#else
|
#else
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
#if !(defined(__MINGW32__) || defined(_MSC_VER))
|
||||||
static int parseLine(char* line) {
|
static int parseLine(char* line) {
|
||||||
// This assumes that a digit will be found and the line ends in "kB".
|
// This assumes that a digit will be found and the line ends in "kB".
|
||||||
int i = strlen(line);
|
int i = strlen(line);
|
||||||
@ -23,6 +23,7 @@ static int parseLine(char* line) {
|
|||||||
// Returned value in KB!
|
// Returned value in KB!
|
||||||
static int getLinuxVirtualMemUsage() {
|
static int getLinuxVirtualMemUsage() {
|
||||||
FILE* file = fopen("/proc/self/status", "r");
|
FILE* file = fopen("/proc/self/status", "r");
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
char line[128];
|
char line[128];
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ static int getLinuxVirtualMemUsage() {
|
|||||||
// Returned value in KB!
|
// Returned value in KB!
|
||||||
static int getLinuxPhysicalMemUsage() {
|
static int getLinuxPhysicalMemUsage() {
|
||||||
FILE* file = fopen("/proc/self/status", "r");
|
FILE* file = fopen("/proc/self/status", "r");
|
||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
char line[128];
|
char line[128];
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ static int getLinuxPhysicalMemUsage() {
|
|||||||
// Returned value in KB!
|
// Returned value in KB!
|
||||||
const size_t PerfsGetVirtMem(void) {
|
const size_t PerfsGetVirtMem(void) {
|
||||||
size_t out;
|
size_t out;
|
||||||
#ifdef __MINGW32__
|
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||||
PROCESS_MEMORY_COUNTERS_EX memCounter;
|
PROCESS_MEMORY_COUNTERS_EX memCounter;
|
||||||
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&memCounter, sizeof(memCounter));
|
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&memCounter, sizeof(memCounter));
|
||||||
out = memCounter.PrivateUsage / 1000;
|
out = memCounter.PrivateUsage / 1000;
|
||||||
@ -70,7 +72,7 @@ const size_t PerfsGetVirtMem(void) {
|
|||||||
// Returned value in KB!
|
// Returned value in KB!
|
||||||
const size_t PerfsGetPhysMem(void) {
|
const size_t PerfsGetPhysMem(void) {
|
||||||
size_t out;
|
size_t out;
|
||||||
#ifdef __MINGW32__
|
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||||
PROCESS_MEMORY_COUNTERS_EX memCounter;
|
PROCESS_MEMORY_COUNTERS_EX memCounter;
|
||||||
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&memCounter, sizeof(memCounter));
|
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&memCounter, sizeof(memCounter));
|
||||||
out = memCounter.WorkingSetSize / 1000;
|
out = memCounter.WorkingSetSize / 1000;
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#if (defined(__clang__) || defined(__GNUC__)) && (__x86_64__ || __i386__) && !defined(__MINGW32__)
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DISABLE_INTRINSICS
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4987)
|
||||||
|
// C4987: Off by default noise
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
#include <intrin.h>
|
||||||
|
#endif
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@ -15,7 +31,7 @@ inline bool PerfsCPUSIMDReady(void) noexcept {
|
|||||||
#if !defined(DISABLE_INTRINSICS)
|
#if !defined(DISABLE_INTRINSICS)
|
||||||
int CPUInfo[4] = {-1};
|
int CPUInfo[4] = {-1};
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if (defined(__clang__) || defined(__GNUC__)) && defined(__cpuid)
|
||||||
__cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
__cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||||
#else
|
#else
|
||||||
__cpuid(CPUInfo, 0);
|
__cpuid(CPUInfo, 0);
|
||||||
@ -29,7 +45,7 @@ inline bool PerfsCPUSIMDReady(void) noexcept {
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if (defined(__clang__) || defined(__GNUC__)) && defined(__cpuid)
|
||||||
__cpuid(1, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
__cpuid(1, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||||
#else
|
#else
|
||||||
__cpuid(CPUInfo, 1);
|
__cpuid(CPUInfo, 1);
|
||||||
|
13
conanfile.py
13
conanfile.py
@ -1,6 +1,7 @@
|
|||||||
from conan import ConanFile
|
from conan import ConanFile
|
||||||
from conan.tools.cmake import CMakeToolchain#,cmake_layout
|
from conan.tools.cmake import CMakeToolchain,cmake_layout
|
||||||
from conan.tools.files import copy
|
from conan.tools.files import copy
|
||||||
|
from conan.tools.microsoft import is_msvc
|
||||||
import os
|
import os
|
||||||
|
|
||||||
required_conan_version = ">=1.59"
|
required_conan_version = ">=1.59"
|
||||||
@ -36,8 +37,9 @@ class ProtoTank(ConanFile):
|
|||||||
def requirements(self):
|
def requirements(self):
|
||||||
self.requires("sfml/[~2.6]")
|
self.requires("sfml/[~2.6]")
|
||||||
|
|
||||||
# def layout(self):
|
def layout(self):
|
||||||
# cmake_layout(self)
|
self.folders.build_folder_vars = ["settings.os", "settings.compiler", "settings.build_type"]
|
||||||
|
cmake_layout(self)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
tc = CMakeToolchain(self)
|
tc = CMakeToolchain(self)
|
||||||
@ -46,7 +48,10 @@ class ProtoTank(ConanFile):
|
|||||||
for dep in self.dependencies.values():
|
for dep in self.dependencies.values():
|
||||||
if len(dep.cpp_info.bindirs) > 0:
|
if len(dep.cpp_info.bindirs) > 0:
|
||||||
if self.settings.os == "Windows":
|
if self.settings.os == "Windows":
|
||||||
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
if is_msvc(self):
|
||||||
|
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin", str(self.settings.build_type)))
|
||||||
|
else:
|
||||||
|
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
||||||
else:
|
else:
|
||||||
copy(self, "*.so", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
copy(self, "*.so", dep.cpp_info.bindirs[0], os.path.join(self.build_folder, "bin"))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user