From 9c3a2becd7f591d56d52b97998f3fda3252f3aa6 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Sat, 27 Jul 2024 22:22:28 +0300 Subject: [PATCH 01/11] Run full nightly build only if there are new commits --- .github/workflows/nightly.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 15ac1fd2b..295a6005f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,8 +10,25 @@ permissions: actions: read jobs: + check: + runs-on: 'ubuntu-latest' + steps: + - uses: octokit/request-action@v2.x + id: check_last_run + with: + route: GET /repos/${{github.repository}}/actions/workflows/nightly.yml/runs?per_page=1&status=completed + env: + GITHUB_TOKEN: ${{ github.token }} + + - run: "echo Last nightly build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}" + + outputs: + last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }} + build: name: Build + needs: [check] + if: needs.check.outputs.last_sha != github.sha uses: ./.github/workflows/reusable-build.yml strategy: fail-fast: false @@ -23,7 +40,7 @@ jobs: publish: name: Package - needs: [build, build] + needs: [build] runs-on: windows-latest steps: - name: Download artifacts From ca37e77e6f91d44aed671daee6453546543bedfb Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Sat, 27 Jul 2024 22:26:01 +0300 Subject: [PATCH 02/11] Minor tweaks --- .github/workflows/nightly.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 295a6005f..9a8d5f4da 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,6 +11,7 @@ permissions: jobs: check: + name: Pre-check runs-on: 'ubuntu-latest' steps: - uses: octokit/request-action@v2.x @@ -20,7 +21,9 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - run: "echo Last nightly build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}" + - run: | + echo Last nightly commit: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }} + echo Current run commit: ${{ github.sha }} outputs: last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }} From 48f1b1280776888ed1007b4ff4a077f9e226ab6c Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Sat, 27 Jul 2024 22:27:47 +0300 Subject: [PATCH 03/11] Use boolean variable --- .github/workflows/nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9a8d5f4da..a46cf2ecf 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -26,12 +26,12 @@ jobs: echo Current run commit: ${{ github.sha }} outputs: - last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }} + should_run: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha != github.sha }} build: name: Build needs: [check] - if: needs.check.outputs.last_sha != github.sha + if: needs.check.outputs.should_run uses: ./.github/workflows/reusable-build.yml strategy: fail-fast: false From 8e457cda8cfcddebbe2811418b9c17af562bd063 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Sat, 27 Jul 2024 11:05:00 +0200 Subject: [PATCH 04/11] Revert Orbiter to use Fetch mechanism instead of submodules/direct commit --- .github/workflows/release.yml | 1 + .github/workflows/reusable-build.yml | 2 - .gitmodules | 9 -- CMakeLists.txt | 4 - Extern/CMakeLists.txt | 87 +++---------------- Extern/Catch2 | 1 - Extern/Lua | 1 - Extern/Lua/CMakeLists.txt | 47 ++++++++++ Extern/README.md | 19 ++++ Extern/zlib | 1 - Extern/zlib/CMakeLists.txt | 21 +++++ Orbitersdk/include/OrbiterAPI.h | 2 +- Src/Module/LuaScript/LuaInline/CMakeLists.txt | 2 +- .../LuaScript/LuaInterpreter/CMakeLists.txt | 5 +- .../LuaScript/LuaInterpreter/Interpreter.h | 6 +- Src/Orbiter/OrbiterAPI.cpp | 2 +- Src/Plugin/LuaConsole/CMakeLists.txt | 2 +- Src/Plugin/LuaMFD/CMakeLists.txt | 2 +- Src/Plugin/ScriptMFD/CMakeLists.txt | 2 +- Src/Vessel/DeltaGlider/CMakeLists.txt | 2 +- Src/Vessel/DeltaGlider/DGLua.cpp | 6 +- Src/Vessel/HST/CMakeLists.txt | 2 +- Src/Vessel/HST/HST_Lua.cpp | 6 +- Src/Vessel/Quadcopter/CMakeLists.txt | 2 +- Src/Vessel/Quadcopter/QuadcopterLua.h | 6 +- Src/Vessel/ScriptVessel/CMakeLists.txt | 2 +- Src/Vessel/ScriptVessel/ScriptVessel.cpp | 6 +- Src/Vessel/ShuttleA/CMakeLists.txt | 2 +- Src/Vessel/ShuttleA/ShuttleALua.cpp | 6 +- Src/Vessel/Solarsail/CMakeLists.txt | 2 +- Src/Vessel/Solarsail/SailLua.cpp | 6 +- Tests/CMakeLists.txt | 12 ++- 32 files changed, 149 insertions(+), 127 deletions(-) delete mode 100644 .gitmodules delete mode 160000 Extern/Catch2 delete mode 160000 Extern/Lua create mode 100644 Extern/Lua/CMakeLists.txt create mode 100644 Extern/README.md delete mode 160000 Extern/zlib create mode 100644 Extern/zlib/CMakeLists.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16929b6a8..61a39af0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: required: true type: string default: 2024.1.0 + description: Release tag. Recommended format year.month.version run-name: Release ${{ inputs.version }} diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index d8a83392e..0c0fcde6c 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -31,8 +31,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - submodules: true - name: Setup Problem Matcher uses: ammaraskar/msvc-problem-matcher@master diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c58204dfb..000000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "Extern/Lua"] - path = Extern/Lua - url = https://github.com/orbitersim/lua.git -[submodule "Extern/zlib"] - path = Extern/zlib - url = https://github.com/orbitersim/zlib.git -[submodule "Extern/Catch2"] - path = Extern/Catch2 - url = https://github.com/orbitersim/Catch2.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c78ac0ee..9a8d2bfe3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,7 +100,6 @@ set(HTMLHELP_LIB_DIR ${HTMLHELP_DIR}/lib-${ARCH}) set(HTMLHELP_LIB ${HTMLHELP_LIB_DIR}/Htmlhelp.lib) set(ORBITER_TOOL_MESHC "$") -set(ldoc $ ${ORBITER_BINARY_ROOT_DIR}/packages/LDoc/ldoc.lua -v --multimodule) find_package(OpenGL QUIET) find_package(HTMLHelp) @@ -389,9 +388,6 @@ endfunction() install(DIRECTORY Scenarios Textures Meshes Config GravityModels Script Flights BinAssets/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR} ) -#install(FILES ${LUA_DLL_DIR}/lua5.1.lib -# DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua -#) set(CMAKE_MODULE_PATH ${ORBITER_BINARY_ROOT_DIR} diff --git a/Extern/CMakeLists.txt b/Extern/CMakeLists.txt index 84b375c97..04597cd7c 100644 --- a/Extern/CMakeLists.txt +++ b/Extern/CMakeLists.txt @@ -1,56 +1,22 @@ -project(Extern) +Include(FetchContent) -########################################## -## Lua +if(NOT DEFINED ORBITER_BINARY_ROOT_DIR) + message(FATAL_ERROR "ORBITER_BINARY_ROOT_DIR is not set") +endif(NOT DEFINED ORBITER_BINARY_ROOT_DIR) -file(GLOB LUA_FILES "Lua/*.c" "Lua/*.h") -list(REMOVE_ITEM LUA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Lua/lua.c) -list(REMOVE_ITEM LUA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Lua/luac.c) -list(REMOVE_ITEM LUA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Lua/print.c) -add_library(lua SHARED ${LUA_FILES}) -target_compile_definitions(lua PUBLIC LUA_BUILD_AS_DLL) - -# for tests and running Orbiter from inside the build dir -set_target_properties(lua PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} -) - -install(TARGETS lua RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) -install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua) -install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) - - -add_executable(lua_bin - ${LUA_FILES} "Lua/lua.c" -) -set_target_properties(lua_bin - PROPERTIES - OUTPUT_NAME lua -) -set_target_properties(lua_bin PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} -) - -install(TARGETS lua_bin - DESTINATION ${ORBITER_BINARY_ROOT_DIR} -) -install(TARGETS lua_bin DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) +add_subdirectory(lua) +add_subdirectory(zlib) ## LFS add_library(lfs SHARED luafilesystem/src/lfs.c) - install(TARGETS lfs DESTINATION ${ORBITER_BINARY_ROOT_DIR}) - install(TARGETS lfs DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) - target_include_directories(lfs PUBLIC Lua) - target_link_libraries(lfs lua) - SET_TARGET_PROPERTIES(lfs PROPERTIES LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/luafilesystem/src/lfs.def\"" -) -install(TARGETS lfs - DESTINATION ${ORBITER_BINARY_ROOT_DIR} -) +install(TARGETS lfs DESTINATION ${ORBITER_BINARY_ROOT_DIR}) +install(TARGETS lfs DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) +target_include_directories(lfs PUBLIC Lua) +target_link_libraries(lfs lua) +SET_TARGET_PROPERTIES(lfs PROPERTIES LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/luafilesystem/src/lfs.def\"") + +install(TARGETS lfs DESTINATION ${ORBITER_BINARY_ROOT_DIR}) + set_target_properties(lfs PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} @@ -61,28 +27,3 @@ add_custom_target(CopyLDoc ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ldoc/ ${ORBITER_BINARY_ROOT_DIR}/packages/ldoc COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Penlight/lua/ ${ORBITER_BINARY_ROOT_DIR}/ ) - -########################################## -## zlib - -set(SKIP_INSTALL_ALL ON) -add_subdirectory(zlib) - -target_include_directories(zlib INTERFACE ${zlib_SOURCE_DIR}) -target_include_directories(zlib INTERFACE ${zlib_BINARY_DIR}) # for zconf.h - -# for tests and running Orbiter from inside the build dir -set_target_properties(zlib PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} - RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} -) - -install(TARGETS zlib RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) - -########################################## -## Catch2 - -if(ORBITER_MAKE_TESTS) - add_subdirectory(Catch2) -endif() diff --git a/Extern/Catch2 b/Extern/Catch2 deleted file mode 160000 index 3f0283de7..000000000 --- a/Extern/Catch2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f0283de7a9c43200033da996ff9093be3ac84dc diff --git a/Extern/Lua b/Extern/Lua deleted file mode 160000 index 69ea087df..000000000 --- a/Extern/Lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 69ea087dff1daba25a2000dfb8f1883c17545b7a diff --git a/Extern/Lua/CMakeLists.txt b/Extern/Lua/CMakeLists.txt new file mode 100644 index 000000000..7323c1332 --- /dev/null +++ b/Extern/Lua/CMakeLists.txt @@ -0,0 +1,47 @@ +project(lua) + +Include(FetchContent) + +FetchContent_Declare( + lua + GIT_REPOSITORY https://github.com/lua/lua.git + GIT_TAG v5.1 +) +FetchContent_MakeAvailable(lua) + +file(GLOB LUA_SRC_FILES "${lua_SOURCE_DIR}/*.c") +file(GLOB LUA_HDR_FILES "${lua_SOURCE_DIR}/*.h") + +list(REMOVE_ITEM LUA_SRC_FILES "${lua_SOURCE_DIR}/lua.c") +list(REMOVE_ITEM LUA_SRC_FILES "${lua_SOURCE_DIR}/luac.c") +list(REMOVE_ITEM LUA_SRC_FILES "${lua_SOURCE_DIR}/print.c") + +# Executable - lua.exe +add_executable(lua-exe ${LUA_SRC_FILES} "${lua_SOURCE_DIR}/lua.c") +set_target_properties(lua-exe PROPERTIES OUTPUT_NAME lua) + +set_target_properties(lua-exe PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils + LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils + RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils +) +install(TARGETS lua-exe DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Utils) + +# Library - lua.dll +add_library(lua SHARED ${LUA_SRC_FILES}) +target_compile_definitions(lua PUBLIC LUA_BUILD_AS_DLL) + +set_target_properties(lua PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} +) +install(TARGETS lua DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) + +set(LUA_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) +file(COPY ${LUA_HDR_FILES} DESTINATION ${LUA_INCLUDE_DIR}) +target_include_directories(lua INTERFACE ${LUA_INCLUDE_DIR}) + +# Aliases for easier reference +add_executable(lua::exe ALIAS lua-exe) +add_library(lua::lib ALIAS lua) diff --git a/Extern/README.md b/Extern/README.md new file mode 100644 index 000000000..053e05001 --- /dev/null +++ b/Extern/README.md @@ -0,0 +1,19 @@ +# How to add new dependency + +If you want to add new dependency, the way to add it will depend on the type + +## lunarmodule dependency + +Use `add_lunarmodule` function in Extern/CMakeLists.txt with appropriate tag: + +``` +add_lunarmodule(ldoc v1.5.0) +``` + +## C++ dependency + +1. Create a new directory (e.g. `mylib`) +1. Add a line to Extern/CMakeLists.txt: `add_subdirectory(mylib)` +1. Copy `Extern/zlib/CMakeLists.txt` to new directory +1. Edit the file replacing `zlib` with `mylib` and adding new repository URL +1. Add other tweaks to `CMakeLists.txt` as necessary diff --git a/Extern/zlib b/Extern/zlib deleted file mode 160000 index 04f42ceca..000000000 --- a/Extern/zlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc diff --git a/Extern/zlib/CMakeLists.txt b/Extern/zlib/CMakeLists.txt new file mode 100644 index 000000000..4490bc34e --- /dev/null +++ b/Extern/zlib/CMakeLists.txt @@ -0,0 +1,21 @@ +project(zlib) + +Include(FetchContent) + +set(SKIP_INSTALL_ALL ON) + +FetchContent_Declare( + zlib + GIT_REPOSITORY https://github.com/madler/zlib.git + GIT_TAG v1.2.11 +) +FetchContent_MakeAvailable(zlib) +target_include_directories(zlib INTERFACE ${zlib_SOURCE_DIR}) +target_include_directories(zlib INTERFACE ${zlib_BINARY_DIR}) + +set_target_properties(zlib PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} +) +install(TARGETS zlib RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) \ No newline at end of file diff --git a/Orbitersdk/include/OrbiterAPI.h b/Orbitersdk/include/OrbiterAPI.h index ec996486a..d2f24c2bd 100644 --- a/Orbitersdk/include/OrbiterAPI.h +++ b/Orbitersdk/include/OrbiterAPI.h @@ -34,7 +34,7 @@ #endif extern "C" { -#include "Lua/lua.h" +#include } // Assumes MS VC++ compiler. Modify these statements for other compilers diff --git a/Src/Module/LuaScript/LuaInline/CMakeLists.txt b/Src/Module/LuaScript/LuaInline/CMakeLists.txt index f0e181382..8976c8e60 100644 --- a/Src/Module/LuaScript/LuaInline/CMakeLists.txt +++ b/Src/Module/LuaScript/LuaInline/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries(LuaInline ${ORBITER_LIB} ${ORBITER_SDK_LIB} LuaInterpreter - lua + lua::lib ) add_dependencies(LuaInline diff --git a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt index 8e417326f..a3d54b2f4 100644 --- a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt +++ b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt @@ -18,7 +18,7 @@ target_include_directories(LuaInterpreter target_link_libraries(LuaInterpreter ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ) add_dependencies(LuaInterpreter @@ -43,10 +43,11 @@ add_custom_command(TARGET LuaInterpreter ) if(ORBITER_MAKE_DOC) + set(ldoc $ ${lua_module_ldoc_SOURCE_DIR}/ldoc.lua -v --multimodule) file(GLOB lua_in *.h *.cpp *.ld *.md *.lua) add_custom_command( POST_BUILD - DEPENDS ${lua_in} lfs CopyLDoc + DEPENDS ${lua_in} lfs OUTPUT ${BUILD_OUT_DIR}/index.html COMMAND ${CMAKE_COMMAND} -E copy ${lua_in} ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${ldoc} . diff --git a/Src/Module/LuaScript/LuaInterpreter/Interpreter.h b/Src/Module/LuaScript/LuaInterpreter/Interpreter.h index dd67c7dbd..2823af06c 100644 --- a/Src/Module/LuaScript/LuaInterpreter/Interpreter.h +++ b/Src/Module/LuaScript/LuaInterpreter/Interpreter.h @@ -5,9 +5,9 @@ #define __INTERPRETER_H extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } #include "OrbiterAPI.h" diff --git a/Src/Orbiter/OrbiterAPI.cpp b/Src/Orbiter/OrbiterAPI.cpp index b077c5b05..da308cd1e 100644 --- a/Src/Orbiter/OrbiterAPI.cpp +++ b/Src/Orbiter/OrbiterAPI.cpp @@ -23,7 +23,7 @@ #include "resource.h" #include "Mesh.h" #include "MenuInfoBar.h" -#include "zlib.h" +#include #include "DrawAPI.h" #ifdef INLINEGRAPHICS // should be temporary diff --git a/Src/Plugin/LuaConsole/CMakeLists.txt b/Src/Plugin/LuaConsole/CMakeLists.txt index 52860fdc5..fb9bcffa6 100644 --- a/Src/Plugin/LuaConsole/CMakeLists.txt +++ b/Src/Plugin/LuaConsole/CMakeLists.txt @@ -17,7 +17,7 @@ target_include_directories(LuaConsole target_link_libraries(LuaConsole ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ${LUAINTERPRETER_LIB} ) diff --git a/Src/Plugin/LuaMFD/CMakeLists.txt b/Src/Plugin/LuaMFD/CMakeLists.txt index 8449fdb8e..bc187d3e7 100644 --- a/Src/Plugin/LuaMFD/CMakeLists.txt +++ b/Src/Plugin/LuaMFD/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories(LuaMFD target_link_libraries(LuaMFD ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ${LUAINTERPRETER_LIB} ) diff --git a/Src/Plugin/ScriptMFD/CMakeLists.txt b/Src/Plugin/ScriptMFD/CMakeLists.txt index 5eff2ab6d..14eff464a 100644 --- a/Src/Plugin/ScriptMFD/CMakeLists.txt +++ b/Src/Plugin/ScriptMFD/CMakeLists.txt @@ -15,7 +15,7 @@ target_include_directories(ScriptMFD target_link_libraries(ScriptMFD ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ${LUAINTERPRETER_LIB} ) diff --git a/Src/Vessel/DeltaGlider/CMakeLists.txt b/Src/Vessel/DeltaGlider/CMakeLists.txt index 3248761f3..4073f82bb 100644 --- a/Src/Vessel/DeltaGlider/CMakeLists.txt +++ b/Src/Vessel/DeltaGlider/CMakeLists.txt @@ -57,7 +57,7 @@ target_link_libraries(DeltaGlider ${ORBITER_LIB} ${ORBITER_SDK_LIB} ${ORBITER_DLGCTRL_LIB} - lua + lua::lib ) # scan mesh files for labels and output to header file diff --git a/Src/Vessel/DeltaGlider/DGLua.cpp b/Src/Vessel/DeltaGlider/DGLua.cpp index bee8ebd2b..8c6605595 100644 --- a/Src/Vessel/DeltaGlider/DGLua.cpp +++ b/Src/Vessel/DeltaGlider/DGLua.cpp @@ -11,9 +11,9 @@ #include extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } // ========================================================================== diff --git a/Src/Vessel/HST/CMakeLists.txt b/Src/Vessel/HST/CMakeLists.txt index 070e1090b..5cba80841 100644 --- a/Src/Vessel/HST/CMakeLists.txt +++ b/Src/Vessel/HST/CMakeLists.txt @@ -35,7 +35,7 @@ add_dependencies(HST if(ADD_SCRIPT_SUPPORT) add_definitions(-DSCRIPTSUPPORT) - target_link_libraries(HST lua) + target_link_libraries(HST lua::lib) endif() add_custom_command( diff --git a/Src/Vessel/HST/HST_Lua.cpp b/Src/Vessel/HST/HST_Lua.cpp index 801b4d7c4..485ac3b6f 100644 --- a/Src/Vessel/HST/HST_Lua.cpp +++ b/Src/Vessel/HST/HST_Lua.cpp @@ -14,9 +14,9 @@ #ifdef SCRIPTSUPPORT extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } // ========================================================================== diff --git a/Src/Vessel/Quadcopter/CMakeLists.txt b/Src/Vessel/Quadcopter/CMakeLists.txt index d4f23e0f9..af40ef9b7 100644 --- a/Src/Vessel/Quadcopter/CMakeLists.txt +++ b/Src/Vessel/Quadcopter/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(Quadcopter target_link_libraries(Quadcopter ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ) add_dependencies(Quadcopter diff --git a/Src/Vessel/Quadcopter/QuadcopterLua.h b/Src/Vessel/Quadcopter/QuadcopterLua.h index e926b7534..07772e604 100644 --- a/Src/Vessel/Quadcopter/QuadcopterLua.h +++ b/Src/Vessel/Quadcopter/QuadcopterLua.h @@ -5,9 +5,9 @@ #define __QUADCOPTERLUA_H extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } class Quadcopter; diff --git a/Src/Vessel/ScriptVessel/CMakeLists.txt b/Src/Vessel/ScriptVessel/CMakeLists.txt index de1b9efbb..04178ff67 100644 --- a/Src/Vessel/ScriptVessel/CMakeLists.txt +++ b/Src/Vessel/ScriptVessel/CMakeLists.txt @@ -17,7 +17,7 @@ target_include_directories(ScriptVessel target_link_libraries(ScriptVessel ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ) add_dependencies(ScriptVessel diff --git a/Src/Vessel/ScriptVessel/ScriptVessel.cpp b/Src/Vessel/ScriptVessel/ScriptVessel.cpp index 395a76029..55ff30f64 100644 --- a/Src/Vessel/ScriptVessel/ScriptVessel.cpp +++ b/Src/Vessel/ScriptVessel/ScriptVessel.cpp @@ -21,9 +21,9 @@ #include #include extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } #include "orbitersdk.h" #include diff --git a/Src/Vessel/ShuttleA/CMakeLists.txt b/Src/Vessel/ShuttleA/CMakeLists.txt index f40a81937..39b97d57f 100644 --- a/Src/Vessel/ShuttleA/CMakeLists.txt +++ b/Src/Vessel/ShuttleA/CMakeLists.txt @@ -47,7 +47,7 @@ target_link_libraries(ShuttleA ${ORBITER_LIB} ${ORBITER_SDK_LIB} ${ORBITER_DLGCTRL_LIB} - lua + lua::lib ) # scan mesh files for labels and output to header file diff --git a/Src/Vessel/ShuttleA/ShuttleALua.cpp b/Src/Vessel/ShuttleA/ShuttleALua.cpp index 20c05892a..b0e5a55ee 100644 --- a/Src/Vessel/ShuttleA/ShuttleALua.cpp +++ b/Src/Vessel/ShuttleA/ShuttleALua.cpp @@ -5,9 +5,9 @@ #include "adiball.h" extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } // ========================================================================== diff --git a/Src/Vessel/Solarsail/CMakeLists.txt b/Src/Vessel/Solarsail/CMakeLists.txt index 8b7552efe..410155758 100644 --- a/Src/Vessel/Solarsail/CMakeLists.txt +++ b/Src/Vessel/Solarsail/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories(Solarsail target_link_libraries(Solarsail ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ) add_custom_command( diff --git a/Src/Vessel/Solarsail/SailLua.cpp b/Src/Vessel/Solarsail/SailLua.cpp index 476e013d3..94ea3b4ff 100644 --- a/Src/Vessel/Solarsail/SailLua.cpp +++ b/Src/Vessel/Solarsail/SailLua.cpp @@ -4,9 +4,9 @@ #include "SolarSail.h" extern "C" { -#include "Lua/lua.h" -#include "Lua/lualib.h" -#include "Lua/lauxlib.h" +#include +#include +#include } using std::min; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d1756cfcd..fe5ebd607 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1,3 +1,13 @@ +Include(FetchContent) + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview3 +) + +FetchContent_MakeAvailable(Catch2) + # Utility function function(add_test_file test_name) add_executable(${test_name} "${test_name}.cpp") @@ -13,7 +23,7 @@ function(add_test_file test_name) target_link_libraries(${test_name} ${ORBITER_LIB} ${ORBITER_SDK_LIB} - lua + lua::lib ${LUAINTERPRETER_LIB} Catch2::Catch2WithMain ) From 97430832f57b39c596df74d603395c42a9be5e4f Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Sun, 4 Aug 2024 01:21:12 +0300 Subject: [PATCH 05/11] Restore ldoc line --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a8d2bfe3..703fd770c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,7 @@ set(HTMLHELP_LIB_DIR ${HTMLHELP_DIR}/lib-${ARCH}) set(HTMLHELP_LIB ${HTMLHELP_LIB_DIR}/Htmlhelp.lib) set(ORBITER_TOOL_MESHC "$") +set(ldoc $ ${ORBITER_BINARY_ROOT_DIR}/packages/LDoc/ldoc.lua -v --multimodule) find_package(OpenGL QUIET) find_package(HTMLHelp) From 1704068dbc3a25a6e1557511472e09bec2bb16f2 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Tue, 13 Aug 2024 11:59:01 +0300 Subject: [PATCH 06/11] Try to enable doc build --- .github/workflows/reusable-build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 0c0fcde6c..d17fc0808 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -68,8 +68,13 @@ jobs: del DXSDK_Jun10.exe dir /S /B DXSDK + - uses: zauguin/install-texlive@v3 + with: + packages: > + l3build latex latex-bin luatex + - name: Configure - run: cmake . --preset windows-${{ inputs.architecture }}-release -DORBITER_MAKE_DOC=OFF -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK" + run: cmake . --preset windows-${{ inputs.architecture }}-release -DORBITER_MAKE_DOC=ON -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK" - name: Build run: cmake --build --preset windows-${{ inputs.architecture }}-release --jobs 2 From d769fdecc6f1956233d9fe3e697effda07defd05 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Fri, 16 Aug 2024 12:32:34 +0200 Subject: [PATCH 07/11] Enable docs build for testing --- .github/workflows/reusable-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index e35793151..7dbd8619c 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -17,7 +17,7 @@ on: docs: description: Build documentation? type: boolean - default: false + default: true # for testing, TODO: disable again run-name: Build ${{ inputs.architecture }} on ${{ inputs.os }} From 034626fd49dda57dd54efb770a1d550befc6accd Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Thu, 22 Aug 2024 18:37:23 +0200 Subject: [PATCH 08/11] Attempt to fix build error (revert lua location to root) --- Extern/Lua/CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Extern/Lua/CMakeLists.txt b/Extern/Lua/CMakeLists.txt index 7323c1332..ad13cbe08 100644 --- a/Extern/Lua/CMakeLists.txt +++ b/Extern/Lua/CMakeLists.txt @@ -21,11 +21,14 @@ add_executable(lua-exe ${LUA_SRC_FILES} "${lua_SOURCE_DIR}/lua.c") set_target_properties(lua-exe PROPERTIES OUTPUT_NAME lua) set_target_properties(lua-exe PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils - LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils - RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/Utils + ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} + RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} ) -install(TARGETS lua-exe DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Utils) + +install(TARGETS lua RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) +install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua) +install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) # Library - lua.dll add_library(lua SHARED ${LUA_SRC_FILES}) From 61c0ebaf86313474b10556c52562d972dfd8c85c Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Thu, 22 Aug 2024 18:37:50 +0200 Subject: [PATCH 09/11] CMake error fix --- Extern/Lua/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Extern/Lua/CMakeLists.txt b/Extern/Lua/CMakeLists.txt index ad13cbe08..841dc7ccd 100644 --- a/Extern/Lua/CMakeLists.txt +++ b/Extern/Lua/CMakeLists.txt @@ -26,9 +26,9 @@ set_target_properties(lua-exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} ) -install(TARGETS lua RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) -install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua) -install(TARGETS lua DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) +install(TARGETS lua-exe RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR}) +install(TARGETS lua-exe DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua) +install(TARGETS lua-exe DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) # Library - lua.dll add_library(lua SHARED ${LUA_SRC_FILES}) From bfbddee6ffca9e07e4f0315bd8fb4493ff827ae1 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Thu, 22 Aug 2024 19:15:33 +0200 Subject: [PATCH 10/11] Build error fix --- Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt index d210e2518..46391338b 100644 --- a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt +++ b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt @@ -47,11 +47,10 @@ add_custom_command(TARGET LuaInterpreter ) if(ORBITER_MAKE_DOC) - set(ldoc $ ${lua_module_ldoc_SOURCE_DIR}/ldoc.lua -v --multimodule) file(GLOB lua_in *.h *.cpp *.ld *.md *.lua) add_custom_command( POST_BUILD - DEPENDS ${lua_in} lfs + DEPENDS ${lua_in} lfs CopyLDoc OUTPUT ${BUILD_OUT_DIR}/index.html COMMAND ${CMAKE_COMMAND} -E copy ${lua_in} ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${ldoc} . From 7001240eac2a7a39250e75cef4a5461ef2db9ca4 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Thu, 22 Aug 2024 23:37:34 +0300 Subject: [PATCH 11/11] Revert generating docs by default --- .github/workflows/reusable-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 7dbd8619c..e35793151 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -17,7 +17,7 @@ on: docs: description: Build documentation? type: boolean - default: true # for testing, TODO: disable again + default: false run-name: Build ${{ inputs.architecture }} on ${{ inputs.os }}