Skip to content

Commit 4204da3

Browse files
committed
Remove outdated functionality from the build system
The HHVM CMake build contains various bits that are outdated or never really were supported to begin with. The resulting bloat makes the build files harder to maintain. So, reduce the complexity by eliminating dead build logic: * Remove MSVC-specific build logic. HHVM support on Windows was only ever experimental and was not worked on from 2018 onwards. * Remove Cotire, an 11-year old experiment for precompiling headers. * Drop checks and conditional blocks for very old clang and gcc versions. Since we require C++20, any attempt to build on such archaic compiler versions would fail fast. * Drop configuration specific to the Intel C++ compiler. * Remove unused CPACK_GENERATOR option. * Remove SSE4.2 and AVX2 toggles in favor of `march=x86-64-v3`.
1 parent 520dda0 commit 4204da3

25 files changed

Lines changed: 52 additions & 4406 deletions

CMake/HHVMExtensionConfig.cmake

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -442,15 +442,7 @@ function (HHVM_EXTENSION_INTERNAL_SORT_OUT_SOURCES rootDir)
442442
elseif (${fileExtension} STREQUAL ".h" OR ${fileExtension} STREQUAL ".hpp")
443443
list(APPEND HEADER_SOURCES "${rootDir}/${fileName}")
444444
elseif (${fileExtension} STREQUAL ".s")
445-
# AT&T syntax, MSVC doesn't like.
446-
if (NOT MSVC)
447-
list(APPEND ASM_SOURCES "${rootDir}/${fileName}")
448-
endif()
449-
elseif (${fileExtension} STREQUAL ".asm")
450-
# MASM syntax. MSVC only.
451-
if (MSVC)
452-
list(APPEND ASM_SOURCES "${rootDir}/${fileName}")
453-
endif()
445+
list(APPEND ASM_SOURCES "${rootDir}/${fileName}")
454446
elseif (${fileExtension} STREQUAL ".php")
455447
list(APPEND PHP_SOURCES "${rootDir}/${fileName}")
456448
elseif (${fileExtension} STREQUAL ".hack")
@@ -530,10 +522,6 @@ function(HHVM_EXTENSION_INTERNAL_RESOLVE_DEPENDENCIES_OF_EXTENSION resolvedDestV
530522
if (${listIDX} EQUAL 0)
531523
# OS Dependency
532524
if (${currentDependency} STREQUAL "osPosix")
533-
if (MSVC)
534-
HHVM_EXTENSION_INTERNAL_SET_FAILED_DEPENDENCY(${extensionID} ${currentDependency} ON)
535-
break()
536-
endif()
537525
else()
538526
message(FATAL_ERROR "The only OS restriction that is currently valid is 'osPosix', got '${currentDependency}'!")
539527
endif()

CMake/HHVMGenerateConfig.cmake

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ function(HHVM_GENERATE_CONFIG_FUNCTIONS_FOUND_DEFINE_STRING destVarName)
6666
"utimes"
6767
)
6868

69-
# This is a list of functions that are known to be present under MSVC
70-
# because they are implemented via Folly's portability headers. For an
71-
# item in this list to have any effect, it must first fail to be found
72-
# when checking the item in the main list.
73-
set(HHVM_FUNCTIONS_KNOWN_TO_BE_PRESENT_MSVC)
74-
list(APPEND HHVM_FUNCTIONS_KNOWN_TO_BE_PRESENT_MSVC
75-
"mkstemp"
76-
"mmap"
77-
)
78-
7969
set(builtString "")
8070
list(LENGTH HHVM_FUNCTIONS_TO_CHECK functionCount)
8171
set(i 0)
@@ -86,12 +76,7 @@ function(HHVM_GENERATE_CONFIG_FUNCTIONS_FOUND_DEFINE_STRING destVarName)
8676
if (${HAVE_${curFuncUpper}})
8777
set(builtString "${builtString}\n#define HAVE_${curFuncUpper} 1")
8878
else()
89-
list(FIND HHVM_FUNCTIONS_KNOWN_TO_BE_PRESENT_MSVC "${curFunc}" curFuncIdx)
90-
if (curFuncIdx EQUAL -1 OR NOT MSVC)
91-
set(builtString "${builtString}\n/* #undef HAVE_${curFuncUpper} */")
92-
else()
93-
set(builtString "${builtString}\n#define HAVE_${curFuncUpper} 1 /* Implemented via Folly Portability header */")
94-
endif()
79+
set(builtString "${builtString}\n/* #undef HAVE_${curFuncUpper} */")
9580
endif()
9681
math(EXPR i "${i} + 1")
9782
endwhile()

CMake/HPHPCompiler.cmake

Lines changed: 13 additions & 409 deletions
Large diffs are not rendered by default.

