mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
generate and add clibs.c only for static builds
This commit is contained in:
parent
5402d86323
commit
9fab5cf4dd
1 changed files with 40 additions and 33 deletions
|
@ -142,18 +142,34 @@ foreach(e ${stubs})
|
|||
endforeach()
|
||||
add_custom_target(chibi-scheme-stubs DEPENDS ${stubouts})
|
||||
|
||||
#
|
||||
# Core library
|
||||
#
|
||||
|
||||
add_library(libchibi-scheme
|
||||
${chibi-scheme-srcs})
|
||||
|
||||
set_target_properties(libchibi-scheme
|
||||
PROPERTIES
|
||||
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
||||
VERSION ${CMAKE_PROJECT_VERSION})
|
||||
|
||||
add_dependencies(libchibi-scheme chibi-scheme-stubs)
|
||||
|
||||
#
|
||||
# Generate clib.c for SEXP_USE_STATIC_LIBS
|
||||
#
|
||||
|
||||
string(REPLACE ";" "\n" genstatic-input "${slds}")
|
||||
set(clibin ${CMAKE_CURRENT_BINARY_DIR}/clib-in.txt)
|
||||
set(clibout ${CMAKE_CURRENT_BINARY_DIR}/clib.c)
|
||||
set(genstatic-helper
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
string(REPLACE ";" "\n" genstatic-input "${slds}")
|
||||
set(clibin ${CMAKE_CURRENT_BINARY_DIR}/clib-in.txt)
|
||||
set(clibout ${CMAKE_CURRENT_BINARY_DIR}/clib.c)
|
||||
set(genstatic-helper
|
||||
${CMAKE_CURRENT_LIST_DIR}/contrib/chibi-genstatic-helper.cmake)
|
||||
file(WRITE ${clibin} "${genstatic-input}")
|
||||
file(WRITE ${clibin} "${genstatic-input}")
|
||||
|
||||
add_custom_command(OUTPUT ${clibout}
|
||||
|
||||
add_custom_command(OUTPUT ${clibout}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-DEXEC=$<TARGET_FILE:chibi-scheme-bootstrap>
|
||||
|
@ -168,25 +184,16 @@ add_custom_command(OUTPUT ${clibout}
|
|||
${genstatic-helper}
|
||||
${slds})
|
||||
|
||||
#
|
||||
# Core library
|
||||
#
|
||||
target_compile_definitions(libchibi-scheme
|
||||
PUBLIC
|
||||
SEXP_USE_STATIC_LIBS=1)
|
||||
|
||||
add_library(libchibi-scheme
|
||||
${chibi-scheme-srcs}
|
||||
target_sources(libchibi-scheme
|
||||
PUBLIC
|
||||
${clibout})
|
||||
|
||||
set_target_properties(libchibi-scheme
|
||||
PROPERTIES
|
||||
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
||||
VERSION ${CMAKE_PROJECT_VERSION}
|
||||
COMPILE_DEFINITIONS "SEXP_USE_STATIC_LIBS=1")
|
||||
|
||||
add_dependencies(libchibi-scheme chibi-scheme-stubs)
|
||||
|
||||
if(WIN32 AND ${BUILD_SHARED_LIBS})
|
||||
elseif(WIN32)
|
||||
target_link_libraries(libchibi-scheme ws2_32)
|
||||
target_compile_definitions(libchibi-scheme PUBLIC -DBUILDING_DLL=1)
|
||||
target_compile_definitions(libchibi-scheme PUBLIC BUILDING_DLL=1)
|
||||
endif()
|
||||
|
||||
function(bless_chibi_scheme_executable tgt)
|
||||
|
|
Loading…
Add table
Reference in a new issue