From ec74a93de8d1115e290c1f8057349c01a0b5741d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 23 Jan 2024 01:03:35 -0600 Subject: [PATCH] lib: further split the build Move orch.core into lib/core, which povides a nice symmetry with the module name and makes room to organize, e.g., a future orch.tty. Signed-off-by: Kyle Evans --- lib/CMakeLists.txt | 23 +---------------------- lib/core/CMakeLists.txt | 26 ++++++++++++++++++++++++++ lib/{ => core}/orch_compat.c | 0 lib/{ => core}/orch_lua.c | 0 lib/{ => core}/orch_spawn.c | 0 5 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 lib/core/CMakeLists.txt rename lib/{ => core}/orch_compat.c (100%) rename lib/{ => core}/orch_lua.c (100%) rename lib/{ => core}/orch_spawn.c (100%) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 23b90f2..256a98b 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,27 +1,6 @@ - -file(GLOB core_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c) - -set(warnings "-Wall -Wextra -Werror") -if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") -endif() - -add_library(core SHARED ${core_SOURCES}) -set_target_properties(core PROPERTIES - PREFIX "") -add_library(core_static STATIC ${core_SOURCES}) - -set(core_INCDIRS "${CMAKE_SOURCE_DIR}/include" "${LUA_INCLUDE_DIR}") -target_include_directories(core PRIVATE ${core_INCDIRS}) -# orch(1) will link against the static lib -target_include_directories(core_static PRIVATE ${core_INCDIRS}) - -target_link_libraries(core "${LUA_LIBRARIES}") +add_subdirectory(core) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/orch.lua" DESTINATION "${CMAKE_INSTALL_PREFIX}${LUA_MODSHAREDIR}") -install(TARGETS core - DESTINATION "${CMAKE_INSTALL_PREFIX}${LUA_MODLIBDIR}/orch") - add_custom_target(lint COMMAND luacheck "${CMAKE_CURRENT_SOURCE_DIR}/orch.lua") diff --git a/lib/core/CMakeLists.txt b/lib/core/CMakeLists.txt new file mode 100644 index 0000000..d6a97a8 --- /dev/null +++ b/lib/core/CMakeLists.txt @@ -0,0 +1,26 @@ + +file(GLOB core_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c) + +set(warnings "-Wall -Wextra -Werror") +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") +endif() + +add_library(core SHARED ${core_SOURCES}) +set_target_properties(core PROPERTIES + PREFIX "") +add_library(core_static STATIC ${core_SOURCES}) + +set(core_INCDIRS + "${CMAKE_SOURCE_DIR}/include" + "${CMAKE_SOURCE_DIR}/lib" + "${LUA_INCLUDE_DIR}") + +target_include_directories(core PRIVATE ${core_INCDIRS}) +# orch(1) will link against the static lib +target_include_directories(core_static PRIVATE ${core_INCDIRS}) + +target_link_libraries(core "${LUA_LIBRARIES}") + +install(TARGETS core + DESTINATION "${CMAKE_INSTALL_PREFIX}${LUA_MODLIBDIR}/orch") diff --git a/lib/orch_compat.c b/lib/core/orch_compat.c similarity index 100% rename from lib/orch_compat.c rename to lib/core/orch_compat.c diff --git a/lib/orch_lua.c b/lib/core/orch_lua.c similarity index 100% rename from lib/orch_lua.c rename to lib/core/orch_lua.c diff --git a/lib/orch_spawn.c b/lib/core/orch_spawn.c similarity index 100% rename from lib/orch_spawn.c rename to lib/core/orch_spawn.c