CMake/HPHPFindLibs.cmake

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,7 @@ macro(hphp_link target)
416416

417417
target_link_libraries(${target} ${VISIBILITY} tbb)
418418

419-
if (NOT MSVC)
420-
target_link_libraries(${target} ${VISIBILITY} afdt)
421-
endif()
419+
target_link_libraries(${target} ${VISIBILITY} afdt)
422420
target_link_libraries(${target} ${VISIBILITY} mbfl)
423421

424422
if (EDITLINE_LIBRARIES)
@@ -427,44 +425,15 @@ macro(hphp_link target)
427425
target_link_libraries(${target} ${VISIBILITY} ${READLINE_LIBRARY})
428426
endif()
429427

430-
if (MSVC)
431-
target_link_libraries(${target} ${VISIBILITY} dbghelp.lib dnsapi.lib)
428+
find_library(ATOMIC_LIBRARY NAMES atomic libatomic.so.1)
429+
if (ATOMIC_LIBRARY STREQUAL "ATOMIC_LIBRARY-NOTFOUND")
430+
# -latomic should be available for gcc even when libatomic.so.1 is not
431+
# in the library search path
432+
target_link_libraries(${target} ${VISIBILITY} atomic)
433+
else()
434+
target_link_libraries(${target} ${VISIBILITY} ${ATOMIC_LIBRARY})
432435
endif()
433436

434-
# Check whether atomic operations require -latomic or not
435-
# See https://github.com/facebook/hhvm/issues/5217
436-
include(CheckCXXSourceCompiles)
437-
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
438-
set(CMAKE_REQUIRED_FLAGS "-std=c++1y")
439-
CHECK_CXX_SOURCE_COMPILES("
440-
#include <atomic>
441-
#include <iostream>
442-
#include <stdint.h>
443-
int main() {
444-
struct Test { int64_t val1; int64_t val2; };
445-
std::atomic<Test> s;
446-
// Do this to stop modern compilers from optimizing away the libatomic
447-
// calls in release builds, making this test always pass in release builds,
448-
// and incorrectly think that HHVM doesn't need linking against libatomic.
449-
bool (std::atomic<Test>::* volatile x)(void) const =
450-
&std::atomic<Test>::is_lock_free;
451-
std::cout << (s.*x)() << std::endl;
452-
}
453-
" NOT_REQUIRE_ATOMIC_LINKER_FLAG)
454-
455-
if(NOT "${NOT_REQUIRE_ATOMIC_LINKER_FLAG}")
456-
message(STATUS "-latomic is required to link hhvm")
457-
find_library(ATOMIC_LIBRARY NAMES atomic libatomic.so.1)
458-
if (ATOMIC_LIBRARY STREQUAL "ATOMIC_LIBRARY-NOTFOUND")
459-
# -latomic should be available for gcc even when libatomic.so.1 is not
460-
# in the library search path
461-
target_link_libraries(${target} ${VISIBILITY} atomic)
462-
else()
463-
target_link_libraries(${target} ${VISIBILITY} ${ATOMIC_LIBRARY})
464-
endif()
465-
endif()
466-
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
467-
468437
if (ENABLE_XED)
469438
if (LibXed_FOUND)
470439
target_link_libraries(${target} ${VISIBILITY} ${LibXed_LIBRARY})

CMake/HPHPFunctions.cmake

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,12 @@ macro(HHVM_SELECT_SOURCES DIR)
5757
list(APPEND C_SOURCES ${f})
5858
endif()
5959
endforeach()
60-
if (MSVC)
61-
auto_sources(files "*.asm" "RECURSE" "${DIR}")
62-
foreach(f ${files})
63-
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
64-
list(APPEND ASM_SOURCES ${f})
65-
endif()
66-
endforeach()
67-
else()
68-
auto_sources(files "*.S" "RECURSE" "${DIR}")
69-
foreach(f ${files})
70-
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
71-
list(APPEND ASM_SOURCES ${f})
72-
endif()
73-
endforeach()
74-
endif()
60+
auto_sources(files "*.S" "RECURSE" "${DIR}")
61+
foreach(f ${files})
62+
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
63+
list(APPEND ASM_SOURCES ${f})
64+
endif()
65+
endforeach()
7566
auto_sources(files "*.h" "RECURSE" "${DIR}")
7667
foreach(f ${files})
7768
if (NOT (${f} MATCHES "(/(old-)?tests?/)"))
@@ -113,21 +104,14 @@ macro(MYSQL_SOCKET_SEARCH)
113104
endmacro()
114105

115106
function(append_systemlib TARGET SOURCE SECTNAME)
116-
if(MSVC)
117-
list(APPEND ${TARGET}_SLIBS_NAMES "${SECTNAME}")
118-
set(${TARGET}_SLIBS_NAMES ${${TARGET}_SLIBS_NAMES} PARENT_SCOPE)
119-
list(APPEND ${TARGET}_SLIBS_SOURCES "${SOURCE}")
120-
set(${TARGET}_SLIBS_SOURCES ${${TARGET}_SLIBS_SOURCES} PARENT_SCOPE)
107+
if (APPLE)
108+
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} -Wl,-sectcreate,__text,${SECTNAME},${SOURCE} PARENT_SCOPE)
121109
else()
122-
if (APPLE)
123-
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} -Wl,-sectcreate,__text,${SECTNAME},${SOURCE} PARENT_SCOPE)
124-
else()
125-
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} "--add-section" "${SECTNAME}=${SOURCE}" PARENT_SCOPE)
126-
endif()
127-
# Add the systemlib file to the "LINK_DEPENDS" for the systemlib, this will cause it
128-
# to be relinked and the systemlib re-embedded
129-
set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS ${SOURCE})
110+
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} "--add-section" "${SECTNAME}=${SOURCE}" PARENT_SCOPE)
130111
endif()
112+
# Add the systemlib file to the "LINK_DEPENDS" for the systemlib, this will cause it
113+
# to be relinked and the systemlib re-embedded
114+
set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS ${SOURCE})
131115
endfunction(append_systemlib)
132116

