diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/blt-gp.iml b/.idea/blt-gp.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/blt-gp.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..12e9493 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..0a294a1 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b7daef..bb12412 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,10 @@ cmake_minimum_required(VERSION 3.28) -project(blt-gp VERSION 0.0.2) +project(blt-gp VERSION 0.0.3) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) +option(BUILD_EXAMPLES "Build example programs. This is a single executable" OFF) set(CMAKE_CXX_STANDARD 17) @@ -12,7 +13,7 @@ add_subdirectory(lib/blt) include_directories(include/) file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") -add_executable(blt-gp ${PROJECT_BUILD_FILES}) +add_library(blt-gp ${PROJECT_BUILD_FILES}) target_compile_options(blt-gp PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment) target_link_options(blt-gp PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment) @@ -33,3 +34,31 @@ if (${ENABLE_TSAN} MATCHES ON) target_compile_options(blt-gp PRIVATE -fsanitize=thread) target_link_options(blt-gp PRIVATE -fsanitize=thread) endif () + +if (${BUILD_EXAMPLES}) + project(blt-gp-example) + + add_executable(blt-gp-example examples/main.cpp) + + target_link_libraries(blt-gp-example PUBLIC BLT blt-gp) + + target_compile_options(blt-gp-example PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment) + target_link_options(blt-gp-example PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment) + + if (${ENABLE_ADDRSAN} MATCHES ON) + target_compile_options(blt-gp-example PRIVATE -fsanitize=address) + target_link_options(blt-gp-example PRIVATE -fsanitize=address) + endif () + + if (${ENABLE_UBSAN} MATCHES ON) + target_compile_options(blt-gp-example PRIVATE -fsanitize=undefined) + target_link_options(blt-gp-example PRIVATE -fsanitize=undefined) + endif () + + if (${ENABLE_TSAN} MATCHES ON) + target_compile_options(blt-gp-example PRIVATE -fsanitize=thread) + target_link_options(blt-gp-example PRIVATE -fsanitize=thread) + endif () + + project(blt-gp) +endif () \ No newline at end of file diff --git a/examples/main.cpp b/examples/main.cpp new file mode 100644 index 0000000..639b0dd --- /dev/null +++ b/examples/main.cpp @@ -0,0 +1,23 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +int main() +{ + std::cout << "Hello World!" << std::endl; +} \ No newline at end of file diff --git a/src/gp.cpp b/src/gp.cpp new file mode 100644 index 0000000..8c72729 --- /dev/null +++ b/src/gp.cpp @@ -0,0 +1,17 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 6f2b004..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() -{ - std::cout << "Hello World!" << std::endl; -}