Skip to content

Commit

Permalink
[entityx] Fix parallel configure
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0219-msft committed Oct 25, 2018
1 parent e80548e commit 9b7d934
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 32 deletions.
40 changes: 40 additions & 0 deletions ports/entityx/fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 87309bf..23f5063 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,7 @@ include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
include(CheckCXXSourceCompiles)

# Default compiler args
+if(0)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|.*Clang)")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Werror -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=sign-compare -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
@@ -41,6 +42,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS_RELEASE "/Ox -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ox /Zi /FS /DEBUG")
endif()
+endif()

# if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-shadow -Wno-padded -Wno-missing-noreturn -Wno-global-constructors")
@@ -156,9 +158,9 @@ endif (ENTITYX_BUILD_TESTING)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/entityx/config.h.in
- ${CMAKE_CURRENT_SOURCE_DIR}/entityx/config.h
+ ${CMAKE_CURRENT_BINARY_DIR}/entityx/config.h
)
-
+include_directories(${CMAKE_CURRENT_BINARY_DIR})

if (NOT WINDOWS OR CYGWIN)
set(entityx_libs -lentityx)
@@ -179,6 +181,7 @@ install(
DESTINATION "include"
FILES_MATCHING PATTERN "*.h"
)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/entityx/config.h DESTINATION include/entityx)

install(
TARGETS ${install_libs}
43 changes: 11 additions & 32 deletions ports/entityx/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,42 +1,21 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
include(vcpkg_common_functions)

if(NOT VCPKG_CRT_LINKAGE STREQUAL "dynamic")
message(FATAL_ERROR "Entityx only supports dynamic CRT linkage")
endif()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/entityx-1.2.0)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/alecthomas/entityx/archive/1.2.0.zip"
FILENAME "entityx-1.2.0.zip"
SHA512 4d7009f0412fbccd7bee72713d53424c3b4fa39da62b87729dd84a710a059db27e65ca27b927285c82af09997caea125d85571824133d9b71b4e3c4eebd9917c
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO alecthomas/entityx
REF 1.2.0
SHA512 682aa302cb4495666aab2c0b39a286f88cb28046bc8b2deb603402105e15e4b9692e32807077abc3f465e42a4e0f34a7e69169bc74fc5579a5c3d0e17b02fdb8
HEAD_REF master
PATCHES fix-cmake.patch
)
vcpkg_extract_source_archive(${ARCHIVE})

if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
SET(SHARED_FLAG ON)
else()
SET(SHARED_FLAG OFF)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
-DENTITYX_BUILD_SHARED=${SHARED_FLAG}
-DENTITYX_BUILD_TESTING=false
-DENTITYX_BUILD_TESTING=false
)

vcpkg_install_cmake()
Expand Down

0 comments on commit 9b7d934

Please sign in to comment.