mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(cli): Re-engineer CLIs, split play & compile
Play depends on bridge and compile on compiler package. Before, the compiler depended on bridge, but we could not use the compiler to build the library, as the bridge depends on the library. Also, play can now start having slightly more options e.g. wav out etc.
This commit is contained in:
@ -35,15 +35,16 @@ enable_language(ASM_NASM)
|
||||
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <DEFINES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
||||
|
||||
if(WIN32)
|
||||
set(sointuexe ${CMAKE_CURRENT_BINARY_DIR}/sointu-cli.exe)
|
||||
set(compilecmd ${CMAKE_CURRENT_BINARY_DIR}/sointu-compile.exe)
|
||||
else()
|
||||
set(sointuexe ${CMAKE_CURRENT_BINARY_DIR}/sointu-cli)
|
||||
set(compilecmd ${CMAKE_CURRENT_BINARY_DIR}/sointu-compile)
|
||||
endif()
|
||||
|
||||
# the tests include the entire ASM but we still want to rebuild when they change
|
||||
file(GLOB templates ${PROJECT_SOURCE_DIR}/templates/*.asm)
|
||||
file(GLOB sointu "${PROJECT_SOURCE_DIR}/*.go" "${PROJECT_SOURCE_DIR}/cmd/sointu-cli/*.go")
|
||||
file(GLOB sointusrc "${PROJECT_SOURCE_DIR}/*.go")
|
||||
file(GLOB compilersrc "${PROJECT_SOURCE_DIR}/compiler/*.go")
|
||||
file(GLOB compilecmdsrc "${PROJECT_SOURCE_DIR}/cmd/sointu-compile/*.go")
|
||||
|
||||
if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(arch "amd64")
|
||||
@ -57,10 +58,19 @@ endif()
|
||||
set(STATICLIB sointu)
|
||||
set(sointuasm sointu.asm)
|
||||
|
||||
|
||||
# Build sointu-cli only once because go run has everytime quite a bit of delay when
|
||||
# starting
|
||||
add_custom_command(
|
||||
OUTPUT ${compilecmd}
|
||||
COMMAND go build -o ${compilecmd} ${PROJECT_SOURCE_DIR}/cmd/sointu-compile/main.go
|
||||
DEPENDS "${sointusrc}" "${compilersrc}" "${compilecmdsrc}"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${sointuasm}
|
||||
COMMAND go run ${PROJECT_SOURCE_DIR}/compiler/generate.go -arch=${arch} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS "${templates}" "${sointu}" "${compilersrc}"
|
||||
COMMAND ${compilecmd} -arch=${arch} -a -o ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS "${templates}" ${compilecmd}
|
||||
)
|
||||
|
||||
add_library(${STATICLIB} ${sointuasm})
|
||||
|
Reference in New Issue
Block a user