mirror of
https://github.com/Silicondust/libhdhomerun
synced 2025-08-20 13:33:29 -07:00
Update build system to CMake
This commit is contained in:
parent
1efbcb2b87
commit
95e06e1796
2 changed files with 46 additions and 59 deletions
46
CMakeLists.txt
Normal file
46
CMakeLists.txt
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
|
||||||
|
IF(APPLE)
|
||||||
|
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
|
||||||
|
ELSEIF(UNIX)
|
||||||
|
SET(CMAKE_INSTALL_PREFIX "/usr")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
project (SiliconDust)
|
||||||
|
|
||||||
|
set(CMAKE_BUILD_TYPE RELEASE)
|
||||||
|
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
add_library(hdhomerun SHARED
|
||||||
|
hdhomerun_channels.c
|
||||||
|
hdhomerun_channelscan.c
|
||||||
|
hdhomerun_control.c
|
||||||
|
hdhomerun_debug.c
|
||||||
|
hdhomerun_device.c
|
||||||
|
hdhomerun_device_selector.c
|
||||||
|
hdhomerun_discover.c
|
||||||
|
hdhomerun_os_posix.c
|
||||||
|
hdhomerun_pkt.c
|
||||||
|
hdhomerun_sock_posix.c
|
||||||
|
hdhomerun_video.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET hdhomerun PROPERTY VERSION "20161117")
|
||||||
|
set_property(TARGET hdhomerun PROPERTY SOVERSION 1 )
|
||||||
|
IF(WIN32)
|
||||||
|
target_link_libraries(hdhomerun PUBLIC pthread iphlpapi)
|
||||||
|
ELSE()
|
||||||
|
target_link_libraries(hdhomerun PUBLIC pthread rt)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
add_executable(hdhomerun_config
|
||||||
|
hdhomerun_config.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(hdhomerun_config PUBLIC hdhomerun)
|
||||||
|
|
||||||
|
install(TARGETS hdhomerun DESTINATION lib)
|
||||||
|
install(TARGETS hdhomerun_config DESTINATION bin)
|
59
Makefile
59
Makefile
|
@ -1,59 +0,0 @@
|
||||||
|
|
||||||
LIBSRCS += hdhomerun_channels.c
|
|
||||||
LIBSRCS += hdhomerun_channelscan.c
|
|
||||||
LIBSRCS += hdhomerun_control.c
|
|
||||||
LIBSRCS += hdhomerun_debug.c
|
|
||||||
LIBSRCS += hdhomerun_device.c
|
|
||||||
LIBSRCS += hdhomerun_device_selector.c
|
|
||||||
LIBSRCS += hdhomerun_discover.c
|
|
||||||
LIBSRCS += hdhomerun_os_posix.c
|
|
||||||
LIBSRCS += hdhomerun_pkt.c
|
|
||||||
LIBSRCS += hdhomerun_sock_posix.c
|
|
||||||
LIBSRCS += hdhomerun_video.c
|
|
||||||
|
|
||||||
CC := $(CROSS_COMPILE)gcc
|
|
||||||
STRIP := $(CROSS_COMPILE)strip
|
|
||||||
|
|
||||||
CFLAGS += -O2 -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter
|
|
||||||
LDFLAGS += -lpthread
|
|
||||||
SHARED = -shared -Wl,-soname,libhdhomerun$(LIBEXT)
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
BINEXT := .exe
|
|
||||||
LIBEXT := .dll
|
|
||||||
LDFLAGS += -liphlpapi
|
|
||||||
else
|
|
||||||
OS := $(shell uname -s)
|
|
||||||
LIBEXT := .so
|
|
||||||
ifeq ($(OS),Linux)
|
|
||||||
LDFLAGS += -lrt
|
|
||||||
endif
|
|
||||||
ifeq ($(OS),SunOS)
|
|
||||||
LDFLAGS += -lsocket
|
|
||||||
endif
|
|
||||||
ifeq ($(OS),Darwin)
|
|
||||||
CFLAGS += -arch i386 -arch x86_64
|
|
||||||
LIBEXT := .dylib
|
|
||||||
SHARED := -dynamiclib -install_name libhdhomerun$(LIBEXT)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
all : hdhomerun_config$(BINEXT) libhdhomerun$(LIBEXT)
|
|
||||||
|
|
||||||
hdhomerun_config$(BINEXT) : hdhomerun_config.c $(LIBSRCS)
|
|
||||||
$(CC) $(CFLAGS) $+ $(LDFLAGS) -o $@
|
|
||||||
$(STRIP) $@
|
|
||||||
|
|
||||||
libhdhomerun$(LIBEXT) : $(LIBSRCS)
|
|
||||||
$(CC) $(CFLAGS) -fPIC -DDLL_EXPORT $(SHARED) $+ $(LDFLAGS) -o $@
|
|
||||||
|
|
||||||
clean :
|
|
||||||
-rm -f hdhomerun_config$(BINEXT)
|
|
||||||
-rm -f libhdhomerun$(LIBEXT)
|
|
||||||
|
|
||||||
distclean : clean
|
|
||||||
|
|
||||||
%:
|
|
||||||
@echo "(ignoring request to make $@)"
|
|
||||||
|
|
||||||
.PHONY: all list clean distclean
|
|
Loading…
Add table
Add a link
Reference in a new issue