Add CMake step, fix CMakeLists
All checks were successful
CI / build-and-analyze (push) Successful in 1m20s
All checks were successful
CI / build-and-analyze (push) Successful in 1m20s
This commit is contained in:
7
.github/workflows/ci.yaml
vendored
7
.github/workflows/ci.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
- name: Install tools
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y build-essential clang clang-tools clang-tidy cppcheck gcc-mingw-w64-x86-64
|
||||
sudo apt-get install -y build-essential clang clang-tools clang-tidy cppcheck gcc-mingw-w64-x86-64 cmake
|
||||
|
||||
- name: Build with GCC
|
||||
run: |
|
||||
@@ -34,6 +34,11 @@ jobs:
|
||||
make -f Makefile.posix clean
|
||||
make -f Makefile.mingw CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS="-std=c99 -Wall -Wextra -Wpedantic -Werror -O2"
|
||||
|
||||
- name: Build with CMake
|
||||
run: |
|
||||
cmake -S . -B build
|
||||
cmake --build build
|
||||
|
||||
- name: Linting checks
|
||||
run: |
|
||||
echo "Running all linting checks..."
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(CgeNet LANGUAGES C)
|
||||
project(CgeThread LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
@@ -8,19 +8,23 @@ set(SOURCES
|
||||
)
|
||||
|
||||
set(SOURCES_WIN32
|
||||
src/win32/Addr.c
|
||||
src/win32/Poll.c
|
||||
src/win32/Socket.c
|
||||
win32/Condition.c
|
||||
win32/Mutex.c
|
||||
win32/Semaphore.c
|
||||
win32/Thread.c
|
||||
win32/Tss.c
|
||||
)
|
||||
|
||||
set(SOURCES_POSIX
|
||||
src/posix/Addr.c
|
||||
src/posix/Poll.c
|
||||
src/posix/Socket.c
|
||||
posix/Condition.c
|
||||
posix/Mutex.c
|
||||
posix/Semaphore.c
|
||||
posix/Thread.c
|
||||
posix/Tss.c
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
CgeNet.h
|
||||
CgeThread.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
@@ -31,11 +35,11 @@ elseif(UNIX)
|
||||
list(APPEND SOURCES ${SOURCES_POSIX})
|
||||
endif()
|
||||
|
||||
add_library(CgeNet STATIC ${SOURCES} ${HEADERS})
|
||||
add_library(CgeThread STATIC ${SOURCES} ${HEADERS})
|
||||
|
||||
target_include_directories(CgeNet PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(CgeThread PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
install(TARGETS CgeNet
|
||||
install(TARGETS CgeThread
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
|
||||
Reference in New Issue
Block a user