Skip to content

Commit

Permalink
lib: further split the build
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kevans91 committed Jan 23, 2024
1 parent d0f03f2 commit ec74a93
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
23 changes: 1 addition & 22 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
26 changes: 26 additions & 0 deletions lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ec74a93

Please sign in to comment.