@@ -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)
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 ()
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} )
131115endfunction (append_systemlib )
132116
133117function (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} " )
203164endmacro ()
204165
205166function (embed_all_systemlibs TARGET ROOT DEST )
@@ -395,37 +356,20 @@ function(parse_version PREFIX VERSION)
395356 set (${PREFIX} SUFFIX ${SUFFIX} PARENT_SCOPE )
396357endfunction ()
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.
402359function (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} )
408361endfunction ()
409362
410363# Get what might be the objects of the object libraries, if needed.
411364function (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 )
420368endfunction ()
421369
422370# Add the additional link targets for a set of object libraries,
423371# if needed.
424372function (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.
455399function (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} )
460401endfunction ()
461402
462403# If a library needs to be linked in to make GNU ld happy,
463404# it should be done by calling this.
464405function (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 ()
472409endfunction ()
473410
0 commit comments