1. doyoulovecake

    OP doyoulovecake Newbie
    Newcomer

    Joined:
    Jan 22, 2020
    Messages:
    3
    Country:
    United States
    My premake builds 3dsx files that only work on emulators and crash on real 3DS hardware, since I want to move from Makefiles i would like your help to debug which flags I am missing here. Translating the Makefile to a command line compilation would also help a lot since it doesn't output how the program is being linked.

    Example premake file, the Makefile I want to translate is the default included in devkitpro 3ds examples:
    Code:
    workspace "v"
       configurations { "Debug", "Release" }
    
    local devkitpro = os.getenv("DEVKITPRO")
    local devkitarm = os.getenv("DEVKITARM")
    
    project "v"
       kind "ConsoleApp"
       language "C++"
       targetdir "bin/%{cfg.buildcfg}"
    
       makesettings [[
           CXX = arm-none-eabi-g++
           LD = arm-none-eabi-ld
       ]]
    
       files {
           "./src/**.h",
           "./src/**.cpp"
       }
    
       defines {
           "_3DS",
           "ARM11",
       }
    
       includedirs {
           "include",
           "include/m3d",
           "src",
           devkitpro .. "/libctru/include",
           devkitpro .. "/portlibs/3ds/include",
       }
    
       links {
           "m3dia",
           "citro2d",
           "citro3d",
           "ctru",
       }
    
       libdirs {
           devkitpro .. "/libctru/lib",
           devkitpro .. "/portlibs/3ds/lib",
       }
    
       buildoptions {
           "-g",
           "-Wall",
           "-std=gnu++11",
           "-mword-relocations",
           "-ffunction-sections",
           "-fno-rtti",
           "-fno-exceptions",
           "-fomit-frame-pointer",
           "-march=armv6k",
           "-mtune=mpcore",
           "-mfloat-abi=hard",
           "-mtp=soft",
       }
    
       linkoptions {
           "-o vida.3dsx",
           "-specs=3dsx.specs",
           "-march=armv6k",
           "-mtune=mpcore",
           "-mfloat-abi=hard",
           "-mtp=soft",
           "-Wl,-Map,8.map",
       }
    
       filter "configurations:Debug"
           defines { "DEBUG" }
           symbols "On"
    
       filter "configurations:Release"
           defines { "RELEASE" }
           optimize "On"
    
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan
    Member

    Joined:
    Jul 28, 2008
    Messages:
    850
    Country:
    United States
    Citra can load elf files. Homebrew loaders on 3ds hardware cannot. You are skipping the elf to 3dsx conversion process.
    Also - this is a bad idea. Just add some print statements to the makefile to see the link command line - not sure what you are hoping to see aside from that.
     
    doyoulovecake likes this.
  3. ghjfdtg

    ghjfdtg GBAtemp Advanced Fan
    Member

    Joined:
    Jul 13, 2014
    Messages:
    550
    Country:
    ??? Why don't you just use the provided makefiles? What's wrong with them? They have a guarantee to work unlike what you have thrown together there and i would strongly recommend not rolling your own build system.
     
  4. doyoulovecake

    OP doyoulovecake Newbie
    Newcomer

    Joined:
    Jan 22, 2020
    Messages:
    3
    Country:
    United States
    Thanks for being helpful elhobbs! I will search how to generate the elf files and adapt to my preferred build system.
     
  5. elhobbs

    elhobbs GBAtemp Advanced Fan
    Member

    Joined:
    Jul 28, 2008
    Messages:
    850
    Country:
    United States
    It is not promising that you did not understand what I said - but good luck anyway.
    I will caution you that this likely falls into the category of things that the devkitarm maintainers frown upon. It is fine to do for yourself, but best not shared with others.
    Still curious though as to what the actual benefit is. What does this get you that a makefile fails to provide?
     
    lone_wolf323 and Deleted-236924 like this.
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - homebrew, Compile, premake