Browse Source

Merge pull request #1602 from kambala-decapitator/conan-foce-v1

force Conan to use v1
Andrey Filipenkov 2 years ago
parent
commit
bb81bde2be
8 changed files with 12 additions and 34 deletions
  1. 2 2
      .github/workflows/github.yml
  2. 1 1
      CMakeLists.txt
  3. 1 0
      Global.h
  4. 3 9
      client/CMakeLists.txt
  5. 0 13
      cmake_modules/VCMIUtils.cmake
  6. 1 1
      docs/conan.md
  7. 2 2
      lib/CMakeLists.txt
  8. 2 6
      lib/VCMIDirs.cpp

+ 2 - 2
.github/workflows/github.yml

@@ -136,7 +136,7 @@ jobs:
     - name: Conan setup
       if: "${{ matrix.conan_profile != '' }}"
       run: |
-        pip3 install conan
+        pip3 install 'conan<2.0'
         conan profile new default --detect
         conan install . \
           --install-folder=conan-generated \
@@ -200,7 +200,7 @@ jobs:
       with:
         name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
         path: |
-          ${{github.workspace}}/**/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
+          ${{github.workspace}}/out/build/${{matrix.preset}}/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
 
     - name: Upload build
       if: ${{ matrix.pack == 1 && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform == 'msvc' }}

+ 1 - 1
CMakeLists.txt

@@ -499,9 +499,9 @@ if(APPLE_IOS)
 	add_subdirectory(ios)
 endif()
 
+set(VCMI_LIB_TARGET vcmi)
 include(VCMI_lib)
 add_subdirectory(lib)
-set(VCMI_LIB_TARGET vcmi)
 if(ENABLE_SINGLE_APP_BUILD)
 	add_subdirectory(lib_server)
 endif()

+ 1 - 0
Global.h

@@ -138,6 +138,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
 #include <utility>
 #include <vector>
 #include <atomic>
+#include <mutex>
 
 //The only available version is 3, as of Boost 1.50
 #include <boost/version.hpp>

+ 3 - 9
client/CMakeLists.txt

@@ -239,15 +239,7 @@ if(ANDROID) # android needs client/server to be libraries, not executables, so w
 	return()
 endif()
 
-if(WIN32)
-	set(client_ICON "VCMI_client.rc")
-endif()
-
-if(ENABLE_DEBUG_CONSOLE)
-	add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} ${client_ICON})
-else()
-	add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON})
-endif(ENABLE_DEBUG_CONSOLE)
+add_executable(vcmiclient ${client_SRCS} ${client_HEADERS})
 
 add_dependencies(vcmiclient vcmiserver BattleAI StupidAI VCAI)
 if(ENABLE_NULLKILLER_AI)
@@ -263,6 +255,7 @@ if(APPLE_IOS)
 endif()
 
 if(WIN32)
+	target_sources(vcmiclient PRIVATE "VCMI_client.rc")
 	set_target_properties(vcmiclient
 		PROPERTIES
 			OUTPUT_NAME "VCMI_client"
@@ -270,6 +263,7 @@ if(WIN32)
 	)
 	set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT vcmiclient)
 	if(NOT ENABLE_DEBUG_CONSOLE)
+		set_target_properties(vcmiclient PROPERTIES WIN32_EXECUTABLE)
 		target_link_libraries(vcmiclient SDL2::SDL2main)
 	endif()
 	target_compile_definitions(vcmiclient PRIVATE WINDOWS_IGNORE_PACKING_MISMATCH)

+ 0 - 13
cmake_modules/VCMIUtils.cmake

@@ -44,19 +44,6 @@ function(add_subdirectory_with_folder _folder_name _folder)
 	set_property(DIRECTORY "${_folder}" PROPERTY FOLDER "${_folder_name}")
 endfunction()
 
-# Macro for Xcode Projects generation
-# Slightly outdated, but useful reference for all options available here:
-# https://pewpewthespells.com/blog/buildsettings.html
-# https://github.com/samdmarshall/Xcode-Build-Settings-Reference
-if(${CMAKE_GENERATOR} MATCHES "Xcode")
-
-	macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
-		set_property(TARGET ${TARGET} PROPERTY
-			XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
-	endmacro(set_xcode_property)
-
-endif(${CMAKE_GENERATOR} MATCHES "Xcode")
-
 #######################################
 #        CMake debugging              #
 #######################################

+ 1 - 1
docs/conan.md

@@ -12,7 +12,7 @@ The following platforms are supported and known to work, others might require ch
 
 ## Getting started
 
-1. [Install Conan](https://docs.conan.io/en/latest/installation.html)
+1. [Install Conan](https://docs.conan.io/en/latest/installation.html). Currently we support only Conan v1, you can install it with `pip` like this: `pip3 install 'conan<2.0'`
 2. Execute in terminal: `conan profile new default --detect`
 
 ## Download dependencies

+ 2 - 2
lib/CMakeLists.txt

@@ -1,4 +1,4 @@
-add_main_lib(vcmi SHARED)
+add_main_lib(${VCMI_LIB_TARGET} SHARED)
 if(ENABLE_SINGLE_APP_BUILD)
-	target_compile_definitions(vcmi PUBLIC VCMI_LIB_NAMESPACE=LIB_CLIENT)
+	target_compile_definitions(${VCMI_LIB_TARGET} PUBLIC VCMI_LIB_NAMESPACE=LIB_CLIENT)
 endif()

+ 2 - 6
lib/VCMIDirs.cpp

@@ -705,12 +705,8 @@ namespace VCMIDirs
 			static VCMIDirsIOS singleton;
 		#endif
 
-		static bool initialized = false;
-		if (!initialized)
-		{
-			singleton.init();
-			initialized = true;
-		}
+		static std::once_flag flag;
+		std::call_once(flag, [] { singleton.init(); });
 		return singleton;
 	}
 }