Compare commits
4 Commits
637343db5b
...
630c6fb5d4
Author | SHA1 | Date | |
---|---|---|---|
|
630c6fb5d4 | ||
|
d7c744a6ca | ||
|
f8d7aa8a07 | ||
|
ea2bbf5de0 |
@ -305,6 +305,7 @@ function(use_townengine target sources output_directory)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${target} PROPERTIES
|
set_target_properties(${target} PROPERTIES
|
||||||
|
OUTPUT_NAME ${target}
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${output_directory}
|
LIBRARY_OUTPUT_DIRECTORY ${output_directory}
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
|
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.21)
|
cmake_minimum_required(VERSION 3.21)
|
||||||
|
cmake_policy(SET CMP0171 NEW)
|
||||||
project(twnlua LANGUAGES C)
|
project(twnlua LANGUAGES C)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
@ -8,10 +8,26 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory($ENV{TWNROOT} $ENV{TWNROOT}/build)
|
add_subdirectory($ENV{TWNROOT} $ENV{TWNROOT}/build)
|
||||||
|
|
||||||
|
set(FLAGS
|
||||||
|
$<$<NOT:$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>>:--no-dynlib-game>
|
||||||
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
||||||
COMMAND ${PYTHON3} ${CMAKE_CURRENT_SOURCE_DIR}/bindgen.py $ENV{TWNROOT}/share/twn_api.json > ${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
COMMAND ${PYTHON3} ${CMAKE_CURRENT_SOURCE_DIR}/bindgen.py $ENV{TWNROOT}/share/twn_api.json ${FLAGS} > ${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindgen.py $ENV{TWNROOT}/share/twn_api.json
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindgen.py $ENV{TWNROOT}/share/twn_api.json
|
||||||
|
CODEGEN
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_SOURCE_DIR}/data/scripts/twnapi.lua
|
||||||
|
COMMAND ${PYTHON3} ${CMAKE_CURRENT_SOURCE_DIR}/docgen.py $ENV{TWNROOT}/share/twn_api.json > ${CMAKE_SOURCE_DIR}/data/scripts/twnapi.lua
|
||||||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docgen.py $ENV{TWNROOT}/share/twn_api.json
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
twnlua_docgen ALL
|
||||||
|
DEPENDS ${CMAKE_SOURCE_DIR}/data/scripts/twnapi.lua
|
||||||
)
|
)
|
||||||
|
|
||||||
add_compile_definitions(LUA_32BITS)
|
add_compile_definitions(LUA_32BITS)
|
||||||
@ -23,5 +39,4 @@ set(SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
${CMAKE_CURRENT_SOURCE_DIR}/luabind.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
use_townengine(${CMAKE_PROJECT_NAME} "${SOURCE_FILES}" ${CMAKE_SOURCE_DIR})
|
||||||
use_townengine(${PROJECT_NAME} "${SOURCE_FILES}" ${CMAKE_SOURCE_DIR})
|
|
||||||
|
@ -64,8 +64,8 @@ def from_table(typedesc, variable, indent = 0):
|
|||||||
|
|
||||||
|
|
||||||
print('#include "twn_game_api.h"\n')
|
print('#include "twn_game_api.h"\n')
|
||||||
# TODO: reuse implementation from the engine, this also breaks with statically compiled build
|
if not "--no-dynlib-game" in sys.argv:
|
||||||
print('#define STB_DS_IMPLEMENTATION')
|
print('#define STB_DS_IMPLEMENTATION')
|
||||||
print('#include <stb_ds.h>')
|
print('#include <stb_ds.h>')
|
||||||
print('#include "minilua.h"\n')
|
print('#include "minilua.h"\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user