diff --git a/.gitignore b/.gitignore index 5f143dd..480e255 100755 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,10 @@ lib/ LIB/ out/ +# Tests +[Tt]est/ +[Tt]ests/ + # IDE .vs/ .vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 41bb90a..e3e4e19 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,10 @@ project("Based" LANGUAGES C ASM) # ============================================= #unset(DOCUMENTATION CACHE) #unset(INTERNAL_DOC, CACHE) +#unset(BUILD_EXAMPLES, CACHE) option(DOCUMENTATION "Enable to generate ducumentation." OFF) option(INTERNAL_DOC "Enable to generate internal & public documentaion. Disable to only generate public documentation" OFF) +option(BUILD_EXAMPLES "Build tests." OFF) # ============================================= # Policies @@ -18,6 +20,7 @@ cmake_policy(SET CMP0076 NEW) # ============================================= # Compiler # ============================================= +set(CMAKE_BUILD_TYPE Debug) if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # GNUCC # Add linker options. add_link_options(-nostdlib -nodefaultlibs -nostdinc -lgcc) # -z noexecstack @@ -39,25 +42,27 @@ endif() # ============================================= # Directories # ============================================= -set(PROJ_BUILD_DIR ${CMAKE_BINARY_DIR}) +set(PROJ_BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin) -set(PROJ_REL_BUILD_DIR ${CMAKE_BINARY_DIR}/release) +set(PROJ_REL_BUILD_DIR ${PROJ_BUILD_DIR}/release) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin) -set(PROJ_DEB_BUILD_DIR ${CMAKE_BINARY_DIR}/debug) +set(PROJ_DEB_BUILD_DIR ${PROJ_BUILD_DIR}/debug) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin) add_subdirectory(src) add_subdirectory(include) -add_subdirectory(tests) +if (BUILD_EXAMPLES) +add_subdirectory(examples) +endif(BUILD_EXAMPLES) if (DOCUMENTATION) add_subdirectory(doc) endif(DOCUMENTATION) \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..f5f5e8b --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,3 @@ +# CMakeLists examples directory + +add_subdirectory(HelloWorld) \ No newline at end of file diff --git a/tests/HelloWorld/CMakeLists.txt b/examples/HelloWorld/CMakeLists.txt similarity index 100% rename from tests/HelloWorld/CMakeLists.txt rename to examples/HelloWorld/CMakeLists.txt diff --git a/examples/HelloWorld/hello b/examples/HelloWorld/hello new file mode 100755 index 0000000..9ada1ee Binary files /dev/null and b/examples/HelloWorld/hello differ diff --git a/tests/HelloWorld/main.c b/examples/HelloWorld/main.c similarity index 100% rename from tests/HelloWorld/main.c rename to examples/HelloWorld/main.c diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 382b37e..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -# CMakeLists test directory - -add_subdirectory(HelloWorld) \ No newline at end of file