feat(build): setup basic cmake build system for c library
This commit is contained in:
parent
2e0df8aa37
commit
f5d55b2655
3 changed files with 32 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Build
|
||||
25
CMakeLists.txt
Normal file
25
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(Hallocy C)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/Include)
|
||||
file(GLOB_RECURSE SRC_FILES "${PROJECT_SOURCE_DIR}/Src/*.c")
|
||||
|
||||
add_library(Hallocy STATIC ${SRC_FILES})
|
||||
add_executable(HallocyApp ${PROJECT_SOURCE_DIR}/Src/Main.c)
|
||||
|
||||
target_link_libraries(HallocyApp Hallocy)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(Hallocy PRIVATE /W4 /Zl)
|
||||
else()
|
||||
target_compile_options(Hallocy PRIVATE -mavx512f -mavx512vl)
|
||||
target_compile_options(HallocyApp PRIVATE -mavx512f -mavx512vl)
|
||||
|
||||
target_compile_options(Hallocy PRIVATE -march=native)
|
||||
target_compile_options(HallocyApp PRIVATE -march=native)
|
||||
|
||||
target_compile_options(Hallocy PRIVATE -Wall -Wextra -pedantic)
|
||||
endif()
|
||||
6
Src/Main.c
Normal file
6
Src/Main.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello, World!\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue