mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
replace more global commands by target-based ones
This commit is contained in:
parent
4b5ebffa5b
commit
7595ecbc09
1 changed files with 44 additions and 30 deletions
|
@ -33,8 +33,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
check_include_file(poll.h HAVE_POLL_H)
|
check_include_file(poll.h HAVE_POLL_H)
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
check_include_file(stdint.h HAVE_STDINT_H)
|
||||||
# option(CHIBI_SCHEME_USE_DL "Use dynamic loading" ON)
|
|
||||||
set(CHIBI_SCHEME_USE_DL OFF)
|
|
||||||
|
|
||||||
if (WIN32 AND NOT CYGWIN)
|
if (WIN32 AND NOT CYGWIN)
|
||||||
set(DEFAULT_SHARED_LIBS OFF)
|
set(DEFAULT_SHARED_LIBS OFF)
|
||||||
|
@ -44,28 +42,8 @@ endif()
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build chibi-scheme as a shared library" ${DEFAULT_SHARED_LIBS})
|
option(BUILD_SHARED_LIBS "Build chibi-scheme as a shared library" ${DEFAULT_SHARED_LIBS})
|
||||||
|
|
||||||
if(NOT ${BUILD_SHARED_LIBS})
|
|
||||||
add_definitions(-DSEXP_STATIC_LIBRARY=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CHIBI_SCHEME_USE_DL)
|
|
||||||
add_definitions(-DSEXP_USE_DL=1)
|
|
||||||
else()
|
|
||||||
add_definitions(-DSEXP_USE_DL=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(HAVE_STDINT_H)
|
|
||||||
add_definitions(-DSEXP_USE_INTTYPES=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT HAVE_POLL_H)
|
|
||||||
# Disable green threads: It depends on non-blocking I/O
|
|
||||||
add_definitions(-DSEXP_USE_GREEN_THREADS=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(chibi-scheme-exclude-modules)
|
set(chibi-scheme-exclude-modules)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DBUILDING_DLL)
|
|
||||||
set(chibi-scheme-exclude-modules
|
set(chibi-scheme-exclude-modules
|
||||||
# Following modules are not compatible with Win32
|
# Following modules are not compatible with Win32
|
||||||
lib/chibi/net.sld
|
lib/chibi/net.sld
|
||||||
|
@ -76,6 +54,39 @@ if(WIN32)
|
||||||
lib/chibi/pty.sld)
|
lib/chibi/pty.sld)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Default settings for all targets. We use an interface library here to not
|
||||||
|
# pollute/mutate global settings.
|
||||||
|
#
|
||||||
|
|
||||||
|
add_library(libchibi-common
|
||||||
|
INTERFACE)
|
||||||
|
|
||||||
|
target_include_directories(libchibi-common
|
||||||
|
INTERFACE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
|
||||||
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(libchibi-common INTERFACE SEXP_USE_DL=0)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(libchibi-common INTERFACE SEXP_USE_DL=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${BUILD_SHARED_LIBS})
|
||||||
|
add_definitions(-DSEXP_STATIC_LIBRARY=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_STDINT_H)
|
||||||
|
target_compile_definitions(libchibi-common INTERFACE SEXP_USE_INTTYPES=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HAVE_POLL_H)
|
||||||
|
# Disable green threads: It depends on non-blocking I/O
|
||||||
|
target_compile_definitions(libchibi-common INTERFACE SEXP_USE_GREEN_THREADS=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sources
|
# Sources
|
||||||
#
|
#
|
||||||
|
@ -93,10 +104,6 @@ set(chibi-scheme-srcs
|
||||||
eval.c
|
eval.c
|
||||||
simplify.c)
|
simplify.c)
|
||||||
|
|
||||||
include_directories(
|
|
||||||
include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bootstrap
|
# Bootstrap
|
||||||
#
|
#
|
||||||
|
@ -106,6 +113,9 @@ add_executable(chibi-scheme-bootstrap
|
||||||
${chibi-scheme-srcs}
|
${chibi-scheme-srcs}
|
||||||
main.c)
|
main.c)
|
||||||
|
|
||||||
|
target_link_libraries(chibi-scheme-bootstrap
|
||||||
|
PRIVATE libchibi-common)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(chibi-scheme-bootstrap ws2_32)
|
target_link_libraries(chibi-scheme-bootstrap ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
@ -156,6 +166,9 @@ add_custom_target(chibi-scheme-stubs DEPENDS ${stubouts})
|
||||||
add_library(libchibi-scheme
|
add_library(libchibi-scheme
|
||||||
${chibi-scheme-srcs})
|
${chibi-scheme-srcs})
|
||||||
|
|
||||||
|
target_link_libraries(libchibi-scheme
|
||||||
|
PUBLIC libchibi-common)
|
||||||
|
|
||||||
set_target_properties(libchibi-scheme
|
set_target_properties(libchibi-scheme
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
||||||
|
@ -175,7 +188,6 @@ if (NOT BUILD_SHARED_LIBS)
|
||||||
${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}
|
||||||
|
@ -198,6 +210,11 @@ if (NOT BUILD_SHARED_LIBS)
|
||||||
target_sources(libchibi-scheme
|
target_sources(libchibi-scheme
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${clibout})
|
${clibout})
|
||||||
|
|
||||||
|
target_include_directories(libchibi-common
|
||||||
|
INTERFACE
|
||||||
|
$<BUILD_INTERFACE:${stuboutdir}/..>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_link_libraries(libchibi-scheme ws2_32)
|
target_link_libraries(libchibi-scheme ws2_32)
|
||||||
target_compile_definitions(libchibi-scheme PUBLIC BUILDING_DLL=1)
|
target_compile_definitions(libchibi-scheme PUBLIC BUILDING_DLL=1)
|
||||||
|
@ -214,9 +231,6 @@ endfunction()
|
||||||
# Interpreter
|
# Interpreter
|
||||||
#
|
#
|
||||||
|
|
||||||
include_directories(
|
|
||||||
.
|
|
||||||
${stuboutdir}/..)
|
|
||||||
add_executable(chibi-scheme
|
add_executable(chibi-scheme
|
||||||
main.c)
|
main.c)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue