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
|
- name: Install tools
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -qq
|
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
|
- name: Build with GCC
|
||||||
run: |
|
run: |
|
||||||
@@ -34,6 +34,11 @@ jobs:
|
|||||||
make -f Makefile.posix clean
|
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"
|
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
|
- name: Linting checks
|
||||||
run: |
|
run: |
|
||||||
echo "Running all linting checks..."
|
echo "Running all linting checks..."
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(CgeNet LANGUAGES C)
|
project(CgeThread LANGUAGES C)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
@@ -8,19 +8,23 @@ set(SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES_WIN32
|
set(SOURCES_WIN32
|
||||||
src/win32/Addr.c
|
win32/Condition.c
|
||||||
src/win32/Poll.c
|
win32/Mutex.c
|
||||||
src/win32/Socket.c
|
win32/Semaphore.c
|
||||||
|
win32/Thread.c
|
||||||
|
win32/Tss.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES_POSIX
|
set(SOURCES_POSIX
|
||||||
src/posix/Addr.c
|
posix/Condition.c
|
||||||
src/posix/Poll.c
|
posix/Mutex.c
|
||||||
src/posix/Socket.c
|
posix/Semaphore.c
|
||||||
|
posix/Thread.c
|
||||||
|
posix/Tss.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
CgeNet.h
|
CgeThread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -31,11 +35,11 @@ elseif(UNIX)
|
|||||||
list(APPEND SOURCES ${SOURCES_POSIX})
|
list(APPEND SOURCES ${SOURCES_POSIX})
|
||||||
endif()
|
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
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
|
|||||||
Reference in New Issue
Block a user