-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake configuration for Visual Studio #42
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
125b3c2
Add base for VS project.
thomthom c9197f8
Add library src folder to source path.
thomthom 2d36379
Add library files to project.
thomthom a85691d
Add SLAPI headers/libs for SU2018.
thomthom 1ed1396
Reference SLAPI
thomthom 4583416
Fix build errors.
thomthom cf6d8fd
Fix build warning.
thomthom 9761bb7
Set up GoogleTest project.
thomthom 62a8696
Base for Color tests.
thomthom 0f81d3a
Add base for TypedValue tests.
thomthom f67133f
Move tests to their own folder.
thomthom c45c885
Fix googletest submodule.
thomthom f3ae814
Avoid returning NULL character from String::std_string. Fixes #37.
thomthom 43859dd
Fix .submodules such that SourceTree can also open it.
thomthom d7f9c8f
Correct indentation in .gitmodules.
thomthom 11395cc
Update VS project to reflect the new location of the headers.
thomthom b370f96
Update README with information on test setup.
thomthom 7ba1bef
Adding tests for Radians (different behaviour from original) Ref #40.
thomthom 89089d2
Correct Radians to original intent.
thomthom 74b9368
Move the location of the Windows C API.
thomthom bf05c1a
Eliminate warnings, and treat them as errors. Fixes #41.
thomthom d99786f
Base for CMake solution. Stubbing tests project.
thomthom c837df6
GoogleTest Cmake static lib.
thomthom 02b2c4c
Wrapper lib built as static lib via CMake.
thomthom 2185612
More Radians tests to correct directory.
thomthom 225e095
Fix test case names for Color class.
thomthom 93351db
Put files into groups.
thomthom 79c050c
Treat warnings as errors.
thomthom eba8b51
Remove the manually created VS solution.
thomthom 2a38092
Restore Windows libs missing due to .gitignore.
thomthom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,3 @@ | ||
[submodule "third-party/googletest"] | ||
path = third-party/googletest | ||
url = https://github.com/google/googletest.git |
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,44 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
project (SketchUpApiCppWrapper) | ||
|
||
# Define various paths: | ||
|
||
set(CPP_API_BASENAME "SUAPI-CppWrapper") | ||
set(CPP_API_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/include") | ||
set(CPP_API_SOURCE_PATH "${PROJECT_SOURCE_DIR}/src") | ||
set(CPP_API_TESTS_PATH "${PROJECT_SOURCE_DIR}/tests") | ||
|
||
set(CPP_API_THIRD_PARTY_PATH "${PROJECT_SOURCE_DIR}/third-party") | ||
|
||
# TODO(thomthom): Configure for Mac: | ||
set(SLAPI_PATH "${CPP_API_THIRD_PARTY_PATH}/slapi") | ||
set(SLAPI_INCLUDE_PATH "${SLAPI_PATH}/win/headers") | ||
set(SLAPI_BINARIES_PATH "${SLAPI_PATH}/win/binaries") | ||
set(SLAPI_BINARIES_X64_PATH "${SLAPI_BINARIES_PATH}/sketchup/x64") | ||
# TODO(thomthom): Add library paths per platform, and try to add just "SketchUpAPI" | ||
# to `target_link_libraries`. | ||
set(SLAPI_LIB "${SLAPI_BINARIES_X64_PATH}/SketchUpAPI.lib") | ||
|
||
set(GOOGLETEST_PATH "${CPP_API_THIRD_PARTY_PATH}/googletest/googletest") | ||
set(GOOGLETEST_INCLUDE_PATH "${GOOGLETEST_PATH}/include") | ||
|
||
|
||
# GoogleTest 1.8 produce a warning that must be silenced. The fix is yet to be | ||
# pushed to the GoogleTest stable branch. | ||
# warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 | ||
# namespace and TR1-only machinery are deprecated and will be REMOVED. You can | ||
# define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING to acknowledge that you | ||
# have received this warning. | ||
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) | ||
|
||
# Avoid conflicting macros from Win32 API. | ||
add_definitions(-DWIN32_LEAN_AND_MEAN) | ||
add_definitions(-DNOMINMAX) | ||
|
||
|
||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/SketchUpAPICpp.cmake) | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoogleTest.cmake) | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/SketchUpAPITests.cmake) |
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 was deleted.
Oops, something went wrong.
110 changes: 0 additions & 110 deletions
110
SUAPI-CppWrapper.xcodeproj/xcshareddata/xcschemes/SU-Cpp-Wrapper.xcscheme
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include_directories(SYSTEM "${PROJECT_SOURCE_DIR}/third-party/googletest/googletest/include") | ||
include_directories("${PROJECT_SOURCE_DIR}/third-party/googletest/googletest") | ||
|
||
add_library(GoogleTest STATIC third-party/googletest/googletest/src/gtest-all.cc) |
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,31 @@ | ||
# TODO(thomthom): Configure for Mac: | ||
include_directories(SYSTEM "${SLAPI_INCLUDE_PATH}") | ||
include_directories("${CPP_API_INCLUDE_PATH}") | ||
|
||
file(GLOB_RECURSE CPP_API_HEADERS ${CPP_API_INCLUDE_PATH}/*.hpp) | ||
file(GLOB_RECURSE CPP_API_SOURCES ${CPP_API_SOURCE_PATH}/*.cpp) | ||
|
||
add_library(SketchUpAPICpp STATIC ${CPP_API_HEADERS} ${CPP_API_SOURCES}) | ||
|
||
# https://stackoverflow.com/a/14235055/486990 | ||
if ( MSVC ) | ||
# TODO(thomthom): Enable /W4 when the warnings it trigger is addressed. | ||
# target_compile_options(SketchUpAPICpp PRIVATE "/W4") | ||
target_compile_options(SketchUpAPICpp PRIVATE "/W3") | ||
target_compile_options(SketchUpAPICpp PRIVATE "/WX") | ||
target_compile_options(SketchUpAPICpp PRIVATE "/MP") | ||
else() | ||
# target_compile_options(SketchUpAPICpp PRIVATE "-Wall") | ||
target_compile_options(SketchUpAPICpp PRIVATE "-Werror") | ||
endif() | ||
|
||
source_group( | ||
TREE "${CPP_API_INCLUDE_PATH}/${CPP_API_BASENAME}" | ||
PREFIX "Header Files" | ||
FILES ${CPP_API_HEADERS} | ||
) | ||
source_group( | ||
TREE "${CPP_API_SOURCE_PATH}/${CPP_API_BASENAME}" | ||
PREFIX "Source Files" | ||
FILES ${CPP_API_SOURCES} | ||
) |
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,29 @@ | ||
include_directories("${CPP_API_TESTS_PATH}") | ||
include_directories("${GOOGLETEST_INCLUDE_PATH}") | ||
|
||
file(GLOB_RECURSE TESTS_HEADERS ${CPP_API_TESTS_PATH}/*.hpp) | ||
file(GLOB_RECURSE TESTS_SOURCES ${CPP_API_TESTS_PATH}/*.cpp) | ||
|
||
add_executable(SketchUpAPITests ${TESTS_HEADERS} ${TESTS_SOURCES}) | ||
|
||
target_link_libraries(SketchUpAPITests GoogleTest SketchUpAPICpp ${SLAPI_LIB}) | ||
|
||
set_target_properties(${SketchUpAPITests} PROPERTIES COMPILE_FLAGS "-Wall") | ||
|
||
source_group( | ||
"Tests" | ||
REGULAR_EXPRESSION "${CPP_API_TESTS_PATH}/[^\//]+Tests.cpp" | ||
) | ||
# Force the CPP file that define `main` to not appear in the Tests list. | ||
source_group( | ||
"Source Files" | ||
FILES "${CPP_API_TESTS_PATH}/SketchUpAPITests.cpp" | ||
) | ||
|
||
# TODO(thomthom): Set up per-platform post-build commands. | ||
add_custom_command(TARGET SketchUpAPITests POST_BUILD | ||
# xcopy seem to require at least one \ slash in the source path, otherwise it | ||
# appear to fail. | ||
COMMAND xcopy \"${SLAPI_BINARIES_PATH}\\sketchup\\x64\\SketchUpAPI.dll\" $(OutputPath) /D /Y | ||
COMMAND xcopy \"${SLAPI_BINARIES_PATH}\\sketchup\\x64\\SketchUpCommonPreferences.dll\" $(OutputPath) /D /Y | ||
) |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want this to apply to all of the folowing targets, or just GoogleTest? It should be appended to the GoogleTest.cmake file and made so it only acts on GoogleTest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could probably be omitted for the wrapper lib, but the Tests project also needs it as including the GoogleTest headers cause warnings also there.