@@ -10,13 +10,6 @@ add_definitions("-DBUILDING_IOVMALL_DLL")
1010# Output our static library to the top-level _build hierarchy
1111set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR} /_build/lib)
1212
13- # Define the subdirectories we can reach from here that we want
14- # to go into and build stuff.
15- add_subdirectory (coroutine)
16- add_subdirectory (basekit)
17- add_subdirectory (garbagecollector)
18- add_subdirectory (iovm)
19-
2013# Our Io source files to be "compiled" into a C source file.
2114#file(GLOB IO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/iovm/io/*.io")
2215set (IO_SRCS
@@ -62,8 +55,7 @@ file(GLOB COROUTINE_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/coroutine/source/*.c")
6255file (GLOB BASEKIT_SRCS "${CMAKE_CURRENT_SOURCE_DIR} /basekit/source/*.c" )
6356file (GLOB GARBAGECOLLECTOR_SRCS "${CMAKE_CURRENT_SOURCE_DIR} /garbagecollector/source/*.c" )
6457file (GLOB IOVM_SRCS "${CMAKE_CURRENT_SOURCE_DIR} /iovm/source/*.c" )
65-
66- list (APPEND IOVM_SRCS ${CMAKE_CURRENT_SOURCE_DIR} /../deps/parson/parson.c ${CMAKE_CURRENT_SOURCE_DIR} /iovm/source /IoVMInit.c)
58+ list (APPEND IOVM_SRCS ${CMAKE_CURRENT_SOURCE_DIR} /../deps/parson/parson.c)
6759
6860# Marvelous flags, likely compiler dependent.
6961#add_definitions(-DBUILDING_IOVM_DLL)# -DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
@@ -76,6 +68,14 @@ set(IOVMALL_STATIC_SRCS
7668${IOVM_SRCS}
7769)
7870
71+ # The custom command to generate source/IoVMInit.c which is our
72+ # "compiled" Io to C source code.
73+ add_custom_command (
74+ OUTPUT ${CMAKE_CURRENT_SOURCE_DIR} /iovm/source /IoVMInit.c
75+ COMMAND ${PROJECT_BINARY_DIR} /_build/binaries/io2c VMCode IoState_doString_ ${IO_SRCS} > ${CMAKE_CURRENT_SOURCE_DIR} /iovm/source /IoVMInit.c
76+ DEPENDS io2c
77+ )
78+
7979# Include dirs, -I flags and whatnot
8080include_directories (
8181${CMAKE_CURRENT_SOURCE_DIR} /iovm/source
@@ -86,7 +86,17 @@ include_directories(
8686${CMAKE_CURRENT_SOURCE_DIR} /garbagecollector/source
8787)
8888
89+ # Add a file to our library sources.
90+ list (APPEND IOVMALL_STATIC_SRCS ${CMAKE_CURRENT_SOURCE_DIR} /iovm/source /IoVMInit.c) # Because we generate it
91+
8992# ...And the static library. Refer to IOVMALL_STATIC_SRCS definition
9093# up top.
9194add_library (iovmall_static STATIC ${IOVMALL_STATIC_SRCS} )
9295add_dependencies (iovmall_static io2c basekit coroutine garbagecollector iovmall)
96+
97+ # Define the subdirectories we can reach from here that we want
98+ # to go into and build stuff.
99+ add_subdirectory (coroutine)
100+ add_subdirectory (basekit)
101+ add_subdirectory (garbagecollector)
102+ add_subdirectory (iovm)
0 commit comments