1
0
Fork 0

Add possibility to build on Windows for x64.

This commit is contained in:
John Preston 2020-11-06 20:19:54 +03:00
parent 4bf45519f6
commit d9e8a608c2
9 changed files with 67 additions and 11 deletions

View file

@ -12,7 +12,13 @@ INTERFACE
${libs_loc}/lzma/C ${libs_loc}/lzma/C
) )
set(lzma_lib_loc ${libs_loc}/lzma/C/Util/LzmaLib/$<IF:$<CONFIG:Debug>,Debug,Release>) if (build_win64)
set(lzma_platform_dir x64/)
else()
set(lzma_platform_dir "")
endif()
set(lzma_lib_loc ${libs_loc}/lzma/C/Util/LzmaLib/${lzma_platform_dir}$<IF:$<CONFIG:Debug>,Debug,Release>)
target_link_libraries(external_lzma target_link_libraries(external_lzma
INTERFACE INTERFACE

View file

@ -12,7 +12,13 @@ INTERFACE
${libs_loc}/breakpad/src ${libs_loc}/breakpad/src
) )
set(breakpad_lib_loc ${libs_loc}/breakpad/src/out/$<IF:$<CONFIG:Debug>,Debug,Release>/obj/client) if (build_win64)
set(breakpad_config_add _x64)
else()
set(breakpad_config_add "")
endif()
set(breakpad_lib_loc ${libs_loc}/breakpad/src/out/$<IF:$<CONFIG:Debug>,Debug${breakpad_config_add},Release${breakpad_config_add}>/obj/client)
if (WIN32) if (WIN32)
target_link_libraries(external_breakpad target_link_libraries(external_breakpad

View file

@ -9,7 +9,11 @@ add_library(desktop-app::external_openssl ALIAS external_openssl)
if (WIN32) if (WIN32)
set(openssl_lib_ext lib) set(openssl_lib_ext lib)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32) if (build_win64)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out64)
else()
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32)
endif()
else() else()
set(openssl_lib_ext a) set(openssl_lib_ext a)
if (APPLE) if (APPLE)

View file

@ -21,7 +21,12 @@ else()
INTERFACE INTERFACE
${libs_loc}/opus/include ${libs_loc}/opus/include
) )
set(opus_lib_loc ${libs_loc}/opus/win32/VS2015/Win32) if (build_win64)
set(opus_config_folder x64)
else()
set(opus_config_folder Win32)
endif()
set(opus_lib_loc ${libs_loc}/opus/win32/VS2015/${opus_config_folder})
set_target_properties(external_opus PROPERTIES set_target_properties(external_opus PROPERTIES
IMPORTED_LOCATION "${opus_lib_loc}/Release/opus.lib" IMPORTED_LOCATION "${opus_lib_loc}/Release/opus.lib"
IMPORTED_LOCATION_DEBUG "${opus_lib_loc}/Debug/opus.lib" IMPORTED_LOCATION_DEBUG "${opus_lib_loc}/Debug/opus.lib"

View file

@ -13,7 +13,12 @@ if (DESKTOP_APP_USE_PACKAGED)
elseif (WIN32) elseif (WIN32)
target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI)
target_include_directories(external_zlib INTERFACE ${libs_loc}/zlib) target_include_directories(external_zlib INTERFACE ${libs_loc}/zlib)
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>) if (build_win64)
set(zlib_config_folder x64)
else()
set(zlib_config_folder x86)
endif()
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/${zlib_config_folder}/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>)
target_link_libraries(external_zlib INTERFACE ${zlib_lib_loc}/zlibstat.lib) target_link_libraries(external_zlib INTERFACE ${zlib_lib_loc}/zlibstat.lib)
elseif (APPLE AND NOT build_osx) elseif (APPLE AND NOT build_osx)
target_link_libraries(external_zlib INTERFACE /usr/local/macos/lib/libz.a) target_link_libraries(external_zlib INTERFACE /usr/local/macos/lib/libz.a)

View file

@ -26,6 +26,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
/w15038 # wrong initialization order /w15038 # wrong initialization order
/w14265 # class has virtual functions, but destructor is not virtual /w14265 # class has virtual functions, but destructor is not virtual
/wd4068 # Disable "warning C4068: unknown pragma" /wd4068 # Disable "warning C4068: unknown pragma"
/wd4267 # 'initializing': conversion from 'size_t' to 'int', possible loss of data.
/wd4244 # '=': conversion from 'size_t' to 'int', possible loss of data.
/Zc:wchar_t- # don't tread wchar_t as builtin type /Zc:wchar_t- # don't tread wchar_t as builtin type
/Zi /Zi
) )
@ -34,6 +36,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
INTERFACE INTERFACE
$<IF:$<CONFIG:Debug>,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF> $<IF:$<CONFIG:Debug>,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF>
) )
if (build_win64)
target_compile_options(common_options
INTERFACE
/bigobj # scheme.cpp has too many sections.
)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE

View file

@ -12,14 +12,22 @@ def run(project, arguments, buildType=''):
basePath = scriptPath + '/../out/' + buildType basePath = scriptPath + '/../out/' + buildType
cmake = ['cmake'] cmake = ['cmake']
windowsArch = ''
for arg in arguments: for arg in arguments:
if arg == 'debug': if arg == 'debug':
cmake.append('-DCMAKE_BUILD_TYPE=Debug') cmake.append('-DCMAKE_BUILD_TYPE=Debug')
elif arg == 'x86' or arg == 'x64':
windowsArch = arg
elif arg != 'force': elif arg != 'force':
cmake.append(arg) cmake.append(arg)
if sys.platform == 'win32': if sys.platform == 'win32':
cmake.append('-AWin32') if windowsArch == 'x64':
cmake.append('-Ax64')
else:
cmake.append('-AWin32') # default
elif windowsArch != '':
print("[ERROR] x86/x64 switch is supported only on Windows.")
return 1
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
cmake.append('-GXcode') cmake.append('-GXcode')
elif buildType: elif buildType:

View file

@ -20,7 +20,9 @@ endif()
if (WIN32) if (WIN32)
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp" if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win") AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64"
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win"
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64")
report_bad_special_target() report_bad_special_target()
endif() endif()
elseif (APPLE) elseif (APPLE)

View file

@ -22,6 +22,7 @@ endif()
set(disable_autoupdate 0) set(disable_autoupdate 0)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "" if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp" OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64"
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore")
set(disable_autoupdate 1) set(disable_autoupdate 1)
endif() endif()
@ -57,12 +58,20 @@ endif()
set(build_osx 0) set(build_osx 0)
set(build_macstore 0) set(build_macstore 0)
set(build_winstore 0) set(build_winstore 0) # 32 or 64 bit
set(build_linux32 0) set(build_linux32 0)
set(build_win64 0) # normal or uwp
set(build_winstore64 0)
if (WIN32) if (WIN32)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64")
set(build_win64 1)
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
set(build_winstore 1) set(build_winstore 1)
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64")
set(build_win64 1)
set(build_winstore 1)
set(build_winstore64 1)
endif() endif()
elseif (APPLE) elseif (APPLE)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx") if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
@ -90,7 +99,9 @@ else()
endif() endif()
endif() endif()
if (NOT APPLE OR build_osx) if (build_win64)
get_filename_component(libs_loc "../Libraries/win64" REALPATH)
elseif (NOT APPLE OR build_osx)
get_filename_component(libs_loc "../Libraries" REALPATH) get_filename_component(libs_loc "../Libraries" REALPATH)
else() else()
get_filename_component(libs_loc "../Libraries/macos" REALPATH) get_filename_component(libs_loc "../Libraries/macos" REALPATH)