[nostalgia][buildcore] Remove Nostalgia specific args from setup-build.py

This commit is contained in:
Gary Talent 2021-03-02 21:02:16 -06:00
parent eca8641bec
commit 36de17bc2d
4 changed files with 30 additions and 35 deletions

View File

@ -3,18 +3,25 @@ set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19
project(nostalgia) project(nostalgia)
set(NOSTALGIA_BUILD_TYPE "Native" CACHE STRING "The type of build to produce(Native/GBA)") set(QTDIR "" CACHE PATH "Path to Qt Libraries")
set(NOSTALGIA_IDE_BUILD ON CACHE STRING "Build for IDE's to run")
set(NOSTALGIA_QT_PATH "" CACHE PATH "Path to Qt Libraries") set(BUILDCORE_TARGET "Native" CACHE STRING "The type of build to produce(Native/GBA)")
set(NOSTALGIA_BUILD_PLAYER ON CACHE BOOL "Build Player") set(NOSTALGIA_BUILD_PLAYER ON CACHE BOOL "Build Player")
set(NOSTALGIA_BUILD_STUDIO ON CACHE BOOL "Build Studio") set(NOSTALGIA_BUILD_STUDIO ON CACHE BOOL "Build Studio")
set(OX_ENABLE_TRACEHOOK OFF CACHE BOOL "Generate OxTraceHook shared library for uprobes")
if(BUILDCORE_TARGET STREQUAL "gba")
set(NOSTALGIA_BUILD_TYPE "GBA")
else()
set(NOSTALGIA_BUILD_TYPE "Native")
endif()
if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
set(NOSTALGIA_BUILD_STUDIO OFF) set(NOSTALGIA_BUILD_STUDIO OFF)
set(OX_BARE_METAL ON) set(OX_BARE_METAL ON)
set(OX_USE_STDLIB OFF) set(OX_USE_STDLIB OFF)
else() else()
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${NOSTALGIA_QT_PATH}) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR})
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif() endif()
@ -23,7 +30,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
include(GenerateExportHeader) include(GenerateExportHeader)
include(address_sanitizer) include(address_sanitizer)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist/${NOSTALGIA_BUILD_CONFIG}") set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist/${BUILDCORE_BUILD_CONFIG}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@ -87,11 +94,6 @@ if(NOT MSVC)
endif() endif()
endif() endif()
if(NOSTALGIA_IDE_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
if(APPLE) if(APPLE)
set(CMAKE_MACOSX_RPATH OFF) set(CMAKE_MACOSX_RPATH OFF)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia") set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia")
@ -101,9 +103,9 @@ if(APPLE)
set(NOSTALGIA_DIST_RESOURCES nostalgia-studio.app/Contents/Resources) set(NOSTALGIA_DIST_RESOURCES nostalgia-studio.app/Contents/Resources)
set(NOSTALGIA_DIST_MAC_APP_CONTENTS nostalgia-studio.app/Contents) set(NOSTALGIA_DIST_MAC_APP_CONTENTS nostalgia-studio.app/Contents)
else() else()
set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib/nostalgia" "$ORIGIN/../") set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib/ox" "$ORIGIN/../lib/nostalgia" "$ORIGIN/../")
if(NOT ${NOSTALGIA_QT_PATH} STREQUAL "") if(QTDIR)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${NOSTALGIA_QT_PATH}/lib") set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${QTDIR}/lib")
endif() endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(NOSTALGIA_DIST_BIN bin) set(NOSTALGIA_DIST_BIN bin)

View File

@ -33,8 +33,8 @@ debug-studio: install
.PHONY: configure-gba .PHONY: configure-gba
configure-gba: configure-gba:
${ENV_RUN} ${SETUP_BUILD} --target gba --build_type release ${ENV_RUN} ${SETUP_BUILD} --toolchain=cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=release
.PHONY: configure-gba-debug .PHONY: configure-gba-debug
configure-gba-debug: configure-gba-debug:
${ENV_RUN} ${SETUP_BUILD} --target gba --build_type debug ${ENV_RUN} ${SETUP_BUILD} --toolchain=cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=debug

View File

