Commit 010380f0 authored by deuce's avatar deuce
Browse files

Make COMIO a library, which means requiring it (And, currently, linking to it!)

from everything that links with the sbbs library.

Also, use the absolute path to the 3rdp stuff to silence CMake warnings.
parent bf3ac627
project (COMIO C)
cmake_minimum_required(VERSION 2.8.11)
INCLUDE(../build/SynchronetMacros.cmake)
set(SOURCE
comio.c
)
if(WIN32)
list(APPEND SOURCE comio_win32.c)
else()
list(APPEND SOURCE comio_nix.c)
endif()
add_library(comio SHARED ${SOURCE})
set_target_properties(comio PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
require_lib(comio xpdev)
target_compile_definitions(comio PRIVATE COMIO_EXPORTS)
target_compile_definitions(comio INTERFACE COMIO_IMPORTS)
set(INSTALL_HEADERS
comio.h
)
export(PACKAGE COMIO)
install(TARGETS comio DESTINATION lib EXPORT COMIOConfig)
install(FILES ${INSTALL_HEADERS} DESTINATION include)
install(EXPORT COMIOConfig DESTINATION lib/cmake/COMIO)
......@@ -58,7 +58,6 @@ set(SBBS_OBJS
bulkmail
chat.cpp
chk_ar
../comio/comio
con_hi
con_out
dat_rec
......@@ -158,22 +157,16 @@ set(SBBS_OBJS
yenc
ver
)
if(WIN32)
list(APPEND SBBS_OBJS ../comio/comio_win32)
else()
list(APPEND SBBS_OBJS ../comio/comio_nix)
endif()
add_library(sbbs SHARED ${SBBS_OBJS})
require_libs(sbbs xpdev smblib)
target_include_directories(sbbs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../comio)
require_libs(sbbs xpdev smblib comio)
target_compile_definitions(sbbs PUBLIC SBBS SBBS_EXPORTS JAVASCRIPT)
get_filename_component(3RDP_DIR ../../3rdp ABSOLUTE)
if(WIN32)
find_library(MOZJS_LIB mozjs PATHS ../../3rdp/win32.release/mozjs/bin NO_DEFAULT_PATH)
find_library(CRYPTLIB_LIB cl32 PATHS ../../3rdp/win32.release/cryptlib/bin NO_DEFAULT_PATH)
target_include_directories(sbbs PUBLIC ../../3rdp/win32.release/mozjs/include)
target_include_directories(sbbs PUBLIC ../../3rdp/win32.release/cryptlib/include)
find_library(MOZJS_LIB mozjs PATHS ${3RDP_DIR}/win32.release/mozjs/bin NO_DEFAULT_PATH)
find_library(CRYPTLIB_LIB cl32 PATHS ${3RDP_DIR}/win32.release/cryptlib/bin NO_DEFAULT_PATH)
target_include_directories(sbbs PUBLIC ${3RDP_DIR}/win32.release/mozjs/include)
target_include_directories(sbbs PUBLIC ${3RDP_DIR}/win32.release/cryptlib/include)
else()
execute_process(COMMAND nspr-config --libs OUTPUT_VARIABLE NSPR_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
separate_arguments(ADD_NSPR_LIBS UNIX_COMMAND ${NSPR_LIBS})
......@@ -193,33 +186,33 @@ else()
execute_process(COMMAND nspr-config --includedir OUTPUT_VARIABLE NSPR_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
target_compile_options(sbbs PUBLIC ${NSPR_CFLAGS})
target_include_directories(sbbs PUBLIC ${NSPR_INCLUDE_DIR})
find_library(MOZJS_LIB mozjs185-1.0 PATHS ../../3rdp/${LEGACY_3RDPDIR}/mozjs/lib NO_DEFAULT_PATH)
find_library(CRYPTLIB_LIB cl PATHS ../../3rdp/${LEGACY_3RDPDIR}/cl NO_DEFAULT_PATH)
target_include_directories(sbbs PUBLIC ../../3rdp/${LEGACY_3RDPDIR}/mozjs/include/js)
find_library(MOZJS_LIB mozjs185-1.0 PATHS ${3RDP_DIR}/${LEGACY_3RDPDIR}/mozjs/lib NO_DEFAULT_PATH)
find_library(CRYPTLIB_LIB cl PATHS ${3RDP_DIR}/${LEGACY_3RDPDIR}/cl NO_DEFAULT_PATH)
target_include_directories(sbbs PUBLIC ${3RDP_DIR}/${LEGACY_3RDPDIR}/mozjs/include/js)
add_dependencies(sbbs 3rdp)
endif()
target_link_libraries(sbbs ${MOZJS_LIB})
target_link_libraries(sbbs ${CRYPTLIB_LIB})
add_library(ftpsrvr SHARED ftpsrvr.c nopen.c)
require_libs(ftpsrvr xpdev smblib)
require_libs(ftpsrvr xpdev smblib comio)
target_link_libraries(ftpsrvr sbbs)
add_library(mailsrvr SHARED mailsrvr.c mxlookup.c mime.c ars.c base64.c)
require_libs(mailsrvr xpdev smblib)
require_libs(mailsrvr xpdev smblib comio)
target_link_libraries(mailsrvr sbbs)
add_library(services SHARED services.c sbbs_ini.c)
require_libs(services xpdev smblib)
require_libs(services xpdev smblib comio)
target_link_libraries(services sbbs)
add_library(websrvr SHARED websrvr.c base64.c ars.c ringbuf.c)
require_libs(websrvr xpdev smblib)
require_libs(websrvr xpdev smblib comio)
target_link_libraries(websrvr sbbs)
add_executable(sbbscon sbbscon.c sbbs_ini.c)
set_target_properties(sbbscon PROPERTIES OUTPUT_NAME sbbs)
require_libs(sbbscon xpdev smblib)
require_libs(sbbscon xpdev smblib comio)
target_link_libraries(sbbscon ftpsrvr)
target_link_libraries(sbbscon mailsrvr)
target_link_libraries(sbbscon websrvr)
......@@ -230,7 +223,7 @@ if(WIN32)
add_executable(ntsvcs ntsvcs.c sbbs_ini.c)
target_compile_definitions(ntsvcs PRIVATE SBBS SBBS_EXPORTS JAVASCRIPT)
set_target_properties(ntsvcs PROPERTIES OUTPUT_NAME sbbs)
require_libs(ntsvcs xpdev smblib)
require_libs(ntsvcs xpdev smblib comio)
target_link_libraries(ntsvcs ftpsrvr)
target_link_libraries(ntsvcs mailsrvr)
target_link_libraries(ntsvcs websrvr)
......@@ -245,7 +238,7 @@ add_executable(jsexec
jsdebug.c
)
target_compile_definitions(jsexec PRIVATE SBBS SBBS_EXPORTS JAVASCRIPT)
require_libs(jsexec xpdev smblib ciolib uifc)
require_libs(jsexec xpdev smblib ciolib uifc comio)
target_link_libraries(jsexec ftpsrvr)
target_link_libraries(jsexec mailsrvr)
target_link_libraries(jsexec websrvr)
......
......@@ -6,21 +6,13 @@ INCLUDE(../build/SynchronetMacros.cmake)
INCLUDE (CheckIncludeFiles)
set(SOURCE
../comio/comio.c
../sbbs3/telnet.c
sexpots.c
)
if(WIN32)
list(APPEND SOURCE ../comio/comio_win32.c)
else()
list(APPEND SOURCE ../comio/comio_nix.c)
endif()
add_executable(sexpots ${SOURCE})
require_lib(sexpots xpdev)
require_libs(sexpots xpdev comio)
target_include_directories(sexpots PRIVATE ../sbbs3)
target_include_directories(sexpots PRIVATE ../comio)
install(TARGETS sexpots DESTINATION bin)
......@@ -35,15 +35,11 @@ set(SOURCE
ooii_bmenus.c
ooii_sounds.c
modem.c
../comio/comio.c
conn_pty.c
)
if(WIN32)
list(APPEND SOURCE ../comio/comio_win32.c)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/../../3rdp/win32.release/cryptlib/include)
else()
list(APPEND SOURCE ../comio/comio_nix.c)
endif()
CHECK_INCLUDE_FILES(cryptlib.h HAS_CRYPTLIB_H)
......@@ -52,10 +48,9 @@ if(HAS_CRYPTLIB_H)
endif()
add_executable(syncterm ${SOURCE})
require_libs(syncterm xpdev ciolib uifc)
require_libs(syncterm xpdev ciolib uifc comio)
target_include_directories(syncterm PRIVATE ../sbbs3)
target_include_directories(syncterm PRIVATE ../comio)
target_include_directories(syncterm PRIVATE ../smblib)
if(NOT HAS_CRYPTLIB_H)
......
......@@ -12,8 +12,8 @@ set(SOURCE
add_library(uifc SHARED ${SOURCE})
require_libs(uifc xpdev ciolib)
target_compile_definitions(ciolib PRIVATE UIFC_EXPORTS)
target_compile_definitions(ciolib INTERFACE UIFC_IMPORTS)
target_compile_definitions(uifc PRIVATE UIFC_EXPORTS)
target_compile_definitions(uifc INTERFACE UIFC_IMPORTS)
export(PACKAGE UIFC)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment