@@ -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)
113104endmacro ()
114105
115106function (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 ()
128112endfunction (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} " )
200161endmacro ()
201162
202163function (embed_all_systemlibs TARGET ROOT DEST)
@@ -413,37 +374,20 @@ function(parse_version PREFIX VERSION)
413374 set (${PREFIX} SUFFIX ${SUFFIX} PARENT_SCOPE)
414375endfunction ()
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.
420377function (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} )
426379endfunction ()
427380
428381# Get what might be the objects of the object libraries, if needed.
429382function (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)
438386endfunction ()
439387
440388# Add the additional link targets for a set of object libraries,
441389# if needed.
442390function (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.
473417function (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} )
478419endfunction ()
479420
480421# If a library needs to be linked in to make GNU ld happy,
481422# it should be done by calling this.
482423function (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 ()
490427endfunction ()
491428
0 commit comments