Skip to content

Commit

Permalink
Add cmake binary
Browse files Browse the repository at this point in the history
  • Loading branch information
8W9aG committed Aug 28, 2018
1 parent d3e78fd commit 851037d
Showing 1 changed file with 24 additions and 106 deletions.
130 changes: 24 additions & 106 deletions ci/nfbuildwindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,104 +17,8 @@ class NFBuildWindows(NFBuild):
def __init__(self):
super(self.__class__, self).__init__()
self.project_file = 'build.ninja'

def installClangFormat(self):
clang_format_vulcan_file = os.path.join('tools', 'clang-format.vulcan')
clang_format_extraction_folder = self.vulcanDownload(
clang_format_vulcan_file,
'clang-format-5.0.0')
self.clang_format_binary = os.path.join(
os.path.join(
os.path.join(
clang_format_extraction_folder,
'clang-format'),
'bin'),
'clang-format')

def installNinja(self):
ninja_vulcan_file = os.path.join(
os.path.join(
os.path.join(
os.path.join('tools', 'buildtools'),
'spotify_buildtools'),
'software'),
'ninja.vulcan')
ninja_extraction_folder = self.vulcanDownload(
ninja_vulcan_file,
'ninja-1.6.0')
self.ninja_binary = os.path.join(
ninja_extraction_folder,
'ninja')
if 'PATH' not in os.environ:
os.environ['PATH'] = ''
if len(os.environ['PATH']) > 0:
os.environ['PATH'] += os.pathsep
os.environ['PATH'] += ninja_extraction_folder

def installMake(self):
make_vulcan_file = os.path.join('tools', 'make.vulcan')
make_extraction_folder = self.vulcanDownload(
make_vulcan_file,
'make-4.2.1')
make_bin_folder = os.path.join(
make_extraction_folder,
'bin')
os.environ['PATH'] += os.pathsep + make_bin_folder

def installVisualStudio(self):
vs_vulcan_file = os.path.join(
os.path.join(
os.path.join(
os.path.join('tools', 'buildtools'),
'spotify_buildtools'),
'software'),
'visualstudio.vulcan')
self.vs_extraction_folder = self.vulcanDownload(
vs_vulcan_file,
'visualstudio-2017')
sdk_version = '10.0.15063.0'
vc_tools_version = '14.10.25017'
vc_redist_version = '14.10.25008'
vc_redist_crt = 'Microsoft.VC150.CRT'
vs_root = self.vs_extraction_folder
sdk_root = os.path.join(vs_root, 'win10sdk')
vc_root = os.path.join(vs_root, 'VC')
vc_tools_root = os.path.join(vc_root, 'Tools', 'MSVC')
vc_redist_root = os.path.join(vc_root, 'Redist', 'MSVC')
os.environ['VS_ROOT'] = vs_root
os.environ['SDK_ROOT'] = sdk_root
os.environ['INCLUDE'] = os.pathsep.join([
os.path.join(sdk_root, 'Include', sdk_version, 'um'),
os.path.join(sdk_root, 'Include', sdk_version, 'ucrt'),
os.path.join(sdk_root, 'Include', sdk_version, 'shared'),
os.path.join(sdk_root, 'Include', sdk_version, 'winrt'),
os.path.join(vc_tools_root, vc_tools_version, 'include'),
os.path.join(vc_tools_root, vc_tools_version, 'atlmfc', 'include'),
os.environ.get('INCLUDE', '')])
os.environ['PATH'] = os.pathsep.join([
os.path.join(sdk_root, 'bin', sdk_version, 'x86'),
os.path.join(vc_tools_root, vc_tools_version, 'bin', 'HostX64', 'x86'),
os.path.join(vc_tools_root, vc_tools_version, 'bin', 'HostX64', 'x64'),
os.path.join(vc_redist_root, vc_redist_version, 'x64', vc_redist_crt),
os.path.join(vs_root, 'SystemCRT'),
os.environ.get('PATH', '')])
os.environ['LIB'] = os.pathsep.join([
os.path.join(sdk_root, 'Lib', sdk_version, 'um', 'x86'),
os.path.join(sdk_root, 'Lib', sdk_version, 'ucrt', 'x86'),
os.path.join(vc_tools_root, vc_tools_version, 'lib', 'x86'),
os.path.join(vc_tools_root, vc_tools_version, 'atlmfc', 'lib', 'x86'),
os.environ.get('LIB', '')])
os.environ['LIBPATH'] = os.pathsep.join([
os.path.join(vc_tools_root, vc_tools_version, 'lib', 'x86', 'store', 'references'),
os.path.join(sdk_root, 'UnionMetadata', sdk_version),
os.environ.get('LIBPATH', '')])

def installVulcanDependencies(self, android=False):
super(self.__class__, self).installVulcanDependencies(android)
self.installClangFormat()
self.installMake()
self.installVisualStudio()
self.installNinja()
self.cmake_binary = 'cmake'
self.android = False

def generateProject(self,
ios=False,
Expand Down Expand Up @@ -142,15 +46,10 @@ def generateProject(self,
'-DANDROID_STL=c++_shared'])
self.project_file = 'build.ninja'
else:
cl_exe = os.path.join(self.vs_extraction_folder, 'VC', 'Tools', 'MSVC', '14.10.25017', 'bin', 'HostX64', 'x86', 'cl.exe').replace('\\', '/')
rc_exe = os.path.join(self.vs_extraction_folder, 'win10sdk', 'bin', '10.0.15063.0', 'x64', 'rc.exe').replace('\\', '/')
link_exe = os.path.join(self.vs_extraction_folder, 'VC', 'Tools', 'MSVC', '14.10.25017', 'bin', 'HostX64', 'x86', 'link.exe').replace('\\', '/')
cmake_call.extend([
'-DCMAKE_C_COMPILER=' + cl_exe,
'-DCMAKE_CXX_COMPILER=' + cl_exe,
'-DCMAKE_RC_COMPILER=' + rc_exe,
'-DCMAKE_LINKER=' + link_exe,
'-DWINDOWS=1'])
'Visual Studio 15 2017 Win64',
'-DCMAKE_SYSTEM_NAME=WindowsStore',
'-DCMAKE_SYSTEM_VERSION=10.0'])
cmake_result = subprocess.call(cmake_call, cwd=self.build_directory)
if cmake_result != 0:
sys.exit(cmake_result)
Expand Down Expand Up @@ -192,3 +91,22 @@ def runIntegrationTests(self):
if cli_result:
sys.exit(cli_result)

def packageArtifacts(self):
lib_name = 'NFHTTP.lib'
cli_name = 'NFHTTPCLI.exe'
output_folder = os.path.join(self.build_directory, 'output')
artifacts_folder = os.path.join(output_folder, 'NFHTTP')
shutil.copytree('include', os.path.join(artifacts_folder, 'include'))
source_folder = os.path.join(self.build_directory, 'source')
lib_matches = self.find_file(source_folder, lib_name)
cli_matches = self.find_file(source_folder, cli_name)
shutil.copyfile(lib_matches[0], os.path.join(artifacts_folder, lib_name))
if not self.android:
shutil.copyfile(cli_matches[0], os.path.join(artifacts_folder, cli_name))
output_zip = os.path.join(output_folder, 'libNFHTTP.zip')
self.make_archive(artifacts_folder, output_zip)
if self.android:
final_zip_name = 'libNFHTTP-androidx86.zip'
if self.android_arm:
final_zip_name = 'libNFHTTP-androidArm64.zip'
shutil.copyfile(output_zip, final_zip_name)

0 comments on commit 851037d

Please sign in to comment.