Пример #1
0
def build():
    if common.needs_setup():
        setup.setup()

    print("\nGenerating project with CMake")
    common.exec([
        'cmake',
        '-S', '.',
        '-B', GEN_PATH,
        "-Dgtest_force_shared_crt=ON"
    ], "Could not generate project")

    os.chdir('gen/Linux')
    common.exec(['make'], "Could not build OUI engine")
    os.chdir('../..')

    outputFolder = "{}/linux".format(common.OUTPUT_FOLDER)
    if not os.path.isdir(outputFolder):
        os.makedirs(outputFolder)

    print("\nCopying OUI binaries")
    shutil.copy2("{}/OUI_Runtime".format(GEN_PATH), outputFolder)
    shutil.copy2("{}/tests/Test-OUI-runtime".format(GEN_PATH), outputFolder)
    shutil.copy2("{}/libOUI.so".format(OUI_ENGINE_BINARY_PATH), outputFolder)

    print("\nCopying data folder")
    if os.path.isdir(outputFolder + '/data'):
        shutil.rmtree(outputFolder + '/data')
    shutil.copytree('{}/data'.format(GEN_PATH), outputFolder + '/data')
Пример #2
0
def build():

    if common.needs_setup():
        setup.setup()

    debug = False
    if "-D" in sys.argv or "--debug" in sys.argv:
        debug = True

    # Will show our "no Visual Studio" error instead of CMake's
    msbuild_location = find_ms_build()

    version = get_visual_studio_version()

    build_type = "Debug" if debug else "Release"

    print("\nGenerating project with CMake")
    common.exec([
        'cmake', '-G', VISUAL_STUDIO_VERSION_TO_GENERATOR[version], '-S', '.',
        '-B', GEN_PATH, "-DSDL2_PATH='{}'".format(SDL2_PATH),
        "-DSDL2_IMAGE_PATH='{}'".format(SDL2_IMAGE_PATH),
        "-DSDL2_TTF_PATH='{}'".format(SDL2_TTF_PATH),
        "-Dgtest_force_shared_crt=ON", "-DCMAKE_BUILD_TYPE={}".format(
            build_type.upper())
    ], "Could not generate project\nAre Visual Studio C++ tools and CMake 3.14+ installed?"
                )

    print("\nBuilding project with MSBuild.exe")
    common.exec([
        '{}'.format(msbuild_location), '{}/ALL_BUILD.vcxproj'.format(GEN_PATH),
        '/p:Configuration={}'.format(build_type), '/p:Platform=x64'
    ], "Could not build project")

    outputFolder = "{}/windows/{}".format(common.OUTPUT_FOLDER,
                                          "debug" if debug else "release")

    print('\nCopying OUI headers')
    if os.path.isdir("{}/include".format(common.OUTPUT_FOLDER)):
        shutil.rmtree("{}/include".format(common.OUTPUT_FOLDER))
    shutil.copytree("include", "{}/include".format(common.OUTPUT_FOLDER))

    print("\nCopying OUI binaries")
    file_util.copyAllWithExt(path='{}/{}'.format(GEN_PATH, build_type),
                             ext='dll',
                             outputPath=outputFolder)
    file_util.copyAllWithExt(path='{}/{}'.format(GEN_PATH, build_type),
                             ext='lib',
                             outputPath=outputFolder)
    file_util.copyAllWithExt(path='{}/tests/{}'.format(GEN_PATH, build_type),
                             ext='exe',
                             outputPath=outputFolder)

    print("\nCopying SDL binaries")
    file_util.copyAllWithExt(path='{}/windows'.format(common.LIB_PATH),
                             ext='dll',
                             outputPath=outputFolder,
                             excludeFolders=['x86'])

    print("\nFinished build")
Пример #3
0
def setup():
    if not os.path.isdir("{}/OUI-engine".format(common.LIB_PATH)):

        ouiEngineBranch = "master"
        if "-B" in sys.argv or "--branch" in sys.argv:
            branchIndex = (sys.argv.index("-B") if "-B" in sys.argv else
                           sys.argv.index("--branch")) + 1
            ouiEngineBranch = sys.argv[branchIndex]

        print("## Cloning OUI engine into ./lib/ (branch {})".format(
            ouiEngineBranch))
        common.exec([
            'git', 'clone', "-b", ouiEngineBranch,
            'https://github.com/nik-m2/OUI-engine.git', 'lib/OUI-engine'
        ], "Failed to clone OUI engine")

    print("Downloading Google Test")
    for binary_info in LIB_INFO:
        file_util.download_and_unzip(binary_info)

    common.cleanup()
