cmake: add support to compile for Windows and Mac

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-03-26 12:24:46 -07:00
parent 0a4444930e
commit c41b1dc688

View file

@ -119,6 +119,19 @@ ADD_CUSTOM_TARGET(version ALL COMMAND
-P ${CMAKE_BINARY_DIR}/version.cmake
)
SET(PLATFORM_SRC unknown_platform.c)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(PLATFORM_SRC linux.c)
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(PLATFORM_SRC macos.c)
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
SET(PLATFORM_SRC windows.c)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
remove_definitions(-DUNICODE)
ENDIF()
# compile the core library, in C.
SET(SUBSURFACE_CORE_LIB_SRCS
cochran.c
@ -151,7 +164,6 @@ SET(SUBSURFACE_CORE_LIB_SRCS
uemis.c
uemis-downloader.c
version.c
linux.c
#gettextfrommoc should be added because we are using it on the c-code.
gettextfromc.cpp
#dirk ported some core functionality to c++.
@ -163,6 +175,7 @@ SET(SUBSURFACE_CORE_LIB_SRCS
configuredivecomputer.cpp
configuredivecomputerthreads.cpp
divesitehelpers.cpp
${PLATFORM_SRC}
)
#the interface, in C++