Skip to content

Commit 4704d35

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.
1 parent b56ca1a commit 4704d35

22 files changed

+38
-4333
lines changed

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: 11 additions & 384 deletions
Large diffs are not rendered by default.

CMake/HPHPFindLibs.cmake

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,7 @@ macro(hphp_link target)
433433

434434
target_link_libraries(${target} ${VISIBILITY} tbb)
435435

436-
if (NOT MSVC)
437-
target_link_libraries(${target} ${VISIBILITY} afdt)
438-
endif()
436+
target_link_libraries(${target} ${VISIBILITY} afdt)
439437
target_link_libraries(${target} ${VISIBILITY} mbfl)
440438

441439
if (EDITLINE_LIBRARIES)
@@ -444,10 +442,6 @@ macro(hphp_link target)
444442
target_link_libraries(${target} ${VISIBILITY} ${READLINE_LIBRARY})
445443
endif()
446444

447-
if (MSVC)
448-
target_link_libraries(${target} ${VISIBILITY} dbghelp.lib dnsapi.lib)
449-
endif()
450-
451445
find_library(ATOMIC_LIBRARY NAMES atomic libatomic.so.1)
452446
if (ATOMIC_LIBRARY STREQUAL "ATOMIC_LIBRARY-NOTFOUND")
453447
# -latomic should be available for gcc even when libatomic.so.1 is not

CMake/HPHPFunctions.cmake

Lines changed: 14 additions & 77 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,17 +104,10 @@ 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()
110+
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} "--add-section" "${SECTNAME}=${SOURCE}" PARENT_SCOPE)
127111
endif()
128112
endfunction(append_systemlib)
129113

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

202163
function(embed_all_systemlibs TARGET ROOT DEST)
@@ -413,37 +374,20 @@ function(parse_version PREFIX VERSION)
413374
set(${PREFIX}SUFFIX ${SUFFIX} PARENT_SCOPE)
414375
endfunction()
415376

416-
# MSVC doesn't support a --whole-archive flag, but newer versions
417-
# of CMake do support object libraries, which give the same result.
418-
# As we can't easily upgrade the normal builds to CMake 3.0, we
419-
# will just require CMake 3.0+ for MSVC builds only.
420377
function(add_object_library libraryName)
421-
if (MSVC)
422-
add_library(${libraryName} OBJECT ${ARGN})
423-
else()
424-
add_library(${libraryName} STATIC ${ARGN})
425-
endif()
378+
add_library(${libraryName} STATIC ${ARGN})
426379
endfunction()
427380

428381
# Get what might be the objects of the object libraries, if needed.
429382
function(get_object_libraries_objects targetVariable)
430383
set(OBJECTS)
431-
if (MSVC)
432-
foreach (fil ${ARGN})
433-
list(APPEND OBJECTS $<TARGET_OBJECTS:${fil}>)
434-
endforeach()
435-
endif()
436384

437385
set(${targetVariable} ${OBJECTS} PARENT_SCOPE)
438386
endfunction()
439387

440388
# Add the additional link targets for a set of object libraries,
441389
# if needed.
442390
function(link_object_libraries target)
443-
if (MSVC)
444-
return()
445-
endif()
446-
447391
set(WHOLE_ARCHIVE_LIBS)
448392
foreach (fil ${ARGN})
449393
list(APPEND WHOLE_ARCHIVE_LIBS ${fil})
@@ -471,21 +415,14 @@ endfunction()
471415
# This should be called for object libraries, rather than calling
472416
# hphp_link directly.
473417
function(object_library_hphp_link target)
474-
# MSVC can't have it. (see below)
475-
if (NOT MSVC)
476-
hphp_link(${target})
477-
endif()
418+
hphp_link(${target})
478419
endfunction()
479420

480421
# If a library needs to be linked in to make GNU ld happy,
481422
# it should be done by calling this.
482423
function(object_library_ld_link_libraries target)
483424
if (${ARGC})
484-
# CMake doesn't allow calls to target_link_libraries if the target
485-
# is an OBJECT library, so MSVC can't have this.
486-
if (NOT MSVC)
487-
target_link_libraries(${target} ${ARGN})
488-
endif()
425+
target_link_libraries(${target} ${ARGN})
489426
endif()
490427
endfunction()
491428

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)