Skip to content

Commit

Permalink
[GOIL] build scripts for OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbirccyn committed Dec 4, 2023
1 parent 510f084 commit 0842720
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 0 deletions.
3 changes: 3 additions & 0 deletions goil/makefile-macosx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arm64
universal
x86_64
28 changes: 28 additions & 0 deletions goil/makefile-macosx/build+debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/python3
# -*- coding: UTF-8 -*-

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, subprocess, atexit

#-----------------------------------------------------------------------------------------------------------------------

def cleanup():
if childProcess.poll () == None :
childProcess.kill ()

#-----------------------------------------------------------------------------------------------------------------------

#--- Register a function for killing subprocess
atexit.register (cleanup)
#--- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
#---
childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "debug"], cwd=scriptDir)
#--- Wait for subprocess termination
if childProcess.poll () == None :
childProcess.wait ()
if childProcess.returncode != 0 :
sys.exit (childProcess.returncode)

#-----------------------------------------------------------------------------------------------------------------------
28 changes: 28 additions & 0 deletions goil/makefile-macosx/build+lto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/python3
#! /usr/bin/python3

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, subprocess, atexit

#-----------------------------------------------------------------------------------------------------------------------

def cleanup():
if childProcess.poll () == None :
childProcess.kill ()

#-----------------------------------------------------------------------------------------------------------------------

#--- Register a function for killing subprocess
atexit.register (cleanup)
#--- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
#---
childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "lto"], cwd=scriptDir)
#--- Wait for subprocess termination
if childProcess.poll () == None :
childProcess.wait ()
if childProcess.returncode != 0 :
sys.exit (childProcess.returncode)

#-----------------------------------------------------------------------------------------------------------------------
28 changes: 28 additions & 0 deletions goil/makefile-macosx/build+release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/python3
# -*- coding: UTF-8 -*-

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, subprocess, atexit

#-----------------------------------------------------------------------------------------------------------------------

def cleanup():
if childProcess.poll () == None :
childProcess.kill ()

#-----------------------------------------------------------------------------------------------------------------------

#--- Register a function for killing subprocess
atexit.register (cleanup)
#--- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
#---
childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "release"], cwd=scriptDir)
#--- Wait for subprocess termination
if childProcess.poll () == None :
childProcess.wait ()
if childProcess.returncode != 0 :
sys.exit (childProcess.returncode)

#-----------------------------------------------------------------------------------------------------------------------
32 changes: 32 additions & 0 deletions goil/makefile-macosx/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! /usr/bin/python3
# -*- coding: UTF-8 -*-

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, json

#-----------------------------------------------------------------------------------------------------------------------

#----------------------------------------------------------------- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
os.chdir (scriptDir)
#----------------------------------------------------------------- Get goal as first argument
goal = "all" # Default goal
if len (sys.argv) > 1 :
goal = sys.argv [1]
#----------------------------------------------------------------- Get max parallel jobs as second argument
maxParallelJobs = 0 # 0 means use host processor count
if len (sys.argv) > 2 :
maxParallelJobs = int (sys.argv [2])
#----------------------------------------------------------------- Get json description dictionary
jsonFilePath = os.path.normpath (scriptDir + "/../build/output/file-list.json")
with open (jsonFilePath) as f:
dictionary = json.loads (f.read ())
LIBPM_DIRECTORY_PATH = dictionary ["LIBPM_DIRECTORY_PATH"]
#----------------------------------------------------------------- Import builder
sys.path.append (os.path.abspath (LIBPM_DIRECTORY_PATH + "/python-makefiles"))
from macosx_gcc_tools import buildForMacOS
#----------------------------------------------------------------- Build
buildForMacOS (dictionary, jsonFilePath, "goil", "build", goal, maxParallelJobs, maxParallelJobs == 1)

#-----------------------------------------------------------------------------------------------------------------------
28 changes: 28 additions & 0 deletions goil/makefile-macosx/clean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/python3
# -*- coding: UTF-8 -*-

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, subprocess, atexit

#-----------------------------------------------------------------------------------------------------------------------

def cleanup():
if childProcess.poll () == None :
childProcess.kill ()

#-----------------------------------------------------------------------------------------------------------------------

#--- Register a function for killing subprocess
atexit.register (cleanup)
#--- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
#---
childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "clean"], cwd=scriptDir)
#--- Wait for subprocess termination
if childProcess.poll () == None :
childProcess.wait ()
if childProcess.returncode != 0 :
sys.exit (childProcess.returncode)

#-----------------------------------------------------------------------------------------------------------------------
28 changes: 28 additions & 0 deletions goil/makefile-macosx/verbose-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/python3
# -*- coding: UTF-8 -*-

#-----------------------------------------------------------------------------------------------------------------------

import sys, os, subprocess, atexit

#-----------------------------------------------------------------------------------------------------------------------

def cleanup():
if childProcess.poll () == None :
childProcess.kill ()

#-----------------------------------------------------------------------------------------------------------------------

#--- Register a function for killing subprocess
atexit.register (cleanup)
#--- Get script absolute path
scriptDir = os.path.dirname (os.path.abspath (sys.argv [0]))
#---
childProcess = subprocess.Popen (["/usr/bin/python3", "build.py", "all", "1"], cwd=scriptDir)
#--- Wait for subprocess termination
if childProcess.poll () == None :
childProcess.wait ()
if childProcess.returncode != 0 :
sys.exit (childProcess.returncode)

#-----------------------------------------------------------------------------------------------------------------------

0 comments on commit 0842720

Please sign in to comment.