67 lines
1.6 KiB
CMake
67 lines
1.6 KiB
CMake
|
|
add_library(opts INTERFACE)
|
|
|
|
target_compile_features(opts INTERFACE c_std_23)
|
|
|
|
if(MSVC)
|
|
target_compile_options(opts INTERFACE /W4)
|
|
|
|
if(ASAN)
|
|
target_compile_options(opts INTERFACE /fsanitize=address)
|
|
target_link_options(opts INTERFACE /fsanitize=address)
|
|
endif()
|
|
else()
|
|
target_compile_options(opts INTERFACE
|
|
-pedantic
|
|
-Wall
|
|
-Wextra
|
|
-Werror=switch
|
|
)
|
|
|
|
if(ASAN)
|
|
target_compile_options(opts INTERFACE -fsanitize=address)
|
|
target_link_options(opts INTERFACE -fsanitize=address)
|
|
endif()
|
|
endif()
|
|
|
|
add_library(isa STATIC isa.c)
|
|
target_include_directories(isa PUBLIC .)
|
|
|
|
add_executable(emu WIN32 emu.c)
|
|
target_link_libraries(emu PRIVATE opts isa SDL3::SDL3)
|
|
|
|
if(USE_PTHREAD)
|
|
target_compile_definitions(emu PRIVATE USE_PTHREAD)
|
|
target_sources(emu PRIVATE phtread_threads_adapter.c)
|
|
target_link_libraries(emu PRIVATE Threads::Threads)
|
|
endif()
|
|
|
|
add_executable(asm asm.c)
|
|
target_link_libraries(asm PRIVATE opts isa)
|
|
|
|
add_executable(fs fs.c)
|
|
target_link_libraries(fs PRIVATE opts)
|
|
|
|
add_executable(mkdisk mkdisk.c)
|
|
target_link_libraries(mkdisk PRIVATE opts)
|
|
|
|
function(vc6_asm_target target_name source_file)
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target_name}
|
|
COMMAND asm ${CMAKE_CURRENT_SOURCE_DIR}/${source_file} -o ${CMAKE_CURRENT_BINARY_DIR}/${target_name} -M
|
|
DEPENDS asm ${CMAKE_CURRENT_SOURCE_DIR}/${source_file}
|
|
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${target_name}.d
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(
|
|
${target_name}.target
|
|
ALL
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target_name}
|
|
)
|
|
endfunction()
|
|
|
|
|
|
|
|
|