Skip to content

Commit e1a66be

Browse files
committed
Update ResGen tests
1 parent fe3f4c1 commit e1a66be

File tree

4 files changed

+29
-33
lines changed

4 files changed

+29
-33
lines changed

Tests/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ add_executable(dl-test-math MathApp.c)
1010
target_link_libraries(dl-test-math PRIVATE dl math-resolver)
1111
ctr_create_3dsx(dl-test-math)
1212

13-
#add_executable(dl-test-interop InteropApp.c)
14-
#target_link_libraries(dl-test-interop PRIVATE dl libinterop-resolver)
15-
#ctr_create_3dsx(dl-test-interop)
13+
add_executable(dl-test-interop InteropApp.c)
14+
target_link_libraries(dl-test-interop PRIVATE dl interop-resolver)
15+
ctr_create_3dsx(dl-test-interop)
1616

1717
install(
1818
FILES
1919
${CMAKE_CURRENT_BINARY_DIR}/dl-test-math.3dsx
20-
# ${CMAKE_CURRENT_BINARY_DIR}/dl-test-interop.3dsx
20+
${CMAKE_CURRENT_BINARY_DIR}/dl-test-interop.3dsx
2121
TYPE BIN
2222
)

Tests/InteropApp.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,9 @@
1010

1111
typedef void (*InteropFn)(const char*);
1212

13-
static void stub() {}
14-
15-
void* ctrdlProgramResolver(const char* sym) {
16-
RESOLVER_ENTRY(consoleInit);
17-
RESOLVER_ENTRY(consoleSelect);
18-
RESOLVER_ENTRY(ctrdlThisHandle);
19-
RESOLVER_ENTRY(ctrdlInfo);
20-
RESOLVER_ENTRY(printf);
21-
RESOLVER_ENTRY(ctrdlFreeInfo);
22-
RESOLVER_ENTRY(dlclose);
23-
RESOLVER_ENTRY(dlerror);
24-
return stub;
25-
}
13+
// TODO: remove.
14+
void __register_frame_info(const void*, struct object*) {}
15+
void *__deregister_frame_info(const void *) {}
2616

2717
int main(int argc, char* argv[]) {
2818
gfxInitDefault();

Tests/Libs/CMakeLists.txt

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,31 @@ set(CMAKE_C_STANDARD_LIBRARIES "")
1212
set(CMAKE_CXX_STANDARD_LIBRARIES "")
1313
set(CMAKE_ASM_STANDARD_LIBRARIES "")
1414

15+
# Add "libmath" library.
1516
add_library(math SHARED Math.c)
17+
target_link_libraries(math PRIVATE dl-shared)
1618

19+
# Generate resolver for "libmath".
1720
add_custom_command(
18-
OUTPUT /home/user/Documents/repos/CTRDL/Build/Tests/Libs/libmath.s # $<TARGET_FILE_DIR:math>/libmath.s
19-
COMMAND ${RESGEN_PATH}/ResGen -b $<TARGET_FILE:math>
21+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libmath-resolver.s
22+
COMMAND ${RESGEN_PATH}/ResGen $<TARGET_FILE:math> -o ${CMAKE_CURRENT_BINARY_DIR}/libmath-resolver.s
2023
DEPENDS math
2124
)
22-
add_library(math-resolver OBJECT $<TARGET_FILE_DIR:math>/libmath.s)
25+
26+
# Add "libmath" resolver library (application will link to this).
27+
add_library(math-resolver OBJECT ${CMAKE_CURRENT_BINARY_DIR}/libmath-resolver.s)
2328
target_compile_options(math-resolver PRIVATE -g0)
2429

25-
#add_library(interop SHARED Interop.c)
26-
#add_library(libinterop-resolver INTERFACE libinterop.s)
27-
#target_link_libraries(interop PRIVATE dl-shared)
28-
#add_custom_command(
29-
# TARGET interop
30-
# POST_BUILD
31-
# COMMAND ${RESGEN_PATH}/ResGen -b $<TARGET_FILE:interop>
32-
# BYPRODUCTS libinterop.s
33-
#)
34-
35-
install(FILES $<TARGET_FILE:math>
36-
#$<TARGET_FILE:interop>
37-
TYPE BIN)
30+
# Setup "libinterop" like above.
31+
add_library(interop SHARED Interop.c)
32+
target_link_libraries(interop PRIVATE dl-shared)
33+
34+
add_custom_command(
35+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libinterop-resolver.s
36+
COMMAND ${RESGEN_PATH}/ResGen $<TARGET_FILE:interop> -o ${CMAKE_CURRENT_BINARY_DIR}/libinterop-resolver.s
37+
DEPENDS interop
38+
)
39+
add_library(interop-resolver OBJECT ${CMAKE_CURRENT_BINARY_DIR}/libinterop-resolver.s)
40+
target_compile_options(interop-resolver PRIVATE -g0)
41+
42+
install(FILES $<TARGET_FILE:math> $<TARGET_FILE:interop> TYPE BIN)

Tests/MathApp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
typedef void (*DoMathFn)(int, int);
99

10+
// TODO: remove.
1011
void __register_frame_info(const void*, struct object*) {}
1112
void *__deregister_frame_info(const void *) {}
1213

0 commit comments

Comments
 (0)