Skip to content

Commit

Permalink
Build procedure migrated to Conan 2.*
Browse files Browse the repository at this point in the history
  • Loading branch information
tyoma authored and Artem Gevorkyan committed Jan 21, 2025
1 parent 83174b9 commit 2874c25
Show file tree
Hide file tree
Showing 10 changed files with 715 additions and 1,065 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
config:
- os: ubuntu-22.04
- os: windows-2019
- os: macos-12
- os: macos-13

steps:
- uses: actions/checkout@v2
Expand All @@ -33,11 +33,9 @@ jobs:
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.59.0

- name: Configure CMake
run: cmake -B ${{github.workspace}}/_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/_build -S ${{github.workspace}} -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=${{github.workspace}}/build.props/conan_provider.cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/_build --config ${{env.BUILD_TYPE}} --parallel 4
Expand Down
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ set(sandbox "micro-profiler_sandbox_${archid}")

enable_testing()

set(SPECIFIC_CONFIGS CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL)
foreach(v ${SPECIFIC_CONFIGS})
string(REPLACE /MDd /MTd ${v} ${${v}})
string(REPLACE /MD /MT ${v} ${${v}})
endforeach()

# Setup include directories
include_directories(${CMAKE_CURRENT_LIST_DIR})
include_directories($<$<PLATFORM_ID:Windows>:${CMAKE_CURRENT_LIST_DIR}/compat/win32>)
if (MSVC)
include_directories($<$<VERSION_LESS_EQUAL:${MSVC_VERSION},1600>:${CMAKE_CURRENT_LIST_DIR}/compat/msvc10->)
endif ()


# Add definitions: global, platform-based, compiler-based
Expand All @@ -51,7 +48,6 @@ if (UNIX OR (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8))
endif()

if (MSVC)
include_directories($<$<VERSION_LESS_EQUAL:${MSVC_VERSION},1600>:${CMAKE_CURRENT_LIST_DIR}/compat/msvc10->)
add_definitions(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
add_definitions(-DUNICODE -D_UNICODE)
endif ()
Expand Down Expand Up @@ -86,6 +82,8 @@ set(MSVC_COMPILER_OPTIONS_DEBUG ${MSVC_COMPILER_OPTIONS})
set(MSVC_COMPILER_OPTIONS_RELEASE ${MSVC_COMPILER_OPTIONS} -GL)
set(MSVC_COMPILER_OPTIONS_RELEASE_MAX -Ox;-Ob2;-Oi;-Ot;-Oy)

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

add_compile_options(
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:$<$<COMPILE_LANGUAGE:C>:${GCC_CLANG_COMPILER_OPTIONS_C}>>"
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:$<$<COMPILE_LANGUAGE:CXX>:${GCC_CLANG_COMPILER_OPTIONS_CXX}>>"
Expand Down
Loading

0 comments on commit 2874c25

Please sign in to comment.