mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 12:00:17 +02:00
CMAKE_CXX_FLAGS is a space-separated string rather than a semicolon-separated
list. Passing ${CMAKE_CXX_FLAGS} directly to execute_process(COMMAND ...)
passes the entire multi-flag string as a single argv argument to the compiler,
causing option parsing to fail when multiple flags are present (such as
flags configured via the CXXFLAGS environment variable).
Use separate_arguments() to convert CMAKE_CXX_FLAGS into a list so each flag
is passed as an individual argument.
35 lines
1.3 KiB
CMake
35 lines
1.3 KiB
CMake
function(build_implib name)
|
|
set(name_ex ${name}_ex)
|
|
add_custom_target(${name_ex}lib ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lib${name_ex}.a)
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${name_ex}.a
|
|
COMMAND ${CMAKE_DLLTOOL} -d ${CMAKE_CURRENT_SOURCE_DIR}/Defs/${name}.def -k -l lib${name_ex}.a
|
|
COMMENT "Building lib${name_ex}.a")
|
|
|
|
add_library(${name_ex} SHARED IMPORTED)
|
|
set_property(TARGET ${name_ex} PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_BINARY_DIR}/lib${name_ex}.a)
|
|
add_dependencies(${name_ex} ${name_ex}lib)
|
|
endfunction()
|
|
|
|
function(patch_library_wine target)
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
|
COMMAND dd bs=32 count=1 seek=2 conv=notrunc if=${CMAKE_SOURCE_DIR}/Source/Windows/wine_builtin.bin of=$<TARGET_FILE:${target}>)
|
|
endfunction()
|
|
|
|
separate_arguments(CXX_FLAGS_LIST NATIVE_COMMAND "${CMAKE_CXX_FLAGS}")
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CXX_FLAGS_LIST} -print-libgcc-file-name
|
|
OUTPUT_VARIABLE LIBGCC_PATH
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
build_implib(ntdll)
|
|
build_implib(wow64)
|
|
|
|
add_subdirectory(Common)
|
|
|
|
if (ARCHITECTURE_arm64ec)
|
|
add_subdirectory(ARM64EC)
|
|
elseif (ARCHITECTURE_arm64)
|
|
add_subdirectory(WOW64)
|
|
endif()
|
|
|
|
add_subdirectory(../Tools/FEXOfflineCompiler ${CMAKE_CURRENT_BINARY_DIR}/FEXOfflineCompiler)
|