first draft of premake/cmake build files for clsocket (tiny cross-platform TCP socket library)

This commit is contained in:
Erwin Coumans 2017-02-19 11:48:01 -08:00
parent 957266b121
commit 4faa6613c9
4 changed files with 38 additions and 29 deletions

View File

@ -251,6 +251,7 @@ end
include "../examples/ExtendedTutorials"
include "../examples/SharedMemory"
include "../examples/ThirdPartyLibs/BussIK"
include "../examples/MultiThreading"
if _OPTIONS["lua"] then
@ -270,6 +271,11 @@ end
include "../examples/ThirdPartyLibs/midi"
end
if not _OPTIONS["no_clsocket"] then
include "../examples/ThirdPartyLibs/clsocket"
defines {"BT_ENABLE_CLSOCKET"}
end
if not _OPTIONS["no-enet"] then
include "../examples/ThirdPartyLibs/enet"
include "../test/enet/nat_punchthrough/client"

View File

@ -1,6 +1,6 @@
SUBDIRS( HelloWorld BasicDemo )
IF(BUILD_BULLET3)
SUBDIRS( ExampleBrowser SharedMemory ThirdPartyLibs/Gwen ThirdPartyLibs/BussIK OpenGLWindow )
SUBDIRS( ExampleBrowser SharedMemory ThirdPartyLibs/Gwen ThirdPartyLibs/BussIK ThirdPartyLibs/clsocket OpenGLWindow )
ENDIF()
IF(BUILD_PYBULLET)
SUBDIRS(pybullet)

View File

@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(clsocket)
#cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
#project(clsocket)
# set up versioning.
set(BUILD_MAJOR "1")
set(BUILD_MINOR "4")
set(BUILD_VERSION "3")
#set(BUILD_MAJOR "1")
#set(BUILD_MINOR "4")
#set(BUILD_VERSION "3")
include_directories(src)
@ -45,13 +45,14 @@ elseif(WIN32)
# Special MINGW stuff here
elseif(MSVC)
# Special MSVC stuff here
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
else()
# No idea what it is, but there's a good chance it's too weird.
MESSAGE( FATAL_ERROR "Using unknown WIN32 compiler... NOT. Please add to build system." )
endif()
endif()
OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." ON)
OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." OFF)
OPTION(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." OFF)
# make the lib
@ -78,25 +79,3 @@ else()
endif()
OPTION(CLSOCKET_EXAMPLES "Build the examples" ON)
ADD_EXECUTABLE(echoserver-example examples/EchoServer.cpp)
TARGET_LINK_LIBRARIES(echoserver-example clsocket)
ADD_EXECUTABLE(querydaytime-example examples/QueryDayTime.cpp)
TARGET_LINK_LIBRARIES(querydaytime-example clsocket)
if(UNIX)
if(CLSOCKET_EXAMPLES)
ADD_EXECUTABLE(clsocket-example examples/RecvAsync.cpp)
TARGET_LINK_LIBRARIES(clsocket-example clsocket pthread)
if(NOT CLSOCKET_DEP_ONLY)
install(TARGETS clsocket-example DESTINATION bin)
endif()
endif()
endif()

View File

@ -0,0 +1,24 @@
project "clsocket"
kind "StaticLib"
if os.is("Windows") then
defines { "WIN32","_WINSOCK_DEPRECATED_NO_WARNINGS" }
end
if os.is("Linux") then
defines {"HAS_SOCKLEN_T","_LINUX"}
end
if os.is("MacOSX") then
defines {"HAS_SOCKLEN_T","_DARWIN"}
end
includedirs {
".","include"
}
files {
"src/SimpleSocket.cpp",
"src/ActiveSocket.cpp",
"src/PassiveSocket.cpp",
"**.h"
}