-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change folder structure, move global set to targets
Adding each file to the cmake file is no longer needed update scripts and readme add compile_commands.json support
- Loading branch information
1 parent
506bda9
commit 00abad5
Showing
17 changed files
with
99 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,4 +55,4 @@ x64/* | |
*.user | ||
*.db | ||
*.suo | ||
build/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c17", | ||
"intelliSenseMode": "linux-clang-x64", | ||
"compileCommands": "${workspaceFolder}/build/debug/compile_commands.json" | ||
}, | ||
{ | ||
"name": "Mac", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c17", | ||
"intelliSenseMode": "macos-clang-arm64", | ||
"compileCommands": "${workspaceFolder}/build/debug/compile_commands.json" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# | ||
# Default settings | ||
# | ||
# set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
# set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
# set(CMAKE_EXPORT_COMPILE_COMMANDS 1) | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) |
7 changes: 4 additions & 3 deletions
7
ProjectFolder/scripts/cmake_build.sh → ProjectFolder/scripts/build_cmake.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo "Started cmake_build.sh, building CMAKE files..." | ||
# cd ProjectFolder | ||
echo "Started building CMAKE files..." | ||
# Clearing build folder if it exists | ||
rm -r build &> /dev/null | ||
# This command also generates clang compile commands here: | ||
# ProjectFolder/build/debug/compile_commands.json | ||
cmake -SProjectFolder -Bbuild/debug -DCMAKE_BUILD_TYPE=Debug | ||
echo "Finished building CMAKE files..." | ||
echo "Finished building CMAKE files!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Add any new directory that you add in ProjectFolder/src here | ||
file(GLOB_RECURSE sources utility/*.cpp) | ||
add_library(${PROJECT_NAME}_LIB ${sources}) | ||
|
||
target_compile_definitions( | ||
${PROJECT_NAME}_LIB | ||
PRIVATE | ||
# Add compile definitions here | ||
) | ||
|
||
target_compile_features( | ||
${PROJECT_NAME}_LIB | ||
PRIVATE | ||
c_std_11 | ||
cxx_std_17 | ||
) | ||
|
||
target_compile_options( | ||
${PROJECT_NAME}_LIB | ||
PRIVATE | ||
${DEFAULT_COMPILER_OPTIONS} | ||
) | ||
|
||
target_link_options( | ||
${PROJECT_NAME}_LIB | ||
PRIVATE | ||
${DEFAULT_LINKER_OPTIONS} | ||
) | ||
|
||
target_link_libraries( | ||
${PROJECT_NAME}_LIB | ||
PRIVATE | ||
# Add libraries to link to the binary here | ||
) | ||
|
||
set_target_properties( | ||
${PROJECT_NAME}_LIB | ||
PROPERTIES ENABLE_EXPORTS ON | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
#include <iostream> | ||
|
||
#include "src/lib/utility.h" | ||
#include "utility/utility.h" | ||
|
||
int main() | ||
{ | ||
|
Empty file.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
enable_testing() | ||
|
||
# test_utility | ||
add_executable(test_utility test_utility.cpp) | ||
target_link_libraries(test_utility ${LIB_TARGET}) | ||
target_link_libraries(test_utility ${PROJECT_NAME}_LIB) | ||
add_test(utility ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_utility) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include "test.h" | ||
|
||
#include "../src/lib/utility.h" | ||
#include "utility/utility.h" | ||
|
||
void testHelloWorld() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters