Split off the DOL to improve the build process

This commit is contained in:
dbalatoni13 2025-04-08 17:12:51 +02:00
parent a95def6dc0
commit 54d85f487c
6 changed files with 32 additions and 14 deletions

View file

@ -8,6 +8,8 @@ endif ()
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(VERSION 0)
# Set build type to Debug if not specified # Set build type to Debug if not specified
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
@ -106,20 +108,28 @@ set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "-std=c89 -Dinline=
endforeach() endforeach()
endif () endif ()
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
add_executable(marioparty4 ${DOLPHIN_FILES} ${GAME_FILES} ${PORT_FILES}) add_library(dol SHARED ${DOLPHIN_FILES} ${GAME_FILES} ${PORT_FILES})
set_property(TARGET marioparty4 PROPERTY ENABLE_EXPORTS ON) target_compile_definitions(dol PRIVATE TARGET_PC TARGET_DOL VERSION=${VERSION} MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4)
target_compile_definitions(marioparty4 PRIVATE TARGET_PC VERSION=0 TARGET_MAIN) target_include_directories(dol PRIVATE include build/GMPE01_00/include)
target_compile_definitions(musyx PRIVATE MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4) target_link_libraries(dol PRIVATE aurora::core aurora::gx aurora::vi musyx)
target_include_directories(marioparty4 PRIVATE include build/GMPE01_00/include)
if (MSVC) if (MSVC)
target_link_options(marioparty4 PRIVATE "/DEF:${CMAKE_SOURCE_DIR}/dol.def") target_link_options(dol PRIVATE "/DEF:${CMAKE_SOURCE_DIR}/dol.def")
endif () else ()
target_link_libraries(marioparty4 PRIVATE aurora::core aurora::gx aurora::vi aurora::main musyx) target_compile_options(dol PRIVATE "-fvisibility=default")
endif()
add_library(bootDll SHARED src/REL/bootDll/main.c src/REL/bootDll/language.c) add_library(bootDll SHARED src/REL/bootDll/main.c src/REL/bootDll/language.c)
target_compile_definitions(bootDll PRIVATE TARGET_PC VERSION=0 TARGET_REL) target_compile_definitions(bootDll PRIVATE TARGET_PC VERSION=${VERSION})
target_include_directories(bootDll PRIVATE include build/GMPE01_00/include) target_include_directories(bootDll PRIVATE include build/GMPE01_00/include)
if (MSVC)
set_target_properties(bootDll PROPERTIES LINK_FLAGS "/EXPORT:ObjectSetup") set_target_properties(bootDll PROPERTIES LINK_FLAGS "/EXPORT:ObjectSetup")
target_link_libraries(bootDll PRIVATE musyx marioparty4) else ()
endif()
set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
target_link_libraries(bootDll PRIVATE dol musyx)
add_executable(marioparty4 src/port/portmain.c)
target_compile_definitions(marioparty4 PRIVATE TARGET_PC VERSION=${VERSION})
target_include_directories(marioparty4 PRIVATE include)
target_link_libraries(marioparty4 PRIVATE dol aurora::main)

View file

@ -1,4 +1,5 @@
EXPORTS EXPORTS
game_main
byteswap_u32 byteswap_u32
byteswap_s32 byteswap_s32
OSReport OSReport

View file

@ -22,7 +22,7 @@
#endif #endif
#if _WIN32 #if _WIN32
#ifdef TARGET_MAIN #ifdef TARGET_DOL
#define SHARED_SYM __declspec(dllexport) #define SHARED_SYM __declspec(dllexport)
#else #else
#define SHARED_SYM __declspec(dllimport) #define SHARED_SYM __declspec(dllimport)

View file

@ -2,7 +2,7 @@
static u32 frand_seed; static u32 frand_seed;
extern s32 rand8(void); extern s32 rand8(void);
static inline u32 frandom(u32 param) static inline u32 frandom(u32 param)
{ {

View file

@ -87,7 +87,7 @@ void aurora_log_callback(AuroraLogLevel level, const char* module, const char *m
#endif #endif
#ifdef TARGET_PC #ifdef TARGET_PC
int main(int argc, char *argv[]) int game_main(int argc, char *argv[])
#else #else
void main(void) void main(void)
#endif #endif

7
src/port/portmain.c Normal file
View file

@ -0,0 +1,7 @@
int game_main(int argc, char *argv[]);
int main(int argc, char *argv[])
{
game_main(argc, argv);
}