2021-03-05 04:27:15 +00:00
|
|
|
message("C compiler: ${CMAKE_C_COMPILER}")
|
|
|
|
|
2021-03-08 05:22:05 +00:00
|
|
|
function(create_keymap_setups keymaps keymap_table)
|
2021-11-28 21:28:03 +00:00
|
|
|
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n case \\2: setup_\\1_keymap();break" OUTPUT_VARIABLE temp_list)
|
2021-05-19 18:32:23 +00:00
|
|
|
# we can keep the ';' cmake list separators as the C statement separators.
|
|
|
|
# However, we need to append an extra ';' at the end.
|
|
|
|
string(APPEND temp_list ";")
|
|
|
|
set(${keymap_table} "${temp_list}" PARENT_SCOPE)
|
2021-03-08 05:22:05 +00:00
|
|
|
endfunction(create_keymap_setups)
|
|
|
|
|
2021-05-19 18:32:23 +00:00
|
|
|
function(create_keymap_declarations keymaps keymap_decl)
|
2021-11-28 21:28:03 +00:00
|
|
|
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n void setup_\\1_keymap(void)" OUTPUT_VARIABLE temp_list)
|
2021-05-19 18:32:23 +00:00
|
|
|
# we can keep the ';' cmake list separators as the C statement separators.
|
|
|
|
# However, we need to append an extra ';' at the end.
|
|
|
|
string(APPEND temp_list ";")
|
|
|
|
set(${keymap_decl} "${temp_list}" PARENT_SCOPE)
|
|
|
|
endfunction(create_keymap_declarations)
|
|
|
|
|
2021-03-08 05:22:05 +00:00
|
|
|
function(create_keymap_report keymaps keymap_report)
|
|
|
|
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\nkeymap [\\2]: \\1" OUTPUT_VARIABLE temp_list)
|
|
|
|
string(REPLACE ";" "" temp_list2 "${temp_list}")
|
|
|
|
set(${keymap_report} "${temp_list2}" PARENT_SCOPE)
|
|
|
|
endfunction(create_keymap_report)
|
|
|
|
|
|
|
|
include(../keymap_list.cmake)
|
|
|
|
|
|
|
|
create_keymap_setups("${keymap_list}" keymap_table)
|
|
|
|
create_keymap_report("${keymap_list}" keymap_report)
|
2021-05-19 18:32:23 +00:00
|
|
|
create_keymap_declarations("${keymap_list}" keymap_declarations)
|
2021-03-08 05:22:05 +00:00
|
|
|
|
|
|
|
# get list length and decrement by one to account for trailing semicolon
|
|
|
|
list (LENGTH keymap_list num_keymaps)
|
|
|
|
|
|
|
|
message("**********************")
|
|
|
|
message("Keymap table: ${keymap_report}")
|
|
|
|
message("**********************\n\n")
|
|
|
|
|
2021-05-19 18:32:23 +00:00
|
|
|
set (ASDF_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
2021-03-08 05:22:05 +00:00
|
|
|
|
2021-03-08 02:38:40 +00:00
|
|
|
configure_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h COPYONLY)
|
|
|
|
configure_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.c ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c COPYONLY)
|
2021-11-28 21:28:03 +00:00
|
|
|
configure_file(${ASDF_SRC_DIR}/asdf_keymap_setup.c.in ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.c)
|
|
|
|
configure_file(${ASDF_SRC_DIR}/asdf_keymap_setup.h.in ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.h)
|
2021-03-05 04:27:15 +00:00
|
|
|
|
2021-03-08 05:22:05 +00:00
|
|
|
|
|
|
|
|
2021-08-25 15:53:11 +00:00
|
|
|
list(APPEND CFLAGS
|
2021-03-05 04:27:15 +00:00
|
|
|
-std=c99
|
2021-11-28 21:28:03 +00:00
|
|
|
# -Wa,-adhln
|
2021-03-05 04:27:15 +00:00
|
|
|
-Wall
|
|
|
|
-funsigned-char
|
|
|
|
-funsigned-bitfields
|
|
|
|
-ffunction-sections
|
|
|
|
-fdata-sections
|
|
|
|
-fpack-struct
|
|
|
|
-fshort-enums
|
|
|
|
-O2
|
|
|
|
-Wall
|
|
|
|
-Wextra
|
|
|
|
-Wpointer-arith
|
|
|
|
-Wcast-align
|
|
|
|
-Wwrite-strings
|
|
|
|
-Wswitch-default
|
|
|
|
-Wunreachable-code
|
|
|
|
-Winit-self
|
|
|
|
-Wmissing-field-initializers
|
|
|
|
-Wno-unknown-pragmas
|
|
|
|
-Wstrict-prototypes
|
|
|
|
-Wundef
|
|
|
|
-Wold-style-definition
|
|
|
|
)
|
|
|
|
|
|
|
|
list (APPEND SOURCES
|
|
|
|
asdf.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c
|
2021-11-28 21:28:03 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.c
|
2021-03-05 04:27:15 +00:00
|
|
|
asdf_buffer.c
|
|
|
|
asdf_hook.c
|
2021-11-28 21:28:03 +00:00
|
|
|
asdf_keymap_setup.c
|
2021-03-05 04:27:15 +00:00
|
|
|
asdf_keymaps.c
|
|
|
|
asdf_modifiers.c
|
|
|
|
asdf_physical.c
|
|
|
|
asdf_repeat.c
|
|
|
|
asdf_virtual.c
|
2021-11-28 21:28:03 +00:00
|
|
|
asdf_print.c
|
|
|
|
Keymaps/asdf_keymap_classic.c
|
|
|
|
Keymaps/asdf_keymap_classic_caps.c
|
|
|
|
Keymaps/asdf_keymap_classic_add_map.c
|
2021-11-29 05:50:28 +00:00
|
|
|
Keymaps/asdf_keymap_apple2.c
|
|
|
|
Keymaps/asdf_keymap_apple2_add_map.c
|
2021-11-28 21:28:03 +00:00
|
|
|
Keymaps/asdf_keymap_sol.c
|
2021-03-05 04:27:15 +00:00
|
|
|
main.c
|
|
|
|
)
|
|
|
|
|
2021-03-08 02:38:40 +00:00
|
|
|
# create a library for the keymap modules
|
2021-11-28 21:28:03 +00:00
|
|
|
#add_subdirectory(Keymaps)
|
2021-03-08 02:38:40 +00:00
|
|
|
|
2021-03-05 04:27:15 +00:00
|
|
|
# add the executable
|
|
|
|
if (COMMAND custom_add_executable)
|
|
|
|
custom_add_executable(${ASDF_TARGET_NAME}
|
|
|
|
${SOURCES}
|
|
|
|
)
|
|
|
|
else()
|
2021-05-19 18:32:23 +00:00
|
|
|
add_executable(${ASDF_TARGET_NAME}
|
|
|
|
${SOURCES}
|
|
|
|
)
|
2021-03-05 04:27:15 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(${ASDF_EXECUTABLE_TARGET_NAME}
|
|
|
|
PRIVATE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2021-11-28 21:28:03 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Keymaps
|
|
|
|
|
2021-03-05 04:27:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_options(${ASDF_EXECUTABLE_TARGET_NAME}
|
|
|
|
PRIVATE
|
|
|
|
${CFLAGS}
|
|
|
|
)
|
|
|
|
|
2021-11-28 21:28:03 +00:00
|
|
|
#target_link_libraries(${ASDF_EXECUTABLE_TARGET_NAME}
|
|
|
|
# keymaps
|
|
|
|
# )
|