Пример #4
0
def build():
    if common.needs_setup():
        setup.setup()

    print("\nGenerating project with CMake")
    common.exec(
        ['cmake', '-S', '.', '-B', GEN_PATH, "-Dgtest_force_shared_crt=ON"],
        "Could not generate project")

    os.chdir('gen/Linux')
    common.exec(['make'], "Could not build OUI engine")
    os.chdir('../..')

    outputFolder = "{}/linux".format(common.OUTPUT_FOLDER)

    print('\nCopying OUI headers')
    if os.path.isdir("{}/include".format(common.OUTPUT_FOLDER)):
        shutil.rmtree("{}/include".format(common.OUTPUT_FOLDER))
    shutil.copytree("include", "{}/include".format(common.OUTPUT_FOLDER))

    print("\nCopying OUI binaries")
    file_util.copyAllWithExt(path='{}'.format(GEN_PATH),
                             ext='so',
                             outputPath=outputFolder)
Пример #5
0
def test():

    option = ""
    suite = ""
    if len(sys.argv) > 2:
        suite = sys.argv[2]
    if len(sys.argv) > 1:
        option = sys.argv[1]
        if option != "engine" and option != "runtime":
            suite = option
            option = ""

    if suite != "":
        suite = "--gtest_filter={}*".format(suite)

    win_build.build()

    if option is "" or option == "engine":
        print("\nRunning OUI engine tests")
        common.exec(['bin/windows/Test-OUI-engine.exe', suite])

    if option is "" or option == "runtime":
        print("\nRunning OUI runtime tests")
        common.exec(['bin/windowsTest-OUI-runtime.exe', suite])
Пример #6
0
def run(channel, tag, body, connection):
    common.exec(body)

    cb = functools.partial(ack_message, channel, tag)
    connection.add_callback_threadsafe(cb)
Пример #7
0
def build():

    if not os.path.isdir("{}/OUI-engine".format(common.LIB_PATH)) or \
            not os.path.isdir("{}/gtest".format(common.LIB_PATH)):
        setup.setup()

    debug = False
    if "-D" in sys.argv or "--debug" in sys.argv:
        debug = True

    runAfterBuild = False
    if "-R" in sys.argv or "--run" in sys.argv:
        runAfterBuild = True

    common.exec(["cmake", "--version"],
        errorMessage="You must install CMake 3.14 or above",
        showOutput=False
    )

    # Will show our "no Visual Studio" error instead of CMake's
    msbuild_location = find_ms_build()

    version = get_visual_studio_version()

    build_type = "Debug" if debug else "Release"

    python_command = "python3"
    try:
        command_failed = subprocess.call(["python3", "--version"])
    except:
        command_failed = True
    print("command failed?" + str(command_failed))
    if command_failed:
        python_command = "python"

    print("## Building OUI engine")
    os.chdir("lib/OUI-engine")
    common.exec([python_command, 'scripts/build.py', "-D" if debug else ""], "Error building OUI engine")
    os.chdir("../..")

    print("\nGenerating project with CMake")
    common.exec([
        'cmake',
        '-G', VISUAL_STUDIO_VERSION_TO_GENERATOR[version],
        '-S', '.',
        '-B', GEN_PATH,
        "-Dgtest_force_shared_crt=ON",
        "-DCMAKE_BUILD_TYPE={}".format(build_type.upper())
    ], "Could not generate project\nAre Visual Studio C++ tools and CMake 3.14+ installed?")

    print("\nBuilding project with MSBuild.exe")
    common.exec([
        '{}'.format(msbuild_location),
        '{}/ALL_BUILD.vcxproj'.format(GEN_PATH),
        '/p:Configuration={}'.format(build_type),
        '/p:Platform=x64'
    ], "Could not build project")

    outputFolder = "{}/windows/{}".format(common.OUTPUT_FOLDER, "debug" if debug else "release")

    if not os.path.isdir(outputFolder):
        os.makedirs(outputFolder, exist_ok=True)

    ouiEngineBinaryPath = "{}/{}".format(OUI_ENGINE_BINARY_PATH, "debug" if debug else "release")

    print("\nCopying OUI binaries")
    copyAllWithExt(
        path='{}/{}'.format(GEN_PATH, build_type),
        ext='dll',
        outputPath=outputFolder
    )
    copyAllWithExt(
        path=ouiEngineBinaryPath,
        ext='dll',
        outputPath=outputFolder
    )
    copyAllWithExt(
        path='{}/{}'.format(GEN_PATH, build_type),
        ext='exe',
        outputPath=outputFolder
    )
    copyAllWithExt(
        path='{}/tests/{}'.format(GEN_PATH, build_type),
        ext='exe',
        outputPath=outputFolder
    )

    print("\nCopying SDL binaries")
    copyAllWithExt(
        path='{}/windows'.format(common.LIB_PATH),
        ext='dll',
        outputPath=outputFolder,
        excludeFolders=['x86']
    )
    
    print("\nCopying data folder")
    if os.path.isdir(outputFolder + '/data'):
        shutil.rmtree(outputFolder + '/data')
    shutil.copytree('{}/data'.format(GEN_PATH), outputFolder + '/data')

    print("\nFinished build")

    if runAfterBuild:
        print("Starting OUI Runtime")
        common.exec("{}/OUI_Runtime.exe".format(outputFolder), "Error running OUI")