Skip to content

Commit

Permalink
Improved GLFW for installation and compilation with GLFW in standard …
Browse files Browse the repository at this point in the history
…library.
  • Loading branch information
nthnn committed Dec 13, 2024
1 parent a7664a1 commit c414b00
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ def include_sha_headers():
lib_source_files.append(os.path.join(root, file))

try:
if ARCH == '64bit':
download_file(get_glfw_file('win64'), 'glfw.zip')
shutil.move(
os.path.join('temp', 'glfw-3.4.bin.WIN64'),
os.path.join('temp', 'glfw-3.4')
)
elif ARCH == '32bit':
download_file(get_glfw_file('win32'), 'glfw.zip')
shutil.move(
os.path.join('temp', 'glfw-3.4.bin.WIN32'),
os.path.join('temp', 'glfw-3.4')
)

ext_instructions = get_ext_instructions()
if PLATFORM == 'Linux':
subprocess.run(['sudo', 'apt', 'update'])
Expand Down Expand Up @@ -216,18 +229,24 @@ def include_sha_headers():
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]

include_sha_headers()
glfwDll = os.path.join('temp', 'glfw-3.4', 'lib-mingw-w64', 'glfw3.dll')
glfwDll = os.path.join(
'dist', 'n8lang', 'modules',
'[email protected]', 'lib', 'glfw3.dll'
)
os.rename(
os.path.join(
'temp', 'glfw-3.4',
'lib-mingw-w64', 'glfw3.dll'
),
glfwDll
)

lib_source_files += [glfwDll]
lib_build_args = [
'g++', '-static', '-static-libgcc', '-Iinclude',
'-Istd', '-shared', '-o', OUTPUT_LIBRARY + '.dll'
] + ext_instructions + lib_headers + lib_source_files + cpp_files + cc_files

os.rename(glfwDll, os.path.join(
'dist', 'n8lang', 'modules',
'[email protected]', 'lib', 'glfw3.dll'
))

print("Executing:")
print(' '.join(exe_build_args))
subprocess.run(exe_build_args)
Expand Down

0 comments on commit c414b00

Please sign in to comment.