Skip to content

Commit

Permalink
Setup project tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Vol-Alex committed Mar 26, 2022
1 parent ebbe92d commit 7e88899
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@
*.exe
*.out
*.app

#MacOSX
.DS_Store

CMakeLists.txt.user
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
project (SCONE)

cmake_minimum_required(VERSION 3.11)

set(CMAKE_CXX_STANDARD 14)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

include_directories(PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB_RECURSE SRC ${CMAKE_SOURCE_DIR}/src/*.*)
file(GLOB_RECURSE HDR ${CMAKE_SOURCE_DIR}/src/*.h)

add_library(SCONE ${SRC})
set_target_properties(SCONE PROPERTIES PUBLIC_HEADER "${HDR}")

if(NOT SCONE_BUILD_LIB_ONLY)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/test")
endif()

include(GNUInstallDirs)
install(TARGETS SCONE
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SCONE")
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# SCONE
# SCONE - Smart Containers
11 changes: 11 additions & 0 deletions src/TaggedPtr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "TaggedPtr.h"

namespace SCONE
{

TaggedPtr::TaggedPtr()
{

}

} // namespace SCONE
12 changes: 12 additions & 0 deletions src/TaggedPtr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

namespace SCONE
{

class TaggedPtr
{
public:
TaggedPtr();
};

} // namespace SCONE
58 changes: 58 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# We need thread support
find_package(Threads REQUIRED)

# Enable ExternalProject CMake module
include(ExternalProject)

set(GTEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/gtest")
set(GTEST_BINARY_DIR "${GTEST_DIR}/bin")

set(GMOCK_LIB_PATH "${GTEST_BINARY_DIR}/lib/libgmock.a")
set(GTEST_LIB_PATH "${GTEST_BINARY_DIR}/lib/libgtest.a")

# Download and install GoogleTest
ExternalProject_Add(
gtest
URL https://github.com/google/googletest/archive/master.zip
PREFIX ${GTEST_DIR}
BINARY_DIR ${GTEST_BINARY_DIR}
BUILD_BYPRODUCTS ${GMOCK_LIB_PATH} ${GTEST_LIB_PATH}
# Disable install step
INSTALL_COMMAND ""
)

# Get GTest source and binary directories from CMake project
ExternalProject_Get_Property(gtest source_dir)

# Create a libgtest target to be used as a dependency by test programs
add_library(libgtest STATIC IMPORTED)

# Set libgtest properties
set_target_properties(libgtest PROPERTIES
"IMPORTED_LOCATION" "${GTEST_LIB_PATH}"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
)
add_dependencies(libgtest gtest)

# Create a libgmock target to be used as a dependency by test programs
add_library(libgmock STATIC IMPORTED)

# Set libgmock properties
set_target_properties(libgmock PROPERTIES
"IMPORTED_LOCATION" "${GMOCK_LIB_PATH}"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
)
add_dependencies(libgmock gtest)

include_directories("${source_dir}/googletest/include"
"${source_dir}/googlemock/include")

file(GLOB_RECURSE SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.*)

add_executable(tests ${SRC})
add_dependencies(tests gtest)
target_link_libraries(tests LINK_PUBLIC
SCONE
libgtest
libgmock
)
8 changes: 8 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "gtest/gtest.h"

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}

0 comments on commit 7e88899

Please sign in to comment.