fix a minor bug in Launcher, add -Wl,-gc-sections to generate smaller executables

This commit is contained in:
Wolfgang Thaller 2014-10-05 23:47:37 +02:00
parent 04e7e64a55
commit 7581140436
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_FLAGS "-Wno-multichar") set(CMAKE_C_FLAGS "-Wno-multichar")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections")
add_application(Launcher add_application(Launcher
FILES Launcher.c CONSOLE) FILES Launcher.c CONSOLE)

View File

@ -47,7 +47,7 @@ void EjectOldDisk()
if(h) if(h)
{ {
short refNum = **(short**)h; short refNum = **(short**)h;
printf("Ejecting disk (refNum = %d)\n", refNum); printf("Ejecting disk (refNum = %d)\n", (int)refNum);
Eject(NULL, refNum); Eject(NULL, refNum);
UnmountVol(NULL, refNum); UnmountVol(NULL, refNum);
@ -136,7 +136,7 @@ int main()
printf("Launching...\n"); printf("Launching...\n");
err = LaunchApplication(&lpb); err = LaunchApplication(&lpb);
printf("Still here after launch (err = %d). Press Enter to exit.\n"); printf("Still here after launch (err = %d). Press Enter to exit.\n", (int)err);
getchar(); getchar();
return 0; return 0;
} }

View File

@ -32,6 +32,9 @@ if(APPLE)
else() else()
set(CMAKE_CXX_FLAGS "-std=c++11") set(CMAKE_CXX_FLAGS "-std=c++11")
# save 200KB of code by removing unused stuff
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections")
add_application(Raytracer add_application(Raytracer
raytracer.c raytracer.c
) )