Homebrew Compile homebrew with premake

doyoulovecake

New Member
OP
Newbie
Joined
Jan 22, 2020
Messages
3
Trophies
0
Age
34
XP
44
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"
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,029
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.
 
  • Like
Reactions: doyoulovecake

ghjfdtg

Well-Known Member
Member
Joined
Jul 13, 2014
Messages
1,347
Trophies
1
XP
3,224
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.
 

doyoulovecake

New Member
OP
Newbie
Joined
Jan 22, 2020
Messages
3
Trophies
0
Age
34
XP
44
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.
Thanks for being helpful elhobbs! I will search how to generate the elf files and adapt to my preferred build system.
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,029
Country
United States
Thanks for being helpful elhobbs! I will search how to generate the elf files and adapt to my preferred build system.
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?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Sorry for accidentally bending over