133117
function(embed_sections TARGET DEST)
@@ -150,24 +134,6 @@ function(embed_sections TARGET DEST)
150134
set(REPO_SCHEMA -Wl,-sectcreate,__text,"repo_schema_id","${CMAKE_BINARY_DIR}/hphp/util/generated-repo-schema-id.txt")
151135
set(BUILD_ID -Wl,-sectcreate,__text,"build_id","${CMAKE_BINARY_DIR}/hphp/util/generated-build-id.txt")
152136
target_link_libraries(${TARGET} ${${TARGET}_SLIBS} ${COMPILER_ID} ${COMPILER_TIMESTAMP} ${REPO_SCHEMA} ${BUILD_ID})
153-
elseif(MSVC)
154-
set(RESOURCE_FILE "#pragma code_page(1252)\n")
155-
set(RESOURCE_FILE "${RESOURCE_FILE}LANGUAGE 0, 0\n")
156-
set(RESOURCE_FILE "${RESOURCE_FILE}\n")
157-
set(RESOURCE_FILE "${RESOURCE_FILE}#include \"${CMAKE_BINARY_DIR}/hphp/runtime/version.h\"\n")
158-
file(READ "${CMAKE_BINARY_DIR}/hphp/hhvm/hhvm.rc" VERSION_INFO)
159-
set(RESOURCE_FILE "${RESOURCE_FILE}compiler_id RCDATA \"${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-id.txt\"\n")
160-
set(RESOURCE_FILE "${RESOURCE_FILE}compiler_ts RCDATA \"${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-timestamp.txt\"\n")
161-
set(RESOURCE_FILE "${RESOURCE_FILE}repo_schema_id RCDATA \"${CMAKE_BINARY_DIR}/hphp/util/generated-repo-schema-id.txt\"\n")
162-
set(RESOURCE_FILE "${RESOURCE_FILE}build_id RCDATA \"${CMAKE_BINARY_DIR}/hphp/util/generated-build-id.txt\"\n")
163-
set(RESOURCE_FILE "${RESOURCE_FILE}${VERSION_INFO}\n")
164-
set(i 0)
165-
foreach (nm ${${TARGET}_SLIBS_NAMES})
166-
list(GET ${TARGET}_SLIBS_SOURCES ${i} source)
167-
set(RESOURCE_FILE "${RESOURCE_FILE}${nm} RCDATA \"${source}\"\n")
168-
math(EXPR i "${i} + 1")
169-
endforeach()
170-
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/embed.rc "${RESOURCE_FILE}")
171137
else()
172138
add_custom_command(TARGET ${TARGET} POST_BUILD
173139
COMMAND "objcopy"
@@ -193,13 +159,8 @@ macro(embed_systemlib_byname TARGET SLIB)
193159
string(MD5 SLIB_HASH_NAME ${SLIB_EXTNAME})
194160
# Some platforms limit section names to 16 characters :(
195161
string(SUBSTRING ${SLIB_HASH_NAME} 0 12 SLIB_HASH_NAME_SHORT)
196-
if (MSVC)
197-
# The dot would be causing the RC lexer to begin a number in the
198-
# middle of our resource name, so use an underscore instead.
199-
append_systemlib(${TARGET} ${SLIB} "ext_${SLIB_HASH_NAME_SHORT}")
200-
else()
201-
append_systemlib(${TARGET} ${SLIB} "ext.${SLIB_HASH_NAME_SHORT}")
202-
endif()
162+
163+
append_systemlib(${TARGET} ${SLIB} "ext.${SLIB_HASH_NAME_SHORT}")
203164
endmacro()
204165

205166
function(embed_all_systemlibs TARGET ROOT DEST)
@@ -395,37 +356,20 @@ function(parse_version PREFIX VERSION)
395356
set(${PREFIX}SUFFIX ${SUFFIX} PARENT_SCOPE)
396357
endfunction()
397358

398-
# MSVC doesn't support a --whole-archive flag, but newer versions
399-
# of CMake do support object libraries, which give the same result.
400-
# As we can't easily upgrade the normal builds to CMake 3.0, we
401-
# will just require CMake 3.0+ for MSVC builds only.
402359
function(add_object_library libraryName)
403-
if (MSVC)
404-
add_library(${libraryName} OBJECT ${ARGN})
405-
else()
406-
add_library(${libraryName} STATIC ${ARGN})
407-
endif()
360+
add_library(${libraryName} STATIC ${ARGN})
408361
endfunction()
409362

410363
# Get what might be the objects of the object libraries, if needed.
411364
function(get_object_libraries_objects targetVariable)
412365
set(OBJECTS)
413-
if (MSVC)
414-
foreach (fil ${ARGN})
415-
list(APPEND OBJECTS $<TARGET_OBJECTS:${fil}>)
416-
endforeach()
417-
endif()
418366

419367
set(${targetVariable} ${OBJECTS} PARENT_SCOPE)
420368
endfunction()
421369

422370
# Add the additional link targets for a set of object libraries,
423371
# if needed.
424372
function(link_object_libraries target)
425-
if (MSVC)
426-
return()
427-
endif()
428-
429373
set(WHOLE_ARCHIVE_LIBS)
430374
foreach (fil ${ARGN})
431375
list(APPEND WHOLE_ARCHIVE_LIBS ${fil})
@@ -453,21 +397,14 @@ endfunction()
453397
# This should be called for object libraries, rather than calling
454398
# hphp_link directly.
455399
function(object_library_hphp_link target)
456-
# MSVC can't have it. (see below)
457-
if (NOT MSVC)
458-
hphp_link(${target})
459-
endif()
400+
hphp_link(${target})
460401
endfunction()
461402

462403
# If a library needs to be linked in to make GNU ld happy,
463404
# it should be done by calling this.
464405
function(object_library_ld_link_libraries target)
465406
if (${ARGC})
466-
# CMake doesn't allow calls to target_link_libraries if the target
467-
# is an OBJECT library, so MSVC can't have this.
468-
if (NOT MSVC)
469-
target_link_libraries(${target} ${ARGN})
470-
endif()
407+
target_link_libraries(${target} ${ARGN})
471408
endif()
472409
endfunction()
473410

CMake/HPHPIZEFunctions.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ endfunction()
3131
function(embed_systemlibs TARGET DEST)
3232
if (APPLE)
3333
target_link_libraries(${TARGET} ${${TARGET}_SLIBS})
34-
elseif (MSVC)
35-
message(FATAL_ERROR "Shared extensions are not supported on Windows")
3634
else()
3735
add_custom_command(TARGET ${TARGET} POST_BUILD
3836
COMMAND "objcopy"

CMake/HPHPSetup.cmake

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,8 @@ if (LINUX)
101101
add_definitions(-D_GNU_SOURCE)
102102
endif()
103103

104-
if(MSVC)
105-
add_definitions(-DGLOG_NO_ABBREVIATED_SEVERITIES)
106-
add_definitions(-DWIN32_LEAN_AND_MEAN)
107-
endif()
108-
109104
if(CMAKE_CONFIGURATION_TYPES)
110-
if(NOT MSVC)
111-
message(FATAL_ERROR "Adding the appropriate defines for multi-config targets using anything other than MSVC is not yet supported!")
112-
endif()
113-
foreach(flag_var
114-
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
115-
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
116-
set(${flag_var} "${${flag_var}} /D NDEBUG")
117-
endforeach()
105+
message(FATAL_ERROR "Adding the appropriate defines for multi-config targets is not yet supported!")
118106
elseif(${CMAKE_BUILD_TYPE} MATCHES "Debug" OR
119107
${CMAKE_BUILD_TYPE} MATCHES "DebugOpt")
120108
message("Generating DEBUG build")
@@ -127,7 +115,7 @@ if(ALWAYS_ASSERT)
127115
add_definitions(-DALWAYS_ASSERT=1)
128116
endif()
129117

130-
if(APPLE OR FREEBSD OR MSVC)
118+
if(APPLE OR FREEBSD)
131119
add_definitions(-DSKIP_USER_CHANGE=1)
132120
endif()
133121

0 commit comments

Comments
 (0)