mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 13:07:54 +00:00
[client] replace custom Makefile with cmake build
This commit is contained in:
parent
a507dd0c51
commit
26c4804892
3 changed files with 77 additions and 55 deletions
58
client/CMakeLists.txt
Normal file
58
client/CMakeLists.txt
Normal file
|
@ -0,0 +1,58 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
project(looking-glass-client C)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
|
||||
SET(CMAKE_C_FLAGS "-std=gnu99 -g -O3 -march=native -Wall -Werror -Wfatal-errors -ffast-math -fdata-sections -ffunction-sections -Wl,--gc-sections")
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKGCONFIG REQUIRED
|
||||
sdl2
|
||||
SDL2_ttf
|
||||
gl
|
||||
glu
|
||||
spice-protocol
|
||||
fontconfig
|
||||
x11
|
||||
libconfig
|
||||
nettle
|
||||
hogweed
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git describe --always --long --dirty --abbrev=10 --tags
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE BUILD_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
find_package(GMP)
|
||||
|
||||
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
||||
add_definitions(-D USE_NETTLE)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/../common
|
||||
${PKGCONFIG_INCLUDE_DIRS}
|
||||
${GMP_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
link_libraries(
|
||||
${PKGCONFIG_LIBRARIES}
|
||||
${GMP_LIBRARIES}
|
||||
rt m
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
main.c
|
||||
lg-renderer.c
|
||||
ll.c
|
||||
spice/rsa.c
|
||||
spice/spice.c
|
||||
decoders/null.c
|
||||
renderers/opengl.c
|
||||
)
|
||||
|
||||
add_executable(looking-glass-client ${SOURCES})
|
||||
target_compile_options(looking-glass-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER})
|
|
@ -1,55 +0,0 @@
|
|||
BINARY = looking-glass-client
|
||||
CFLAGS = -g -O3 -std=gnu99 -march=native -Wall -Werror -I./ -I../common -DDEBUG -DATOMIC_LOCKING
|
||||
LDFLAGS = -lrt -lm
|
||||
|
||||
CFLAGS += -ffast-math
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
CFLAGS += -Wfatal-errors
|
||||
|
||||
LIBS = sdl2 SDL2_ttf gl glu spice-protocol fontconfig x11 libconfig
|
||||
|
||||
LIBS += nettle hogweed
|
||||
CFLAGS += -D USE_NETTLE
|
||||
LDFLAGS += -lgmp
|
||||
|
||||
#LIBS += libssl openssl
|
||||
#CFLAGS += -D USE_OPENSSL
|
||||
|
||||
CFLAGS += $(shell pkg-config --cflags $(LIBS))
|
||||
LDFLAGS += $(shell pkg-config --libs $(LIBS))
|
||||
BUILD ?= .build
|
||||
BIN ?= bin
|
||||
|
||||
CFLAGS += -DBUILD_VERSION='"$(shell git describe --always --long --dirty --abbrev=10 --tags)"'
|
||||
|
||||
OBJS = main.o \
|
||||
lg-renderer.o \
|
||||
ll.o \
|
||||
spice/rsa.o \
|
||||
spice/spice.o \
|
||||
parsers/nal.o \
|
||||
decoders/null.o \
|
||||
renderers/opengl.o
|
||||
|
||||
BUILD_OBJS = $(foreach obj,$(OBJS),$(BUILD)/$(obj))
|
||||
|
||||
all: $(BIN)/$(BINARY) $(BIN)/xlib-shim.so
|
||||
|
||||
$(BIN):
|
||||
mkdir -p $@
|
||||
|
||||
$(BIN)/xlib-shim.so: $(BIN)
|
||||
$(CC) -fPIC $(CFLAGS) -shared -o $@ xlib-shim.c
|
||||
|
||||
$(BUILD)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/$(BINARY): $(BIN) $(BUILD_OBJS)
|
||||
$(CC) -o $@ $(BUILD_OBJS) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD) $(BIN)
|
||||
|
||||
.PHONY: clean
|
19
client/cmake/FindGMP.cmake
Normal file
19
client/cmake/FindGMP.cmake
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Try to find the GMP librairies
|
||||
# GMP_FOUND - system has GMP lib
|
||||
# GMP_INCLUDE_DIR - the GMP include directory
|
||||
# GMP_LIBRARIES - Libraries needed to use GMP
|
||||
|
||||
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(GMP_FIND_QUIETLY TRUE)
|
||||
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
|
||||
|
||||
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
|
||||
find_library(GMP_LIBRARIES NAMES gmp libgmp )
|
||||
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx )
|
||||
MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
|
||||
|
||||
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)
|
Loading…
Reference in a new issue