@ -94,17 +94,17 @@ endif
.PHONY: configure-xcode .PHONY: configure-xcode
configure-xcode: configure-xcode:
${ENV_RUN} ${SETUP_BUILD} --vcpkg_dir ${VCPKG_DIR} --build_tool xcode ${ENV_RUN} ${SETUP_BUILD} --toolchain=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake --build_tool=xcode
.PHONY: configure-release .PHONY: configure-release
configure-release: configure-release:
${ENV_RUN} ${SETUP_BUILD} --vcpkg_dir ${VCPKG_DIR} --build_type release ${ENV_RUN} ${SETUP_BUILD} --toolchain=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake --build_type=release
.PHONY: configure-debug .PHONY: configure-debug
configure-debug: configure-debug:
${ENV_RUN} ${SETUP_BUILD} --vcpkg_dir ${VCPKG_DIR} --build_type debug ${ENV_RUN} ${SETUP_BUILD} --toolchain=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake --build_type=debug
.PHONY: configure-asan .PHONY: configure-asan
configure-asan: configure-asan:
${ENV_RUN} ${SETUP_BUILD} --vcpkg_dir ${VCPKG_DIR} --build_type asan ${ENV_RUN} ${SETUP_BUILD} --toolchain=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake --build_type=asan

View File

@ -12,20 +12,14 @@ from pybb import mkdir, rm
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--target', help='Platform target ({OS}-{Arch},gba)', parser.add_argument('--target', help='Platform target',
default='{:s}-{:s}'.format(sys.platform, platform.machine())) default='{:s}-{:s}'.format(sys.platform, platform.machine()))
parser.add_argument('--build_type', help='Build type (asan,debug,release)', default='release') parser.add_argument('--build_type', help='Build type (asan,debug,release)', default='release')
parser.add_argument('--build_tool', help='Build tool (default,xcode)', default='') parser.add_argument('--build_tool', help='Build tool (default,xcode)', default='')
parser.add_argument('--vcpkg_dir', help='Path to VCPKG') parser.add_argument('--toolchain', help='Path to CMake toolchain file')
parser.add_argument('--current_build', help='Indicates whether or not to make this the active build', default=1)
args = parser.parse_args() args = parser.parse_args()
if args.target == 'gba':
toolchain = '-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake'
nostalgia_build_type = 'GBA'
else:
toolchain = '-DCMAKE_TOOLCHAIN_FILE={:s}/scripts/buildsystems/vcpkg.cmake'.format(args.vcpkg_dir)
nostalgia_build_type = 'Native'
if args.build_type == 'asan': if args.build_type == 'asan':
build_type_arg = 'Debug' build_type_arg = 'Debug'
sanitizer_status = 'ON' sanitizer_status = 'ON'
@ -44,8 +38,8 @@ def main():
else: else:
build_config = '{:s}-{:s}'.format(args.target, args.build_type) build_config = '{:s}-{:s}'.format(args.target, args.build_type)
if 'NOSTALGIA_QT_PATH' in os.environ: if 'QTDIR' in os.environ:
qt_path = '-DNOSTALGIA_QT_PATH={:s}'.format(os.environ['NOSTALGIA_QT_PATH']) qt_path = '-DQTDIR={:s}'.format(os.environ['QTDIR'])
else: else:
qt_path = '' qt_path = ''
@ -66,17 +60,16 @@ def main():
mkdir(build_dir) mkdir(build_dir)
subprocess.run(['cmake', '-S', project_dir, '-B', build_dir, build_tool, subprocess.run(['cmake', '-S', project_dir, '-B', build_dir, build_tool,
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
'-DCMAKE_TOOLCHAIN_FILE={:s}'.format(args.toolchain),
'-DCMAKE_BUILD_TYPE={:s}'.format(build_type_arg), '-DCMAKE_BUILD_TYPE={:s}'.format(build_type_arg),
'-DUSE_ASAN={:s}'.format(sanitizer_status), '-DUSE_ASAN={:s}'.format(sanitizer_status),
'-DNOSTALGIA_IDE_BUILD=OFF', '-DBUILDCORE_BUILD_CONFIG={:s}'.format(build_config),
'-DNOSTALGIA_BUILD_CONFIG={:s}'.format(build_config), '-DBUILDCORE_TARGET={:s}'.format(args.target),
'-DNOSTALGIA_BUILD_TYPE={:s}'.format(nostalgia_build_type),
qt_path, qt_path,
toolchain,
]) ])
mkdir('dist') mkdir('dist')
if args.target != 'gba': if int(args.current_build) != 0:
cb = open('.current_build', 'w') cb = open('.current_build', 'w')
cb.write(args.build_type) cb.write(args.build_type)
cb.close() cb.close()