mirror of
https://github.com/autc04/Retro68.git
synced 2024-10-06 10:55:15 +00:00
configure gcc to pass the right linker flags & simplify CMakeLists
It is no longer necessary to pass special compiler options in order to compile an application.
This commit is contained in:
parent
4e766452b4
commit
3f2a63ff40
@ -18,8 +18,50 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project(Retro)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(add_application name)
|
||||
set(options DEBUGBREAK CONSOLE)
|
||||
set(oneValueArgs TYPE CREATOR)
|
||||
set(multiValueArgs FILES MAKEAPPL_ARGS)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
list(APPEND ARGS_FILES ${ARGS_UNPARSED_ARGUMENTS})
|
||||
|
||||
set(files)
|
||||
foreach(f ${ARGS_FILES})
|
||||
list(APPEND files "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
|
||||
endforeach()
|
||||
|
||||
add_executable(${name} ${files})
|
||||
|
||||
if(${ARGS_DEBUGBREAK})
|
||||
list(APPEND ARGS_MAKEAPPL_ARGS -b)
|
||||
endif()
|
||||
if(${ARGS_CONSOLE})
|
||||
target_link_libraries(${name} RetroConsole)
|
||||
endif()
|
||||
|
||||
|
||||
if(TARGET libretro)
|
||||
set_target_properties(${name} PROPERTIES LINK_DEPENDS libretro)
|
||||
endif(TARGET libretro)
|
||||
|
||||
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}.flt)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${name}.bin ${name} ${name}.dsk
|
||||
COMMAND ${MAKE_APPL} ${ARGS_MAKEAPPL_ARGS} -c "${name}.flt" -o "${name}"
|
||||
DEPENDS ${name})
|
||||
add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin)
|
||||
endfunction()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
|
||||
add_subdirectory(libretro)
|
||||
|
||||
# add library path so that GCC picks up the freshly-built libretro
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/libretro)
|
||||
|
||||
add_subdirectory(Console)
|
||||
add_subdirectory(TestApps)
|
||||
add_subdirectory(Raytracer)
|
||||
|
@ -25,13 +25,10 @@ add_library(RetroConsole
|
||||
InitConsole.cc
|
||||
)
|
||||
|
||||
add_executable(HelloWorld
|
||||
install(TARGETS RetroConsole DESTINATION lib)
|
||||
|
||||
add_application(HelloWorld
|
||||
hello.c
|
||||
CONSOLE
|
||||
)
|
||||
|
||||
target_link_libraries(HelloWorld RetroConsole retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT HelloWorld.bin
|
||||
COMMAND ${MAKE_APPL} -c HelloWorld -o HelloWorld
|
||||
DEPENDS HelloWorld)
|
||||
add_custom_target(HelloWorldAPPL ALL DEPENDS HelloWorld.bin)
|
||||
|
@ -1,11 +1,6 @@
|
||||
set(CMAKE_C_FLAGS "-Wno-multichar")
|
||||
add_executable(Launcher
|
||||
Launcher.c
|
||||
)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
target_link_libraries(Launcher RetroConsole retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT Launcher.bin
|
||||
COMMAND ${MAKE_APPL} -c Launcher -o Launcher
|
||||
DEPENDS Launcher)
|
||||
add_custom_target(LauncherAPPL ALL DEPENDS Launcher.bin)
|
||||
set(CMAKE_C_FLAGS "-Wno-multichar")
|
||||
|
||||
add_application(Launcher
|
||||
FILES Launcher.c CONSOLE)
|
||||
|
@ -17,45 +17,33 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -fno-threadsafe-statics -g -fomit-frame-pointer") # -mcpu=68040")
|
||||
endif()
|
||||
|
||||
include_directories(../App2)
|
||||
add_executable(Raytracer MACOSX_BUNDLE
|
||||
raytracer.c
|
||||
)
|
||||
add_executable(Raytracer2 MACOSX_BUNDLE
|
||||
raytracer2.cc
|
||||
fixed.h
|
||||
fixed.cc
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(Raytracer "-framework Carbon")
|
||||
target_link_libraries(Raytracer2 "-framework Carbon")
|
||||
add_executable(Raytracer MACOSX_BUNDLE
|
||||
raytracer.c
|
||||
)
|
||||
add_executable(Raytracer2 MACOSX_BUNDLE
|
||||
raytracer2.cc
|
||||
fixed.h
|
||||
fixed.cc
|
||||
)
|
||||
|
||||
target_link_libraries(Raytracer "-framework Carbon")
|
||||
target_link_libraries(Raytracer2 "-framework Carbon")
|
||||
else()
|
||||
add_executable(FixedBenchmark fixedbenchmark.cc fixed.h fixed.cc)
|
||||
target_link_libraries(FixedBenchmark RetroConsole retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT FixedBenchmark.bin
|
||||
COMMAND ${MAKE_APPL} -c FixedBenchmark -o FixedBenchmark
|
||||
DEPENDS FixedBenchmark)
|
||||
add_custom_target(FixedBenchmarkAPPL ALL DEPENDS FixedBenchmark.bin)
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11")
|
||||
|
||||
target_link_libraries(Raytracer retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT Raytracer.bin
|
||||
COMMAND ${MAKE_APPL} -c Raytracer -o Raytracer
|
||||
DEPENDS Raytracer)
|
||||
target_link_libraries(Raytracer "-lm")
|
||||
add_custom_target(RaytracerAPPL ALL DEPENDS Raytracer.bin)
|
||||
add_application(Raytracer
|
||||
raytracer.c
|
||||
)
|
||||
target_link_libraries(Raytracer "-lm")
|
||||
|
||||
target_link_libraries(Raytracer2 retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT Raytracer2.bin
|
||||
COMMAND ${MAKE_APPL} -c Raytracer2 -o Raytracer2
|
||||
DEPENDS Raytracer2)
|
||||
add_custom_target(Raytracer2APPL ALL DEPENDS Raytracer2.bin)
|
||||
add_application(Raytracer2
|
||||
raytracer2.cc
|
||||
fixed.h
|
||||
fixed.cc
|
||||
)
|
||||
|
||||
add_application(FixedBenchmark CONSOLE
|
||||
FILES fixedbenchmark.cc fixed.h fixed.cc)
|
||||
endif()
|
||||
|
||||
|
@ -18,43 +18,13 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11") # -fomit-frame-pointer")
|
||||
|
||||
add_executable(ExceptionTest
|
||||
ExceptionTest.cc
|
||||
)
|
||||
|
||||
target_link_libraries(ExceptionTest RetroConsole retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT ExceptionTest.bin
|
||||
COMMAND ${MAKE_APPL} -c ExceptionTest -o ExceptionTest
|
||||
DEPENDS ExceptionTest)
|
||||
add_custom_target(ExceptionTestAPPL ALL DEPENDS ExceptionTest.bin)
|
||||
|
||||
add_executable(InitTest
|
||||
InitTest.cc
|
||||
)
|
||||
|
||||
target_link_libraries(InitTest RetroConsole retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT InitTest.bin
|
||||
COMMAND ${MAKE_APPL} -b -c InitTest -o InitTest
|
||||
DEPENDS InitTest)
|
||||
add_custom_target(InitTestAPPL ALL DEPENDS InitTest.bin)
|
||||
|
||||
add_application(ExceptionTest CONSOLE ExceptionTest.cc)
|
||||
add_application(InitTest CONSOLE InitTest.cc)
|
||||
|
||||
enable_language(ASM)
|
||||
add_executable(AsmTest
|
||||
AsmTest.s
|
||||
)
|
||||
add_application(AsmTest AsmTest.s)
|
||||
set_target_properties(AsmTest PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
target_link_libraries(AsmTest retrocrt)
|
||||
add_custom_command(
|
||||
OUTPUT AsmTest.bin
|
||||
COMMAND ${MAKE_APPL} -c AsmTest -o AsmTest
|
||||
DEPENDS AsmTest)
|
||||
add_custom_target(AsmTestAPPL ALL DEPENDS AsmTest.bin)
|
||||
|
||||
|
||||
|
||||
set(UPLOAD_URL "" CACHE STRING "ftp url to upload to")
|
||||
if(UPLOAD_URL)
|
||||
|
@ -53,6 +53,9 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#define SUBTARGET_EXTRA_SPECS
|
||||
|
||||
#define LIBGCC_SPEC "-lretrocrt -lgcc"
|
||||
#define LINK_SPEC "-elf2flt -q -undefined=_consolewrite"
|
||||
|
||||
/* Note that some other tm.h files include this one and then override
|
||||
many of the definitions that relate to assembler syntax. */
|
||||
|
||||
@ -1006,4 +1009,4 @@ extern int m68k_sched_indexed_address_bypass_p (rtx, rtx);
|
||||
while (0)
|
||||
|
||||
extern int m68k_is_pascal_func(tree, tree);
|
||||
#define IS_PASCAL_FUNC(fntype, fndecl) m68k_is_pascal_func(fntype, fndecl)
|
||||
#define IS_PASCAL_FUNC(fntype, fndecl) m68k_is_pascal_func(fntype, fndecl)
|
||||
|
@ -651,7 +651,7 @@ case "${host}" in
|
||||
newlib_cflags="${newlib_cflags} -DNO_EXEC -DABORT_PROVIDED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
|
||||
;;
|
||||
m68k-unknown-elf)
|
||||
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
|
||||
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES -DMALLOC_PROVIDED"
|
||||
syscall_dir=
|
||||
;;
|
||||
mcore-*-*)
|
||||
|
@ -16,17 +16,12 @@
|
||||
# along with Retro68. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
add_library(retrocrt_multi
|
||||
start.c
|
||||
|
||||
add_library(retrocrt start.c
|
||||
malloc.c
|
||||
syscalls.c
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT retrocrt.o
|
||||
DEPENDS retrocrt_multi
|
||||
COMMAND ${CMAKE_LINKER} -r -o retrocrt.o
|
||||
--whole-archive libretrocrt_multi.a
|
||||
)
|
||||
add_library(retrocrt retrocrt.o glue.c consolehooks.c)
|
||||
#add_custom_target(retrocrt_o ALL DEPENDS retrocrt.o)
|
||||
glue.c
|
||||
consolehooks.c)
|
||||
|
||||
install(TARGETS retrocrt DESTINATION lib)
|
||||
|
||||
|
@ -26,5 +26,3 @@ set( MAKE_APPL "${RETRO68_ROOT}/bin/MakeAPPL" )
|
||||
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/m68k-unknown-elf-gcc" )
|
||||
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/m68k-unknown-elf-g++" )
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-elf2flt -Wl,-q -Wl,-Map=linkmap.txt -Wl,-undefined=consolewrite" )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user