mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +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()
|
endforeach()
|
||||||
add_custom_target(chibi-scheme-stubs DEPENDS ${stubouts})
|
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
|
# Generate clib.c for SEXP_USE_STATIC_LIBS
|
||||||
#
|
#
|
||||||
|
|
||||||
string(REPLACE ";" "\n" genstatic-input "${slds}")
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
set(clibin ${CMAKE_CURRENT_BINARY_DIR}/clib-in.txt)
|
string(REPLACE ";" "\n" genstatic-input "${slds}")
|
||||||
set(clibout ${CMAKE_CURRENT_BINARY_DIR}/clib.c)
|
set(clibin ${CMAKE_CURRENT_BINARY_DIR}/clib-in.txt)
|
||||||
set(genstatic-helper
|
set(clibout ${CMAKE_CURRENT_BINARY_DIR}/clib.c)
|
||||||
|
set(genstatic-helper
|
||||||
${CMAKE_CURRENT_LIST_DIR}/contrib/chibi-genstatic-helper.cmake)
|
${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
|
COMMAND
|
||||||
${CMAKE_COMMAND}
|
${CMAKE_COMMAND}
|
||||||
-DEXEC=$<TARGET_FILE:chibi-scheme-bootstrap>
|
-DEXEC=$<TARGET_FILE:chibi-scheme-bootstrap>
|
||||||
|
@ -168,25 +184,16 @@ add_custom_command(OUTPUT ${clibout}
|
||||||
${genstatic-helper}
|
${genstatic-helper}
|
||||||
${slds})
|
${slds})
|
||||||
|
|
||||||
#
|
target_compile_definitions(libchibi-scheme
|
||||||
# Core library
|
PUBLIC
|
||||||
#
|
SEXP_USE_STATIC_LIBS=1)
|
||||||
|
|
||||||
add_library(libchibi-scheme
|
target_sources(libchibi-scheme
|
||||||
${chibi-scheme-srcs}
|
PUBLIC
|
||||||
${clibout})
|
${clibout})
|
||||||
|
elseif(WIN32)
|
||||||
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})
|
|
||||||
target_link_libraries(libchibi-scheme ws2_32)
|
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()
|
endif()
|
||||||
|
|
||||||
function(bless_chibi_scheme_executable tgt)
|
function(bless_chibi_scheme_executable tgt)
|
||||||
|
|
Loading…
Add table
Reference in a new issue